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
DocumentFont
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\SvgToPdf\Text;
6
7use Phpdftk\Pdf\Core\Font\RegisteredFont;
8
9/**
10 * A font an embedding document handed to the SVG text painter through
11 * {@see DocumentFontProvider}.
12 *
13 * Carries both halves the content stream needs:
14 *
15 *  - `$font` — the PDF-side handle, used for `Tf` (and, for simple
16 *    single-byte fonts, the UTF-8 → byte encoder behind `Tj`).
17 *  - `$unicodeToGid` — the post-subset Unicode → GID map. Non-empty
18 *    only for composite (Type 0 / CID) fonts, which have no
19 *    single-byte encoder and must be shown via
20 *    `ContentStream::showUnicodeText()`. Empty for the standard-14
21 *    Type 1 fonts the built-in {@see FontResolver} picks.
22 */
23final readonly class DocumentFont
24{
25    /**
26     * @param array<int, int> $unicodeToGid Unicode codepoint → post-subset GID.
27     */
28    public function __construct(
29        public RegisteredFont $font,
30        public array $unicodeToGid = [],
31    ) {}
32}