Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Encoding; |
| 6 | |
| 7 | /** |
| 8 | * Converts a UTF-8 string into the byte sequence expected by a PDF font's |
| 9 | * encoding (e.g. WinAnsi). |
| 10 | * |
| 11 | * Implementations are stateful: codepoints that have no representation in |
| 12 | * the target encoding accumulate in an internal list so callers can surface |
| 13 | * a single batched diagnostic instead of throwing on every showText. |
| 14 | */ |
| 15 | interface TextEncoder |
| 16 | { |
| 17 | /** |
| 18 | * Encode UTF-8 input to the target encoding. Unmappable codepoints are |
| 19 | * substituted with 0x3F ('?') and recorded for later inspection. |
| 20 | */ |
| 21 | public function encode(string $utf8): string; |
| 22 | |
| 23 | /** |
| 24 | * Codepoints encountered since construction that could not be mapped. |
| 25 | * Returned in encounter order, with duplicates preserved so callers can |
| 26 | * see how often a missing glyph was requested. |
| 27 | * |
| 28 | * @return list<int> |
| 29 | */ |
| 30 | public function getMissingCodepoints(): array; |
| 31 | } |