Function extended_glyph_name
pub fn extended_glyph_name(ch: char) -> Option<&'static str>Expand description
Returns the PostScript glyph name for ch if and only if ch
is in the extended tier: i.e. a Core 14 AFM glyph that has
no WinAnsi byte and therefore must be reached through a custom
/Encoding /Differences slot. The extended tier covers:
- most of Latin Extended-A (
Ł,ł,Ě,ě,Ő,ő, …, excluding those that already live inWinAnsilikeš/Š/ž/Ž); - the Latin Extended-B comma-below set
Ș/ș/Ț/ț; - the spacing diacritics
˘ˇ˙˝˛˚; - the math operators
−≤≥≠√∂∑∆◊; - the
fractionslash⁄and thefi/flligatures.
Returns None for two distinct cases that callers must
distinguish:
WinAnsinatives:š(U+0161),ž(U+017E),Š,Ž, the accented Latin-1 alphabet,€,“, … These do have PostScript glyph names in the AFM, but this function returnsNonefor them because they’re reachable throughwinansi_byteinstead and don’t need a/Differencesslot. Callers querying “what’s the AFM glyph name foré?” should useBase14Font::glyph_width_by_nameon the result of [winansi_glyph_name](winansi_byte(ch)?), or just measure widths throughBase14Font::winansi_width.- Unmappable codepoints with no glyph in any Core 14 font
(Cyrillic, CJK, emoji, most non-European scripts). The PDF
backend silently substitutes these to
?for Base14 runs; real coverage requires the bundled embedded family thatmos-fontsprovides.
The name extended_glyph_name is deliberately chosen over the
shorter glyph_name to avoid surprising readers who reach for
the function expecting “AFM name for any char.” For any-tier
AFM lookup the two-step (winansi_glyph_name ∘ winansi_byte)
then-fallback-to-extended_glyph_name composition is the way.
Used by the PDF backend’s /Differences-based encoding planner
to allocate slots for the extended tier.
§Examples
use pdf_base14_metrics::extended_glyph_name;
assert_eq!(extended_glyph_name('Ł'), Some("Lslash"));
assert_eq!(extended_glyph_name('A'), None);