Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| MathKernInfo | |
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 MathKernInfo sub-table from an OpenType MATH table. |
| 9 | * |
| 10 | * Spec: https://learn.microsoft.com/en-us/typography/opentype/spec/math#mathkerninfo-table |
| 11 | * |
| 12 | * Holds per-glyph corner kerning the painter uses to nudge |
| 13 | * sub/superscripts around italic-shaped bases. Each base glyph can |
| 14 | * supply up to four corner-specific kern tables: |
| 15 | * |
| 16 | * - topRight used when a superscript follows the base |
| 17 | * - topLeft used when a presuperscript precedes the base |
| 18 | * - bottomRight used when a subscript follows the base |
| 19 | * - bottomLeft used when a presubscript precedes the base |
| 20 | * |
| 21 | * Each corner table is a piecewise function: at increasing |
| 22 | * "correction heights" (Y offsets from baseline), the painter looks |
| 23 | * up the corresponding horizontal kern value to add. |
| 24 | * |
| 25 | * Keyed by base glyph ID. Glyphs absent from the map carry no |
| 26 | * corner kerning - the painter applies the default zero. |
| 27 | */ |
| 28 | final readonly class MathKernInfo |
| 29 | { |
| 30 | /** |
| 31 | * @param array<int, MathKernRecord> $records Base GID → corner kern table. |
| 32 | */ |
| 33 | public function __construct( |
| 34 | public array $records, |
| 35 | ) {} |
| 36 | } |