Encodings

object Encodings

The four simple-font encodings PDF defines, as tables indexed by byte code.

pdfDocToUnicode maps a PDFDocEncoding byte to a Unicode codepoint (0 where the code is undefined). The other three map a byte to a PostScript glyph name (null where undefined), which is what a simple font's /Encoding selects glyphs by.

Where these values come from

ISO 32000-1, Annex D defines all four. They are reproducible from public, freely usable data, and the test suite checks the reproduction rules rather than trusting the numbers:

  • WinAnsiEncoding is Windows code page 1252, with three rules from Annex D: code 240 (0xA0) shows as space, 255 (0xAD) as hyphen, and every code above 040 (octal) that the page leaves unused shows as bullet.

  • MacRomanEncoding is Mac OS Roman for Latin text, so the codes whose Mac OS glyph falls outside that repertoire (the mathematical operators, Greek letters, the lozenge and the private-use logo) are undefined here. Code 312 (0xCA) shows as space, and 333 (0xDB) keeps currency, the assignment Mac OS used before 8.5 replaced it with the Euro.

  • StandardEncoding is Adobe's StandardEncoding for Type 1 fonts. It matches ASCII across 040 to 176 (octal) except that 047 is quoteright and 140 is quoteleft.

  • PDFDocEncoding is Latin-1, with the accent block at 030 to 037 (octal), the typographic set at 200 to 237, the Euro at 240 (0xA0) instead of a no-break space, and 177 (DEL) and 255 (soft hyphen) left undefined.

Glyph names follow the Adobe Glyph List (see GlyphList).

Properties

Link copied to clipboard

MacExpertEncoding: byte to glyph name, null where undefined.

Link copied to clipboard

MacRomanEncoding: byte to glyph name, null where undefined.

Link copied to clipboard

PDFDocEncoding byte to Unicode codepoint; 0 where the code is undefined.

Link copied to clipboard

Adobe StandardEncoding: byte to glyph name, null where undefined.

Link copied to clipboard

WinAnsiEncoding: byte to glyph name, null where undefined.