Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Type1Data | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\FontParser; |
| 6 | |
| 7 | /** |
| 8 | * Parsed data from a Type 1 font (PFB/PFA). |
| 9 | * |
| 10 | * Mirrors TrueTypeData but carries Type 1–specific segment lengths |
| 11 | * needed for the /FontFile stream dictionary (/Length1, /Length2, /Length3). |
| 12 | */ |
| 13 | readonly class Type1Data |
| 14 | { |
| 15 | /** |
| 16 | * @param string $postScriptName PostScript font name (from /FontName) |
| 17 | * @param string $familyName Family name (from /FullName or /FamilyName) |
| 18 | * @param int $ascent Typographic ascender scaled to 1000 units/em |
| 19 | * @param int $descent Typographic descender (negative) scaled to 1000 units/em |
| 20 | * @param int $capHeight Cap height scaled to 1000 units/em |
| 21 | * @param int $xHeight x-height scaled to 1000 units/em (0 if unavailable) |
| 22 | * @param float $italicAngle Italic angle in degrees |
| 23 | * @param int $stemV Vertical stem width estimate |
| 24 | * @param int $flags PDF font flags bitmask (ISO 32000-2 Table 123) |
| 25 | * @param array<int, int> $fontBBox [xMin, yMin, xMax, yMax] (1000 units/em) |
| 26 | * @param array<int, int> $charWidths byte (0-255) => advance width (1000 units/em) |
| 27 | * @param array<int, int> $unicodeMap byte (0-255) => Unicode codepoint |
| 28 | * @param string $fontBytes Raw font file bytes (PFB format for embedding) |
| 29 | * @param int $length1 ASCII header segment length |
| 30 | * @param int $length2 Encrypted (binary) segment length |
| 31 | * @param int $length3 Trailer (zeros) segment length |
| 32 | * @param array<string, int> $glyphWidths glyphName => advance width (1000 units/em) |
| 33 | * @param array<int, string> $encoding byte (0-255) => glyph name |
| 34 | */ |
| 35 | public function __construct( |
| 36 | public string $postScriptName, |
| 37 | public string $familyName, |
| 38 | public int $ascent, |
| 39 | public int $descent, |
| 40 | public int $capHeight, |
| 41 | public int $xHeight, |
| 42 | public float $italicAngle, |
| 43 | public int $stemV, |
| 44 | public int $flags, |
| 45 | public array $fontBBox, |
| 46 | public array $charWidths, |
| 47 | public array $unicodeMap, |
| 48 | public string $fontBytes, |
| 49 | public int $length1, |
| 50 | public int $length2, |
| 51 | public int $length3, |
| 52 | public array $glyphWidths = [], |
| 53 | public array $encoding = [], |
| 54 | ) {} |
| 55 | } |