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
ShapedRun
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\OpenTypeData;
8
9/**
10 * Output of {@see Shaper::shapeRun} — a sequence of positioned glyphs all
11 * sharing the same font, size, direction, and script.
12 *
13 * `totalAdvance` is the sum of `advanceX` across glyphs (or `advanceY` for
14 * vertical runs), cached so layout doesn't have to re-sum on every line-
15 * fitting iteration.
16 */
17final readonly class ShapedRun
18{
19    /** @param list<ShapedGlyph> $glyphs */
20    public function __construct(
21        public OpenTypeData $font,
22        public float $fontSizePt,
23        public ShapingDirection $direction,
24        public array $glyphs,
25        public float $totalAdvance,
26    ) {}
27}