Skip to main content

predefined

Function predefined 

Source
pub fn predefined(name: &Name) -> Option<CMap>
Expand description

Look up one of the built-in CMap names.

Returns None for a name that matches no row and is not Identity-H or Identity-V. A caller resolving a font’s /Encoding almost always wants from_encoding_name instead, which builds the same fallback the oracle does rather than reporting the miss.

use pdfrum_cmap::{CidSet, CodingScheme, predefined};
use pdfrum_object::Name;

let gb = predefined(&Name::from("GB-EUC-H")).unwrap();
assert_eq!(gb.charset(), CidSet::Gb1);
assert_eq!(gb.coding_scheme(), CodingScheme::MixedTwoBytes);
assert!(gb.is_loaded());

assert!(predefined(&Name::from("Nonsense")).is_none());