Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
TrueTypeData
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\FontParser;
6
7readonly class TrueTypeData
8{
9    /**
10     * @param string $postScriptName  PostScript name (name table ID 6)
11     * @param string $familyName      Family name (name table ID 1)
12     * @param int    $ascent          Typographic ascender scaled to 1000 units/em
13     * @param int    $descent         Typographic descender (negative) scaled to 1000 units/em
14     * @param int    $capHeight       Cap height scaled to 1000 units/em
15     * @param int    $xHeight         x-height scaled to 1000 units/em
16     * @param float  $italicAngle     Italic angle in degrees (from post table)
17     * @param int    $stemV           Estimated vertical stem width (for PDF FontDescriptor)
18     * @param int    $flags           PDF font flags bitmask (ISO 32000-2 Table 123)
19     * @param array<int, int>  $fontBBox        [xMin, yMin, xMax, yMax] scaled to 1000 units/em
20     * @param array<int, int>  $charWidths      WinAnsi byte (32-255) => advance width (1000 units/em)
21     * @param array<int, int>  $unicodeMap      WinAnsi byte (32-255) => Unicode codepoint (only bytes with valid glyphs)
22     * @param string $fontBytes       Raw TTF file bytes
23     * @param bool   $embeddingAllowed false when fsType bits 1-2 indicate restricted licence (value 2)
24     * @param int    $unitsPerEm      Font design units per em (from head table)
25     * @param array<int, int>  $fullUnicodeToGid  All Unicode codepoint => GID mappings from cmap
26     * @param array<int, int>  $glyphWidths       GID => advance width in font design units (unscaled)
27     * @param ?array<int, array<int, int>> $kernPairs leftGid => [rightGid => xAdvanceAdjust] (design units)
28     * @param ?array<int, list<array{components: int[], ligature: int}>> $ligatures firstGid => ligature rules
29     * @param bool $isVariableFont Whether this is an OpenType variable font (has fvar table)
30     * @param ?list<array{tag: string, minValue: float, defaultValue: float, maxValue: float, nameId: int}> $variationAxes Variation axis definitions from fvar
31     * @param ?list<array{subfamilyNameId: int, coordinates: array<string, float>}> $namedInstances Named instances from fvar
32     */
33    public function __construct(
34        public string $postScriptName,
35        public string $familyName,
36        public int $ascent,
37        public int $descent,
38        public int $capHeight,
39        public int $xHeight,
40        public float $italicAngle,
41        public int $stemV,
42        public int $flags,
43        public array $fontBBox,
44        public array $charWidths,
45        public array $unicodeMap,
46        public string $fontBytes,
47        public bool $embeddingAllowed,
48        public int $unitsPerEm = 1000,
49        public array $fullUnicodeToGid = [],
50        public array $glyphWidths = [],
51        public ?array $kernPairs = null,
52        public ?array $ligatures = null,
53        public bool $isVariableFont = false,
54        public ?array $variationAxes = null,
55        public ?array $namedInstances = null,
56    ) {}
57}