Expand description
ToUnicode and encoding CMaps (PDF 32000-1 9.10.3).
A CMap maps character codes (the bytes in a Tj/TJ string) to
Unicode. Codes are big-endian, their length fixed per codespace range;
one code may map to a multi-character string and astral characters are
written as UTF-16 surrogate pairs inside the destination string.
bfchar gives explicit pairs. bfrange gives a source span plus either
one starting destination (incremented per source code, with carry
propagating from the last UTF-16 code unit backwards, so a surrogate
start yields consecutive astral characters) or an array of destinations
(element i answers for lo+i).
An Error names the failing construct; a code outside every codespace
or absent from the map decodes to U+FFFD, never an abort, so one bad
code cannot lose a page of text.
Structsยง
- CMap
- A parsed CMap: code -> Unicode string, plus its codespace widths and writing mode.