Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
CffOutlineComplexity.h File Reference
#include <cstddef>
#include <cstdint>
#include <span>
#include <vector>
Include dependency graph for CffOutlineComplexity.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::fonts::CffGlyphOutlineComplexity
 Bounded outline cost proved for one CFF or CFF2 glyph. More...
struct  donner::fonts::CffOutlineValidationResult
 Per-glyph complexities returned by the bounded CFF interpreter. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Enumerations

enum class  donner::fonts::CffOutlineValidationStatus : uint8_t {
  Complete ,
  UnsupportedVariation ,
  WorkLimitExceeded ,
  Invalid
}
 Outcome of bounded CFF outline validation.

Functions

CffOutlineValidationResult donner::fonts::ValidateCffOutlineComplexities (std::span< const uint8_t > table, bool cff2, std::size_t expectedGlyphs, std::size_t maximumWork=kMaximumCffOutlineValidationWork)
 Validate CFF1 or non-variable CFF2 charstrings without materializing outlines.

Variables

constexpr std::size_t donner::fonts::kMaximumCffOutlineValidationWork = 64 * 1024 * 1024
 Default whole-font work ceiling for one bounded CFF validation.

Function Documentation

◆ ValidateCffOutlineComplexities()

CffOutlineValidationResult donner::fonts::ValidateCffOutlineComplexities ( std::span< const uint8_t > table,
bool cff2,
std::size_t expectedGlyphs,
std::size_t maximumWork = kMaximumCffOutlineValidationWork )

Validate CFF1 or non-variable CFF2 charstrings without materializing outlines.

Variable CFF2 operators return CffOutlineValidationStatus::UnsupportedVariation so callers can retain directory validation while failing closed before an untrusted outline decoder. Legacy CFF1 endchar composites include their resolved component costs in the returned bound.

Parameters
tableExact CFF or CFF2 table bytes.
cff2Whether table uses CFF2 structures and CharStrings.
expectedGlyphsGlyph count from the sfnt maxp table.
maximumWorkCaller-owned work remaining for this validation.