Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| MathGlyphConstruction | |
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 | * One stretchy delimiter recipe from a {@see MathVariants} table. |
| 9 | * |
| 10 | * Two pieces of data per base glyph: |
| 11 | * |
| 12 | * - `variants`: a list of pre-drawn alternate glyphs at fixed |
| 13 | * sizes. The painter scans this list smallest-first and uses |
| 14 | * the first whose `advance` (in design units) is >= the |
| 15 | * required size. |
| 16 | * |
| 17 | * - `assembly`: optional fall-back when no variant is large |
| 18 | * enough - a recipe for stacking glyph parts to any height. Null |
| 19 | * if the font doesn't supply one for this glyph (most |
| 20 | * production fonts do). |
| 21 | */ |
| 22 | final readonly class MathGlyphConstruction |
| 23 | { |
| 24 | /** |
| 25 | * @param list<array{glyphId: int, advance: int}> $variants |
| 26 | * Pre-drawn stretchy variants, sorted smallest first per |
| 27 | * spec. |
| 28 | * @param ?MathGlyphAssembly $assembly |
| 29 | * Multi-part glyph assembly for arbitrary sizes, or null |
| 30 | * when the font supplies no assembly. |
| 31 | */ |
| 32 | public function __construct( |
| 33 | public array $variants, |
| 34 | public ?MathGlyphAssembly $assembly, |
| 35 | ) {} |
| 36 | } |