HPDFCMapReadCode

Read a single variable-width character from a text operand using its encoding codespaces

Declaration

function HPDFCMapReadCode(const R: THPDFCMapParseResult; const Bytes: AnsiString; StartIndex: Integer; out Code: Cardinal; out BytesConsumed: Integer): boolean;

Unit

HPDFCMapReader

Usage notes

StartIndex is one-based; a valid character takes the shortest matching width of one to four bytes

An invalid character consumes the shortest range width tied to its longest matching prefix, or the shortest codespace width when no first byte matches; consumption stops at the end of Bytes

True means a cursor could consume bytes, even for an undefined code; check Code and BytesConsumed with HPDFCMapCodeInSpace before glyph selection, and fall back to notdef substitution for an invalid code

See Native Cairo rendering for aggregate rendering budgets and cancellation