Skip to main content

load

Function load 

Source
pub fn load(
    dict: &Dict,
    r: &impl Resolve,
    cache: &FontCache,
    limits: &Limits,
    diags: &mut Diagnostics,
) -> Option<Font>
Expand description

Build a Font from a /Font resource dictionary.

Never panics; damage goes to diags. Returns None only for the four unrecoverable Type0 cases — every other font kind always constructs, even with no program and no glyphs at all.

The dispatch has one quirk worth knowing about: a /TrueType font whose /BaseFont begins with one of five GBK-encoded Chinese family names, and which carries no /FontFile2, is built as a CID font instead. Real files depend on it.