Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| MathGlyphAssembly | |
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 | * Recipe for building a stretchy delimiter from glyph parts. |
| 9 | * |
| 10 | * Parts stack head-to-tail in coverage order. Each part declares: |
| 11 | * - its `glyphId` (the part to draw), |
| 12 | * - the `startConnector` length (how many design units the start |
| 13 | * edge can overlap with the previous part's end edge), |
| 14 | * - the `endConnector` length (matching cap for the next part), |
| 15 | * - the `fullAdvance` of the part if drawn alone, |
| 16 | * - a bit flag in `extender` indicating whether the part is a |
| 17 | * repeatable extender (stretches as needed) or a fixed end-cap. |
| 18 | * |
| 19 | * The painter assembles by: |
| 20 | * 1. Picking the fixed (non-extender) caps in order. |
| 21 | * 2. Repeating the extender(s) between them as many times as |
| 22 | * needed to hit the target advance. |
| 23 | * 3. Overlapping adjacent parts by at least |
| 24 | * `MathVariants::minConnectorOverlap`. |
| 25 | */ |
| 26 | final readonly class MathGlyphAssembly |
| 27 | { |
| 28 | /** |
| 29 | * @param int $italicsCorrection FUnit italic correction applied |
| 30 | * to the full assembly when it sits next to slanted |
| 31 | * content. |
| 32 | * @param list<array{glyphId: int, startConnector: int, endConnector: int, fullAdvance: int, extender: bool}> $parts |
| 33 | */ |
| 34 | public function __construct( |
| 35 | public int $italicsCorrection, |
| 36 | public array $parts, |
| 37 | ) {} |
| 38 | } |