TrueTypeGlyphOutlines Class

The TrueType outlines of the glyf and loca tables of a font program that FontLoader cannot load because it lacks tables, such as the programs embedded in PDF documents (/FontFile2), which often have only the tables a PDF reader needs (ISO 32000-2, 9.9).

public sealed class TrueTypeGlyphOutlines

Remarks

The outlines are those of the default instance of a variable font. The object is immutable and can be used from several threads.

Constructors

NameDescription
TrueTypeGlyphOutlines(ReadOnlyMemory<byte>, ReadOnlyMemory<byte>, bool, int, ReadOnlyMemory<byte>, int)Creates the outlines of the tables of a font program.

TrueTypeGlyphOutlines(ReadOnlyMemory<byte>, ReadOnlyMemory<byte>, bool, int, ReadOnlyMemory<byte>, int)

TrueTypeGlyphOutlines.cs

Creates the outlines of the tables of a font program.

public TrueTypeGlyphOutlines(ReadOnlyMemory<byte> glyf, ReadOnlyMemory<byte> loca, bool hasLongLocations, int glyphCount, ReadOnlyMemory<byte> horizontalMetrics = default, int horizontalMetricCount = 0)

Parameters

glyf ReadOnlyMemory<byte>
The glyf table.
loca ReadOnlyMemory<byte>
The loca table.
hasLongLocations bool
Whether the offsets of the loca table are 32-bit numbers (the indexToLocFormat of the head table is 1).
glyphCount int
The number of glyphs (the numGlyphs of the maxp table, or what the loca table gives).
horizontalMetrics ReadOnlyMemory<byte>
The hmtx table, or empty: the horizontal metrics of the glyphs.
horizontalMetricCount int
The number of glyphs that have their own advance in horizontalMetrics (the numberOfHMetrics of the hhea table).

Exceptions

ArgumentOutOfRangeException
glyphCount or horizontalMetricCount is negative.

Properties

NameDescription
GlyphCountGets the number of glyphs.

Gets the number of glyphs.

public int GlyphCount { get; }

Property value

int

Methods

NameDescription
DecodeOutline(int, OutlineSink, GlyphScratch, GlyphBudget)Decodes the outline of a glyph, in font units. A glyph identifier that is not a glyph of the font draws nothing.

DecodeOutline(int, OutlineSink, GlyphScratch, GlyphBudget)

TrueTypeGlyphOutlines.cs

Decodes the outline of a glyph, in font units. A glyph identifier that is not a glyph of the font draws nothing.

public void DecodeOutline(int glyphId, OutlineSink sink, GlyphScratch scratch, ref GlyphBudget budget)

Parameters

glyphId int
The glyph.
sink OutlineSink
The receiver of the contours.
scratch GlyphScratch
The buffers of the decoding (the points of the glyph and of its components).
budget GlyphBudget
The limits of the work of the decoding (the points, the components).

Exceptions

InvalidFontException
The data of the glyph is malformed.
FontResourceLimitException
The glyph exceeds the complexity limit or the allocation limit.