Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ShapingContext
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Text;
6
7use Phpdftk\FontParser\FontFaceData;
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 * The font is typed as the shared {@see FontFaceData} base so a
20 * caller can pass an `OpenTypeData` (CFF outlines) or a `TrueTypeData`
21 * (glyf outlines) — both expose the same metric and glyph-mapping
22 * fields the shaper needs.
23 */
24final readonly class ShapingContext
25{
26    /** @param list<string> $features */
27    public function __construct(
28        public FontFaceData $font,
29        public float $fontSizePt,
30        public string $script = 'Latn',
31        public string $language = 'en',
32        public ShapingDirection $direction = ShapingDirection::Ltr,
33        public array $features = ['kern', 'liga'],
34    ) {}
35}