Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ShapingContext | |
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\Text; |
| 6 | |
| 7 | use Phpdftk\FontParser\OpenTypeData; |
| 8 | |
| 9 | /** |
| 10 | * Per-run context for the shaper: the font, size, script, language, and |
| 11 | * direction. Higher-level callers split mixed input into runs (one font + |
| 12 | * one direction + one script each) before calling {@see Shaper::shapeRun}. |
| 13 | * |
| 14 | * `features` is the list of OpenType feature tags to enable — at MVP the |
| 15 | * shaper applies `kern` and `liga` if the font carries them. Other tags |
| 16 | * (small caps, lining figures, etc.) are recognised by the API but treated |
| 17 | * as no-ops until the broader GSUB / GPOS work in Phase 2. |
| 18 | */ |
| 19 | final readonly class ShapingContext |
| 20 | { |
| 21 | /** @param list<string> $features */ |
| 22 | public function __construct( |
| 23 | public OpenTypeData $font, |
| 24 | public float $fontSizePt, |
| 25 | public string $script = 'Latn', |
| 26 | public string $language = 'en', |
| 27 | public ShapingDirection $direction = ShapingDirection::Ltr, |
| 28 | public array $features = ['kern', 'liga'], |
| 29 | ) {} |
| 30 | } |