Method TryGetFontProgram
TryGetFontProgram(FontFace, out ReadOnlyMemory<byte>)
Tries to get the font program backing a resolved face whose source is held in memory — a document-embedded payload or one of the bundled metric-compatible fonts — rather than stored as a file on disk.
public bool TryGetFontProgram(FontFace face, out ReadOnlyMemory<byte> fontProgram)
Parameters
faceFontFaceThe resolved face.
fontProgramReadOnlyMemory<byte>The font program on success: the whole container, so a face taken from a collection is still addressed by the face index carried in SourceName.
Returns
- bool
true when the face is backed by an in-memory source; false when its source is a path the caller should read itself.
Remarks
Consumers that embed or rasterize outlines (the PDF and imaging renderers) read a file-backed face straight from its source path; an in-memory source has no such path, so without this seam a bundled or embedded face cannot be drawn at all. Bytes are produced on demand rather than hung off FontFace, because the resolution cache holds one face per indexed font and binding payloads to faces would keep every scanned font resident. A face parsed from an embedded payload does remember which payload that was — a reference to a source this engine already holds, so nothing more is kept resident for it.
This is the in-memory half of the one rule every DocWright consumer of a resolved face follows — the face's own payload or a bundled font, else the file its source names — and it shares that rule's reading of the face index in a source name. A face that carries no payload of its own, one produced by Parse(ReadOnlyMemory<byte>, string, IConversionDiagnostics?), is looked up by source name among this engine's embedded payloads.
Exceptions
- ArgumentNullException
faceis null.