TryGetSfntData(out ReadOnlyMemory, out Int32) Method

Definition

Namespace Broadside.Fonts
Assembly Broadside.dll

Gets the program's bytes as an sfnt file (a TrueType or OpenType program, or a TrueType collection and the index of this program's font in it), for a backend that hands the program to a platform font engine to draw its glyphs natively.

public virtual bool TryGetSfntData(scoped out ReadOnlyMemory<byte> data, scoped out int faceIndex)

Parameters

data
ReadOnlyMemory<Byte>

The whole sfnt file, as the font file stream holds it (decoded); empty when the method returns false.

faceIndex
Int32

The index of this program's font in a TrueType collection; 0 otherwise.

Returns

Boolean
true for a TrueType or OpenType program read without any repair; false for every other format, and for a program whose reading reported a deviation (a platform engine would read the damaged bytes differently from this program, so its glyphs must be drawn from GetOutline(Int32, GlyphOutline)).

Remarks

ISO 32000-2 §9.9 (Table 124: FontFile2 and FontFile3 OpenType) and open decision 7 of the spec: native glyph rendering covers TrueType and OpenType programs only. Glyph ids are this program's (GetOutline(Int32, GlyphOutline)'s), which an sfnt engine uses as they are. A parser of another format keeps the default, which returns false.