phpdftk API Documentation

TrueTypeData extends FontFaceData
in package

Read onlyYes

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>
$isVariableFont  : bool
$italicAngle  : float
$kernPairs  : array<string|int, mixed>|null
$ligatures  : array<string|int, mixed>|null
$mathTable  : MathTableData|null
$namedInstances  : array<string|int, mixed>|null
$postScriptName  : string
$stemV  : int
$underlinePosition  : int|null
$underlineThickness  : int|null
$unicodeMap  : array<string|int, mixed>
$unitsPerEm  : int
$variationAxes  : array<string|int, mixed>|null
$verticalWidths  : array<string|int, mixed>|null
$xHeight  : int

Methods

__construct()  : mixed

Properties

$fullUnicodeToGid

public array<string|int, mixed> $fullUnicodeToGid = []

$glyphWidths

public array<string|int, mixed> $glyphWidths = []

$kernPairs

public array<string|int, mixed>|null $kernPairs = null

$ligatures

public array<string|int, mixed>|null $ligatures = null

$namedInstances

public array<string|int, mixed>|null $namedInstances = null

$underlinePosition

public int|null $underlinePosition = null

$underlineThickness

public int|null $underlineThickness = null

$variationAxes

public array<string|int, mixed>|null $variationAxes = null

$verticalWidths

public array<string|int, mixed>|null $verticalWidths = null

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 ][, bool $isVariableFont = false ][, array<int, array{tag: string, minValue: float, defaultValue: float, maxValue: float, nameId: int}>|null $variationAxes = null ][, array<int, array{subfamilyNameId: int, coordinates: array}>|null $namedInstances = null ]) : mixed
Parameters
$postScriptName : string

PostScript name (name table ID 6)

$familyName : string

Family name (name table ID 1)

$ascent : int

Typographic ascender scaled to 1000 units/em

$descent : int

Typographic descender (negative) scaled to 1000 units/em

$capHeight : int

Cap height scaled to 1000 units/em

$xHeight : int

x-height scaled to 1000 units/em

$italicAngle : float

Italic angle in degrees (from post table)

$stemV : int

Estimated vertical stem width (for PDF FontDescriptor)

$flags : int

PDF font flags bitmask (ISO 32000-2 Table 123)

$fontBBox : array<int, int>

[xMin, yMin, xMax, yMax] scaled to 1000 units/em

$charWidths : array<int, int>

WinAnsi byte (32-255) => advance width (1000 units/em)

$unicodeMap : array<int, int>

WinAnsi byte (32-255) => Unicode codepoint (only bytes with valid glyphs)

$fontBytes : string

Raw TTF file bytes

$embeddingAllowed : bool

false when fsType bits 1-2 indicate restricted licence (value 2)

$unitsPerEm : int = 1000

Font design units per em (from head table)

$fullUnicodeToGid : array<int, int> = []

All Unicode codepoint => GID mappings from cmap

$glyphWidths : array<int, int> = []

GID => advance width in font design units (unscaled)

$kernPairs : array<int, array<int, int>>|null = null

leftGid => [rightGid => xAdvanceAdjust] (design units)

$ligatures : array<int, array<int, array{components: int[], ligature: int}>>|null = null

firstGid => ligature rules

$isVariableFont : bool = false

Whether this is an OpenType variable font (has fvar table)

$variationAxes : array<int, array{tag: string, minValue: float, defaultValue: float, maxValue: float, nameId: int}>|null = null

Variation axis definitions from fvar

$namedInstances : array<int, array{subfamilyNameId: int, coordinates: array}>|null = null

Named instances from fvar


        
On this page

Search results