pub fn from_encoding_name(name: &Name, diags: &mut Diagnostics) -> CMapExpand description
Resolve a font’s /Encoding name to a CMap, failures included.
Never fails. A name that resolves to nothing produces a CMap that decodes
fixed two-byte codes and maps every code to itself, and records a
diagnostic — that is what the oracle does, and a file with
/Encoding /Nonsense renders because of it.
use pdfrum_cmap::{CharCode, Cid, CidSet, CodingScheme, from_encoding_name};
use pdfrum_common::Diagnostics;
use pdfrum_object::Name;
let mut diags = Diagnostics::default();
let cmap = from_encoding_name(&Name::from("Nonsense"), &mut diags);
assert!(!cmap.is_loaded());
assert_eq!(cmap.charset(), CidSet::Unknown);
assert_eq!(cmap.coding_scheme(), CodingScheme::TwoBytes);
assert_eq!(cmap.cid(CharCode(0x1234)), Cid(0x1234)); // identity fallback
assert_eq!(diags.len(), 1);