IFontProgramParser Interface

Definition

A font program parser: turns the decoded bytes of an embedded font program into a FontProgram. The font program parser extension point: every engine holds a list of parsers, the managed defaults after any registered with UseFontProgramParser(IFontProgramParser).

public interface IFontProgramParser

Remarks

ISO 32000-2 §9.9. An engine picks the parser for a program in this order: the first parser, newest registration first and the defaults last, whose CanParse(ReadOnlySpan<Byte>) accepts the bytes; else the first whose Formats include the format the font file stream declares (its descriptor key and Subtype, Table 124); else none, with a diagnostic, and the font has no program. A parser accepting bytes of another format than declared is recorded as a diagnostic and used.

The parser receives the bytes after the stream's filters and decryption: it never sees Filter, DecodeParms or encryption. It is called once per font program per document; the document caches the result.

Thread safety: one instance serves every document of every thread of the engines it is registered with, so it keeps no state between calls. Leniency: on malformed data a parser repairs what it can, reports each repair through Report(String, DiagnosticSeverity, String), and returns a program, or null when nothing is usable; it does not throw except for the DiagnosticException strict mode raises. Any other exception is caught by the engine and recorded as a diagnostic.

Tip: use kind:method, kind:property, kind:ctor. Press Esc to clear.

Properties (1)

Methods (2)