Skip to main content

Crate pdfboss_encoding

Crate pdfboss_encoding 

Source
Expand description

Shared PDF font-encoding tables (WinAnsi / MacRoman / Standard, from ISO 32000 Appendix D) and a bundled glyph-name-to-Unicode subset, consumed by the pdfboss text-extraction and rendering crates.

Functions§

glyph_to_unicode
Resolves a glyph name (as used in /Differences) to a Unicode scalar: uniXXXX and uXXXXuXXXXXX hex forms, single ASCII letters, and a bundled subset of the standard glyph list.
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 code in MacRomanEncoding.
standard
Unicode value of code in StandardEncoding.
standard_14_width
The advance width (1000-unit glyph space) of glyph_name in the standard-14 font whose PDF /BaseFont (or a recognized alias, or a subsetted variant) is base_font, or None if base_font isn’t one of the standard 14 (including Symbol/ZapfDingbats, which this module doesn’t tabulate) or glyph_name is 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 return Some(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). None for exactly the codes standard leaves unassigned (see the self-verifying standard_encoding_name_matches_standard_table test below, which ties this table to that one so an authoring mistake here fails a test rather than silently mis-encoding a glyph).
win_ansi
Unicode value of code in WinAnsiEncoding.