FontFaceData
in package
Common shape for a parsed font face — the fields any downstream consumer needs to lay out, shape, and embed text.
Subclassed by OpenTypeData (CFF outlines, sfVersion OTTO)
and TrueTypeData (glyf/loca outlines, sfVersion 0x00010000).
Both carry the same metric and glyph-mapping fields; the format-
specific parts (CFF table bytes vs raw TTF glyf data) live on the
subclass.
The base class itself is abstract readonly so the field set is
fixed at construction and the type hierarchy stays narrow: code
that hits a metric or a glyph lookup uses FontFaceData, and code
that has to embed the bytes into a PDF stream does an instanceof
check on the subclass to pick the CFF or TrueType embed path.
Optional fields on the base — verticalWidths, underlinePosition,
underlineThickness, mathTable — live here so any code that
reads them via the polymorphic type can do so safely. Subclasses
that don't carry the source table just leave the field null at
construction.
Table of Contents
Properties
- $ascent : int
- $capHeight : int
- $charWidths : array<string|int, mixed>
- $descent : int
- $embeddingAllowed : bool
- $familyName : string
- $flags : int
- $fontBBox : array<string|int, mixed>
- $fontBytes : string
- $fullUnicodeToGid : array<string|int, mixed>
- $glyphWidths : array<string|int, mixed>
- $italicAngle : float
- $kernPairs : array<string|int, mixed>|null
- $ligatures : array<string|int, mixed>|null
- $mathTable : MathTableData|null
- $postScriptName : string
- $stemV : int
- $underlinePosition : int|null
- $underlineThickness : int|null
- $unicodeMap : array<string|int, mixed>
- $unitsPerEm : int
- $verticalWidths : array<string|int, mixed>|null
- $xHeight : int
Methods
- __construct() : mixed
Properties
$ascent
public
int
$ascent
$capHeight
public
int
$capHeight
$charWidths
public
array<string|int, mixed>
$charWidths
$descent
public
int
$descent
$embeddingAllowed
public
bool
$embeddingAllowed
$familyName
public
string
$familyName
$flags
public
int
$flags
$fontBBox
public
array<string|int, mixed>
$fontBBox
$fontBytes
public
string
$fontBytes
$fullUnicodeToGid
public
array<string|int, mixed>
$fullUnicodeToGid
= []
$glyphWidths
public
array<string|int, mixed>
$glyphWidths
= []
$italicAngle
public
float
$italicAngle
$kernPairs
public
array<string|int, mixed>|null
$kernPairs
= null
$ligatures
public
array<string|int, mixed>|null
$ligatures
= null
$mathTable
public
MathTableData|null
$mathTable
= null
$postScriptName
public
string
$postScriptName
$stemV
public
int
$stemV
$underlinePosition
public
int|null
$underlinePosition
= null
$underlineThickness
public
int|null
$underlineThickness
= null
$unicodeMap
public
array<string|int, mixed>
$unicodeMap
$unitsPerEm
public
int
$unitsPerEm
= 1000
$verticalWidths
public
array<string|int, mixed>|null
$verticalWidths
= null
$xHeight
public
int
$xHeight
Methods
__construct()
public
__construct(string $postScriptName, string $familyName, int $ascent, int $descent, int $capHeight, int $xHeight, float $italicAngle, int $stemV, int $flags, array<int, int> $fontBBox, array<int, int> $charWidths, array<int, int> $unicodeMap, string $fontBytes, bool $embeddingAllowed[, int $unitsPerEm = 1000 ][, array<int, int> $fullUnicodeToGid = [] ][, array<int, int> $glyphWidths = [] ][, array<int, array<int, int>>|null $kernPairs = null ][, array<int, array<int, array{components: int[], ligature: int}>>|null $ligatures = null ][, array<int, int>|null $verticalWidths = null ][, int|null $underlinePosition = null ][, int|null $underlineThickness = null ][, MathTableData|null $mathTable = null ]) : mixed
Parameters
- $postScriptName : string
- $familyName : string
- $ascent : int
- $descent : int
- $capHeight : int
- $xHeight : int
- $italicAngle : float
- $stemV : int
- $flags : int
- $fontBBox : array<int, int>
-
[xMin, yMin, xMax, yMax] in 1000 units/em
- $charWidths : array<int, int>
-
WinAnsi byte (32-255) → advance (1000 units/em)
- $unicodeMap : array<int, int>
-
WinAnsi byte → Unicode codepoint
- $fontBytes : string
- $embeddingAllowed : bool
- $unitsPerEm : int = 1000
- $fullUnicodeToGid : array<int, int> = []
-
Unicode codepoint → GID
- $glyphWidths : array<int, int> = []
-
GID → advance (design units, unscaled)
- $kernPairs : array<int, array<int, int>>|null = null
-
leftGid → [rightGid → xAdvanceAdjust]
- $ligatures : array<int, array<int, array{components: int[], ligature: int}>>|null = null
-
firstGid → ligature rules
- $verticalWidths : array<int, int>|null = null
-
GID → vertical advance (design units)
- $underlinePosition : int|null = null
-
posttable FWord — offset of the underline's top edge from the baseline (design units; negative = below baseline). Null if the table is missing. - $underlineThickness : int|null = null
-
posttable FWord — underline stroke thickness in design units. - $mathTable : MathTableData|null = null
-
Parsed
MATHtable when the font has one.