Handles are parsed on first use and then cached: a document that only ever
asks for roman regular never pays to parse the other eleven faces, and one
that asks a thousand times parses once. get() returns undefined — never a
near-enough face — when the requested bytes are absent, because the caller's
missing-font diagnostic is more useful to a reader than a page silently set
in the wrong typeface.
A
FontProviderover the supplied bytes.Handles are parsed on first use and then cached: a document that only ever asks for roman regular never pays to parse the other eleven faces, and one that asks a thousand times parses once.
get()returnsundefined— never a near-enough face — when the requested bytes are absent, because the caller'smissing-fontdiagnostic is more useful to a reader than a page silently set in the wrong typeface.