phpdftk API Documentation

TextEncoder
in

Converts a UTF-8 string into the byte sequence expected by a PDF font's encoding (e.g. WinAnsi).

Implementations are stateful: codepoints that have no representation in the target encoding accumulate in an internal list so callers can surface a single batched diagnostic instead of throwing on every showText.

Table of Contents

Methods

encode()  : string
Encode UTF-8 input to the target encoding. Unmappable codepoints are substituted with 0x3F ('?') and recorded for later inspection.
getMissingCodepoints()  : array<int, int>
Codepoints encountered since construction that could not be mapped.

Methods

encode()

Encode UTF-8 input to the target encoding. Unmappable codepoints are substituted with 0x3F ('?') and recorded for later inspection.

public encode(string $utf8) : string
Parameters
$utf8 : string
Return values
string

getMissingCodepoints()

Codepoints encountered since construction that could not be mapped.

public getMissingCodepoints() : array<int, int>

Returned in encounter order, with duplicates preserved so callers can see how often a missing glyph was requested.

Return values
array<int, int>

        
On this page

Search results