Expand description
Shared PDF font-encoding tables (WinAnsi / MacRoman / Standard, from ISO 32000 Appendix D), glyph-name-to-Unicode resolution over the Adobe Glyph List, and the built-in encoding of a Type 1 font program, consumed by the pdfboss text-extraction and rendering crates.
Functions§
- glyph_
to_ text - Resolves a glyph name to the text it represents, per the Adobe Glyph
List algorithm: everything from the first period on is dropped
(
eight.oldstyle→8), underscore-joined components each resolve and concatenate (f_i→fi,T_h→Th), and auniprefix may carry several 4-digit hex groups.Noneunless every component resolves — a partially-resolved ligature would silently drop letters, where the caller’s U+FFFD at least stays visible. - glyph_
to_ unicode - Resolves a glyph name (as used in
/Differences) to a Unicode scalar:uniXXXXanduXXXX–uXXXXXXhex forms, single ASCII letters, the Adobe Glyph List, and the TeX math names the list never adopted.Nonefor an unknown name, and for a listed name whose text is more than one scalar;glyph_to_textresolves those. - is_
standard_ 14 - Whether
base_font(after subset-prefix stripping and alias normalization) names one of the standard 14 fonts. - mac_
roman - Unicode value of
codeinMacRomanEncoding. - standard
- Unicode value of
codeinStandardEncoding. - standard_
14_ width - The advance width (1000-unit glyph space) of
glyph_namein the standard-14 font whose PDF/BaseFont(or a recognized alias, or a subsetted variant) isbase_font, orNoneifbase_fontisn’t one of the standard 14 (including Symbol/ZapfDingbats, which this module doesn’t tabulate) orglyph_nameis unknown to that font. Courier’s four variants are monospaced (every glyph is 600 units wide per the Adobe Core-14 AFM metrics) and so always returnSome(600.0). Oblique variants share their upright counterpart’s widths (Helvetica and Helvetica-Oblique are metrically identical, likewise the bold pair), so only upright/bold tables are stored. - standard_
encoding_ name - Adobe StandardEncoding glyph name for
code(ISO 32000-1 Annex D.2 “StandardEncoding” column; equivalently Adobe Type 1 Font Format Appendix C).Nonefor exactly the codesstandardleaves unassigned (see the self-verifyingstandard_encoding_name_matches_standard_tabletest below, which ties this table to that one so an authoring mistake here fails a test rather than silently mis-encoding a glyph). - type1_
builtin_ encoding - The built-in encoding of an embedded Type 1 font program: code to glyph
name, read from the program’s clear-text portion, which is where ISO
32000-1 9.6.6 sends a simple font that states no usable
/Encodingof its own. A bareStandardEncodingtoken expands to that table, and anydup <code> /<name> putentries override it code by code.Nonewhen the program states no/Encodingat all. - win_
ansi - Unicode value of
codeinWinAnsiEncoding. - win_
ansi_ glyph_ name - WinAnsiEncoding glyph name for
code(ISO 32000-1 Annex D.2 “WinAnsiEncoding” column).Nonefor exactly the codeswin_ansileaves unassigned. Two ASCII codes diverge from StandardEncoding’s names:0x27isquotesingleand0x60isgrave(the straight marks, matchingwin_ansi’s identity mapping there). Two codes render an existing glyph rather than owning one:0xA0carriesspace(the nonbreaking space draws as the space glyph) and0xADcarrieshyphen(likewise the soft hyphen) — see the self-verifyingwin_ansi_glyph_name_matches_win_ansi_tabletest below.