FontFace Class

One face of a font file: its table directory and what its fixed-size tables declare.

public sealed class FontFace

Remarks

A face is immutable and holds no cache: it can be used by several threads at the same time, each with its own GlyphScratch.

What every use of the font needs is validated when the face is created: the table directory, the required tables, the headers, the sizes of the metrics and location tables, the structure of the character map. The data of a glyph is validated when the glyph is decoded.

Properties

NameDescription
AverageCharWidthGets OS/2.xAvgCharWidth, in font units; 0 when the font has no OS/2 table.
AxesGets the axes of a variable font; empty for a font that does not vary.
CapHeightGets OS/2.sCapHeight: the height of the uppercase letters, in font units.
DataGets the bytes of the font file the face comes from.
FamilyNameGets the family name of the face, from the name table.
GdefDataGets the bytes of the GDEF table; empty when the face has none.
GlyphCountGets the number of glyphs of the face (maxp.numGlyphs).
GposDataGets the bytes of the GPOS table; empty when the face has none.
GsubGets the glyph substitution table, or null.
GsubDataGets the bytes of the GSUB table; empty when the face has none.
HasColorGlyphsGets a value indicating whether the font has glyphs that are drawn with their own colors.
HasColorLayersGets a value indicating whether the font has color glyphs made of layers (version 0 of the COLR table).
HasLegacyKerningGets a value indicating whether the font has pair adjustments in its legacy kerning table.
HasMathConstantsGets a value indicating whether the MATH table of the font has constants.
HasMathTableGets a value indicating whether the font has a MATH table.
HasOs2Gets a value indicating whether the face has an OS/2 table.
HasPostGets a value indicating whether the face has a post table.
HasVerticalMetricsGets a value indicating whether the font has vertical metrics of its own (vhea and vmtx).
HeadFlagsGets head.flags.
HorizontalAscenderGets hhea.ascender, in font units.
HorizontalDescenderGets hhea.descender, in font units, negative below the baseline.
HorizontalLineGapGets hhea.lineGap, in font units.
InstanceGets the instance of a variable font the face is, or null for the default instance.
IsItalicGets a value indicating whether the face is italic or oblique.
IsMonospacedGets a value indicating whether all the glyphs of the face have the same advance width.
ItalicAngleGets post.italicAngle, in degrees counterclockwise from the vertical; 0 for an upright font.
MacStyleGets head.macStyle: bit 0 is bold, bit 1 is italic.
MathMinConnectorOverlapGets how much two parts of the assembly of a glyph of mathematical layout overlap at least, in font units.
NamedInstancesGets the named instances of a variable font.
Os2VersionGets the version of the OS/2 table; 0 when the font has none.
OutlinesGets the kind of outlines of the face.
PaletteCountGets the number of palettes of colors of the font.
PaletteEntryCountGets the number of colors of each palette.
PostScriptNameGets the PostScript name of the face, or null when the font has none.
SelectionGets OS/2.fsSelection; 0 when the font has no OS/2 table.
StrikeoutPositionGets OS/2.yStrikeoutPosition: the top of the strikeout above the baseline, in font units.
StrikeoutSizeGets OS/2.yStrikeoutSize: the thickness of the strikeout, in font units.
SubfamilyNameGets the subfamily name of the face, such as Bold Italic, from the name table.
SubscriptYOffsetGets OS/2.ySubscriptYOffset: how far below the baseline subscripts are, in font units, positive downward.
SuperscriptYOffsetGets OS/2.ySuperscriptYOffset: how far above the baseline superscripts are, in font units.
TableTagsGets the tags of the tables of the face, in increasing order.
TypoAscenderGets OS/2.sTypoAscender, in font units.
TypoDescenderGets OS/2.sTypoDescender, in font units, negative below the baseline.
TypoLineGapGets OS/2.sTypoLineGap, in font units.
UnderlinePositionGets post.underlinePosition: the top of the underline, in font units, negative below the baseline.
UnderlineThicknessGets post.underlineThickness: the thickness of the underline, in font units.
UnitsPerEmGets the number of font units in the em square (head.unitsPerEm).
UseTypoMetricsGets a value indicating whether the font asks that the typographic metrics of the OS/2 table are used for the line spacing (USE_TYPO_METRICS).
VariesAdvancesWithOutlinesGets a value indicating whether the advances of the glyphs come from their outlines: an instance of a variable font with TrueType outlines and without HVAR table, whose advance is the one of the phantom points of a glyph.
VerticalAscenderGets vhea.vertTypoAscender, in font units; 0 when the font has no vertical metrics.
VerticalDescenderGets vhea.vertTypoDescender, in font units; 0 when the font has no vertical metrics.
VerticalLineGapGets vhea.vertTypoLineGap, in font units; 0 when the font has no vertical metrics.
WeightGets the weight of the face, from 1 to 1000 (400 is regular, 700 is bold).
WidthClassGets OS/2.usWidthClass, from 1 (ultra-condensed) to 9 (ultra-expanded); 5 when the font has no OS/2 table.
WinAscentGets OS/2.usWinAscent, in font units.
WinDescentGets OS/2.usWinDescent, in font units, positive below the baseline.
XHeightGets OS/2.sxHeight: the height of the lowercase letters, in font units.
XMaxGets the right of the box of all the glyphs of the font (head.xMax), in font units.
XMinGets the left of the box of all the glyphs of the font (head.xMin), in font units.
YMaxGets the top of the box of all the glyphs of the font (head.yMax), in font units.
YMinGets the bottom of the box of all the glyphs of the font (head.yMin), in font units.

AverageCharWidth

FontFace.cs

Gets OS/2.xAvgCharWidth, in font units; 0 when the font has no OS/2 table.

public int AverageCharWidth { get; }

Property value

int

Gets the axes of a variable font; empty for a font that does not vary.

public ReadOnlySpan<FontAxisRecord> Axes { get; }

CapHeight

FontFace.cs

Gets OS/2.sCapHeight: the height of the uppercase letters, in font units.

public int CapHeight { get; }

Property value

int

Gets the bytes of the font file the face comes from.

public FontData Data { get; }

Property value

FontData

FamilyName

FontFace.cs

Gets the family name of the face, from the name table.

public string FamilyName { get; }

Property value

string

GdefData

FontFace.cs

Gets the bytes of the GDEF table; empty when the face has none.

public ReadOnlyMemory<byte> GdefData { get; }

Property value

ReadOnlyMemory<byte>

GlyphCount

FontFace.cs

Gets the number of glyphs of the face (maxp.numGlyphs).

public int GlyphCount { get; }

Property value

int

GposData

FontFace.cs

Gets the bytes of the GPOS table; empty when the face has none.

public ReadOnlyMemory<byte> GposData { get; }

Property value

ReadOnlyMemory<byte>

Gets the glyph substitution table, or null.

public LayoutTable? Gsub { get; }

Property value

LayoutTable?

GsubData

FontFace.cs

Gets the bytes of the GSUB table; empty when the face has none.

public ReadOnlyMemory<byte> GsubData { get; }

Property value

ReadOnlyMemory<byte>

HasColorGlyphs

FontFace.cs

Gets a value indicating whether the font has glyphs that are drawn with their own colors.

public bool HasColorGlyphs { get; }

Property value

bool

HasColorLayers

FontFace.cs

Gets a value indicating whether the font has color glyphs made of layers (version 0 of the COLR table).

public bool HasColorLayers { get; }

Property value

bool

HasLegacyKerning

FontFace.cs

Gets a value indicating whether the font has pair adjustments in its legacy kerning table.

public bool HasLegacyKerning { get; }

Property value

bool

HasMathConstants

FontFace.cs

Gets a value indicating whether the MATH table of the font has constants.

public bool HasMathConstants { get; }

Property value

bool

HasMathTable

FontFace.cs

Gets a value indicating whether the font has a MATH table.

public bool HasMathTable { get; }

Property value

bool

Gets a value indicating whether the face has an OS/2 table.

public bool HasOs2 { get; }

Property value

bool

Gets a value indicating whether the face has a post table.

public bool HasPost { get; }

Property value

bool

HasVerticalMetrics

FontFace.cs

Gets a value indicating whether the font has vertical metrics of its own (vhea and vmtx).

public bool HasVerticalMetrics { get; }

Property value

bool

HeadFlags

FontFace.cs

Gets head.flags.

public int HeadFlags { get; }

Property value

int

HorizontalAscender

FontFace.cs

Gets hhea.ascender, in font units.

public int HorizontalAscender { get; }

Property value

int

HorizontalDescender

FontFace.cs

Gets hhea.descender, in font units, negative below the baseline.

public int HorizontalDescender { get; }

Property value

int

HorizontalLineGap

FontFace.cs

Gets hhea.lineGap, in font units.

public int HorizontalLineGap { get; }

Property value

int

Instance

FontFace.cs

Gets the instance of a variable font the face is, or null for the default instance.

public FontInstance? Instance { get; }

Property value

FontInstance?

IsItalic

FontFace.cs

Gets a value indicating whether the face is italic or oblique.

public bool IsItalic { get; }

Property value

bool

IsMonospaced

FontFace.cs

Gets a value indicating whether all the glyphs of the face have the same advance width.

public bool IsMonospaced { get; }

Property value

bool

ItalicAngle

FontFace.cs

Gets post.italicAngle, in degrees counterclockwise from the vertical; 0 for an upright font.

public double ItalicAngle { get; }

Property value

double

MacStyle

FontFace.cs

Gets head.macStyle: bit 0 is bold, bit 1 is italic.

public int MacStyle { get; }

Property value

int

MathMinConnectorOverlap

FontFace.cs

Gets how much two parts of the assembly of a glyph of mathematical layout overlap at least, in font units.

public int MathMinConnectorOverlap { get; }

Property value

int

Exceptions

InvalidFontException
The subtable is malformed.

NamedInstances

FontFace.cs

Gets the named instances of a variable font.

public ReadOnlySpan<FontInstanceRecord> NamedInstances { get; }

Os2Version

FontFace.cs

Gets the version of the OS/2 table; 0 when the font has none.

public int Os2Version { get; }

Property value

int

Outlines

FontFace.cs

Gets the kind of outlines of the face.

public FontOutlineKind Outlines { get; }

Property value

FontOutlineKind

PaletteCount

FontFace.cs

Gets the number of palettes of colors of the font.

public int PaletteCount { get; }

Property value

int

PaletteEntryCount

FontFace.cs

Gets the number of colors of each palette.

public int PaletteEntryCount { get; }

Property value

int

PostScriptName

FontFace.cs

Gets the PostScript name of the face, or null when the font has none.

public string? PostScriptName { get; }

Property value

string?

Selection

FontFace.cs

Gets OS/2.fsSelection; 0 when the font has no OS/2 table.

public int Selection { get; }

Property value

int

StrikeoutPosition

FontFace.cs

Gets OS/2.yStrikeoutPosition: the top of the strikeout above the baseline, in font units.

public int StrikeoutPosition { get; }

Property value

int

StrikeoutSize

FontFace.cs

Gets OS/2.yStrikeoutSize: the thickness of the strikeout, in font units.

public int StrikeoutSize { get; }

Property value

int

SubfamilyName

FontFace.cs

Gets the subfamily name of the face, such as Bold Italic, from the name table.

public string SubfamilyName { get; }

Property value

string

SubscriptYOffset

FontFace.cs

Gets OS/2.ySubscriptYOffset: how far below the baseline subscripts are, in font units, positive downward.

public int SubscriptYOffset { get; }

Property value

int

SuperscriptYOffset

FontFace.cs

Gets OS/2.ySuperscriptYOffset: how far above the baseline superscripts are, in font units.

public int SuperscriptYOffset { get; }

Property value

int

TableTags

FontFace.cs

Gets the tags of the tables of the face, in increasing order.

public ReadOnlySpan<uint> TableTags { get; }

Property value

ReadOnlySpan<uint>

TypoAscender

FontFace.cs

Gets OS/2.sTypoAscender, in font units.

public int TypoAscender { get; }

Property value

int

TypoDescender

FontFace.cs

Gets OS/2.sTypoDescender, in font units, negative below the baseline.

public int TypoDescender { get; }

Property value

int

TypoLineGap

FontFace.cs

Gets OS/2.sTypoLineGap, in font units.

public int TypoLineGap { get; }

Property value

int

UnderlinePosition

FontFace.cs

Gets post.underlinePosition: the top of the underline, in font units, negative below the baseline.

public int UnderlinePosition { get; }

Property value

int

UnderlineThickness

FontFace.cs

Gets post.underlineThickness: the thickness of the underline, in font units.

public int UnderlineThickness { get; }

Property value

int

UnitsPerEm

FontFace.cs

Gets the number of font units in the em square (head.unitsPerEm).

public int UnitsPerEm { get; }

Property value

int

UseTypoMetrics

FontFace.cs

Gets a value indicating whether the font asks that the typographic metrics of the OS/2 table are used for the line spacing (USE_TYPO_METRICS).

public bool UseTypoMetrics { get; }

Property value

bool

VariesAdvancesWithOutlines

FontFace.cs

Gets a value indicating whether the advances of the glyphs come from their outlines: an instance of a variable font with TrueType outlines and without HVAR table, whose advance is the one of the phantom points of a glyph.

public bool VariesAdvancesWithOutlines { get; }

Property value

bool

VerticalAscender

FontFace.cs

Gets vhea.vertTypoAscender, in font units; 0 when the font has no vertical metrics.

public int VerticalAscender { get; }

Property value

int

VerticalDescender

FontFace.cs

Gets vhea.vertTypoDescender, in font units; 0 when the font has no vertical metrics.

public int VerticalDescender { get; }

Property value

int

VerticalLineGap

FontFace.cs

Gets vhea.vertTypoLineGap, in font units; 0 when the font has no vertical metrics.

public int VerticalLineGap { get; }

Property value

int

Gets the weight of the face, from 1 to 1000 (400 is regular, 700 is bold).

public int Weight { get; }

Property value

int

WidthClass

FontFace.cs

Gets OS/2.usWidthClass, from 1 (ultra-condensed) to 9 (ultra-expanded); 5 when the font has no OS/2 table.

public int WidthClass { get; }

Property value

int

WinAscent

FontFace.cs

Gets OS/2.usWinAscent, in font units.

public int WinAscent { get; }

Property value

int

WinDescent

FontFace.cs

Gets OS/2.usWinDescent, in font units, positive below the baseline.

public int WinDescent { get; }

Property value

int

Gets OS/2.sxHeight: the height of the lowercase letters, in font units.

public int XHeight { get; }

Property value

int

Gets the right of the box of all the glyphs of the font (head.xMax), in font units.

public int XMax { get; }

Property value

int

Gets the left of the box of all the glyphs of the font (head.xMin), in font units.

public int XMin { get; }

Property value

int

Gets the top of the box of all the glyphs of the font (head.yMax), in font units.

public int YMax { get; }

Property value

int

Gets the bottom of the box of all the glyphs of the font (head.yMin), in font units.

public int YMin { get; }

Property value

int

Methods

NameDescription
BuildColorGlyph(int, int, GlyphScratch, GlyphBudget)Builds the display list of a color glyph, which validates what the glyph refers to.
DecodeOutline(int, OutlineSink, GlyphScratch, GlyphBudget)Decodes the outline of a glyph into a sink. A glyph without outline, such as a space, emits nothing.
DecodeOutline(int, double, OutlineSink, GlyphScratch, GlyphBudget)Decodes the outline of a glyph as it is drawn at a size: the outline of the glyph, or, when the font was loaded to use its bitmaps without colors and has one for the glyph at exactly this size, the squares of its pixels.
GetAdvanceHeight(int)Gets the advance height of a glyph, in font units: how far the pen moves down after it in a vertical line.
GetAdvanceWidth(int)Gets the advance width of a glyph, in font units.
GetColorLayers(int)Gets the layers of a color glyph of version 0 of the COLR table, from the bottom one: the glyph whose outline each layer fills and the index of its color in the palette.
GetLayoutDelta(int, int)Gets the delta of a value of the layout tables for the instance, from the item variation store of the GDEF table, rounded to a font unit; 0 for the default instance.
GetLeftSideBearing(int)Gets the left side bearing of a glyph in the hmtx table, in font units: the one of the default instance of a variable font.
GetLegacyKerning(int, int)Gets the adjustment the legacy kerning table gives to the advance of a glyph when another glyph follows it, in font units; 0 when the font has no such table or no adjustment for the pair.
GetLigatureCarets(int, Span<int>)Gets the positions of the carets inside a ligature glyph, in font units along its advance, from the GDEF table.
GetMathConstant(MathConstant)Gets a constant of mathematical layout, with the delta of the instance of a variable font; 0 when the font has none.
GetMathGlyphConstruction(int, bool)Gets how a glyph of mathematical layout grows along a direction: its larger forms and its assembly.
GetName(int)Gets a name of the font by its identifier in the name table.
GetNames(int)Gets the values a name of the font has in every language of the name table, each one once.
GetPaletteType(int, bool, bool)Tells the backgrounds a palette is made for.
GetTopSideBearing(int)Gets the top side bearing of a glyph in the vmtx table, in font units: the one of the default instance of a variable font; 0 when the font has no vertical metrics.
GetVerticalOrigin(int, GlyphScratch?, int, int)Gets the vertical origin of a glyph, in font units from its horizontal origin: the point of the glyph that is on the pen in a vertical line, at the top of its advance height and in the middle of its width.
IsColorGlyph(int)Tells whether a glyph is drawn with its own colors.
IsLayeredColorGlyph(int)Tells whether a glyph is a color glyph made of layers (version 0 of the COLR table).
IsMathExtendedShape(int)Tells whether a glyph of mathematical layout is an extended shape, such as a large operator.
MapCodePoint(int)Gets the glyph of a character, or 0 when the font has none.
MapVariation(int, int, int)Gets the glyph of a variation sequence.
TryGetBaseline(bool, ReadOnlySpan<uint>, uint, int)Gets a baseline of a script, in font units: along the y axis of the glyphs for horizontal lines, along their x axis for vertical lines.
TryGetBitmapGlyph(int, double, BitmapGlyph)Finds the image of a glyph the font gives as a bitmap, in the strike that suits a size.
TryGetGlyphBounds(int, GlyphScratch, GlyphBox)Gets the box of the outline of a glyph, in font units: the box the glyf table declares for the glyph in a font with TrueType outlines that does not vary them, otherwise the box of the points of its outline, rounded outward.
TryGetIdeographicCenter(bool, ReadOnlySpan<uint>, double)Gets the middle of the ideographic em box of a script, in font units: halfway between the bottom and the top of the box (the ideo and idtp baselines), one em apart when the table only gives one of them.
TryGetMathItalicsCorrection(int, int)Gets the italics correction of a glyph of mathematical layout, in font units.
TryGetMathTopAccentAttachment(int, int)Gets where an accent above a glyph of mathematical layout is centered, in font units from its origin.
TryGetPaletteColor(int, int, int, int, int, int)Gets a color of a palette: its red, green, blue and alpha components, from 0 to 255.
TryGetTable(uint, ReadOnlyMemory<byte>)Gets a table of the face.
WithCoordinates(ReadOnlySpan<int>)Gets the face of an instance of a variable font.

BuildColorGlyph(int, int, GlyphScratch, GlyphBudget)

FontFace.cs

Builds the display list of a color glyph, which validates what the glyph refers to.

public ColorGlyph? BuildColorGlyph(int glyphId, int palette, GlyphScratch scratch, ref GlyphBudget budget)

Parameters

glyphId int
The glyph.
palette int
The palette its colors come from; a palette the font does not have is its first one.
scratch GlyphScratch
The working storage of the outlines.
budget GlyphBudget
The complexity budget of the glyph.

Returns

ColorGlyph? The display list, or null when the glyph has no colors of its own.

Exceptions

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

DecodeOutline overloads

DecodeOutline(int, OutlineSink, GlyphScratch, GlyphBudget)

FontFace.cs

Decodes the outline of a glyph into a sink. A glyph without outline, such as a space, emits nothing.

public void DecodeOutline(int glyphId, OutlineSink sink, GlyphScratch scratch, ref GlyphBudget budget)
Parameters
glyphId int
sink OutlineSink
scratch GlyphScratch
budget GlyphBudget
Exceptions
InvalidFontException
The data of the glyph is malformed.
UnsupportedFontFeatureException
The outlines of the font are in a format that is not supported.
FontResourceLimitException
The glyph exceeds the complexity limit or the allocation limit.

DecodeOutline(int, double, OutlineSink, GlyphScratch, GlyphBudget)

FontFace.cs

Decodes the outline of a glyph as it is drawn at a size: the outline of the glyph, or, when the font was loaded to use its bitmaps without colors and has one for the glyph at exactly this size, the squares of its pixels.

public void DecodeOutline(int glyphId, double size, OutlineSink sink, GlyphScratch scratch, ref GlyphBudget budget)
Parameters
glyphId int
The glyph.
size double
The size the glyph is drawn at, in pixels per em.
sink OutlineSink
The sink.
scratch GlyphScratch
The working storage of the outlines.
budget GlyphBudget
The budget of the glyph.
Exceptions
InvalidFontException
The data of the glyph is malformed.
UnsupportedFontFeatureException
The outlines of the font are in a format that is not supported.
FontResourceLimitException
The glyph exceeds the complexity limit or the allocation limit.

GetAdvanceHeight(int)

FontFace.cs

Gets the advance height of a glyph, in font units: how far the pen moves down after it in a vertical line.

public int GetAdvanceHeight(int glyphId)

Parameters

glyphId int

Returns

int

Remarks

The advance is the one of the vmtx table, varied by the delta of the VVAR table in an instance of a variable font. A font without vertical metrics gives every glyph the height of a line of its horizontal text, from its ascender to its descender.

GetAdvanceWidth(int)

FontFace.cs

Gets the advance width of a glyph, in font units.

public int GetAdvanceWidth(int glyphId)

Parameters

glyphId int

Returns

int

Remarks

In an instance of a variable font, the advance of the default instance varies by the delta of the HVAR table, rounded to a font unit; a font with TrueType outlines and without this table varies its advances with the phantom points of its glyphs.

GetColorLayers(int)

FontFace.cs

Gets the layers of a color glyph of version 0 of the COLR table, from the bottom one: the glyph whose outline each layer fills and the index of its color in the palette.

public ColorLayer[]? GetColorLayers(int glyphId)

Parameters

glyphId int

Returns

ColorLayer[]? null when the glyph has no layers; a glyph of version 1 has paints, see FontFace.BuildColorGlyph.

Exceptions

InvalidFontException
The layers of the glyph are malformed.

GetLayoutDelta(int, int)

FontFace.cs

Gets the delta of a value of the layout tables for the instance, from the item variation store of the GDEF table, rounded to a font unit; 0 for the default instance.

public int GetLayoutDelta(int outer, int inner)

Parameters

outer int
inner int

Returns

int

GetLeftSideBearing(int)

FontFace.cs

Gets the left side bearing of a glyph in the hmtx table, in font units: the one of the default instance of a variable font.

public int GetLeftSideBearing(int glyphId)

Parameters

glyphId int

Returns

int

GetLegacyKerning(int, int)

FontFace.cs

Gets the adjustment the legacy kerning table gives to the advance of a glyph when another glyph follows it, in font units; 0 when the font has no such table or no adjustment for the pair.

public int GetLegacyKerning(int left, int right)

Parameters

left int
right int

Returns

int

GetLigatureCarets(int, Span<int>)

FontFace.cs

Gets the positions of the carets inside a ligature glyph, in font units along its advance, from the GDEF table.

public int GetLigatureCarets(int glyphId, Span<int> carets)

Parameters

glyphId int
The ligature glyph.
carets Span<int>
Receives the positions, in the order of the components of the ligature.

Returns

int The number of carets the font gives for the glyph; 0 when it gives none.

Exceptions

InvalidFontException
The list of the carets is malformed.

GetMathConstant(MathConstant)

FontFace.cs

Gets a constant of mathematical layout, with the delta of the instance of a variable font; 0 when the font has none.

public int GetMathConstant(MathConstant constant)

Parameters

constant MathConstant

Returns

int

Exceptions

InvalidFontException
The value is malformed.

GetMathGlyphConstruction(int, bool)

FontFace.cs

Gets how a glyph of mathematical layout grows along a direction: its larger forms and its assembly.

public MathGlyphConstruction? GetMathGlyphConstruction(int glyphId, bool isVertical)

Parameters

glyphId int
The glyph.
isVertical bool
true for the forms that are taller, false for the wider ones.

Returns

MathGlyphConstruction? null when the glyph does not grow in the direction.

Exceptions

InvalidFontException
The subtables of the glyph are malformed.

GetName(int)

FontFace.cs

Gets a name of the font by its identifier in the name table.

public string? GetName(int nameId)

Parameters

nameId int

Returns

string?

GetNames(int)

FontFace.cs

Gets the values a name of the font has in every language of the name table, each one once.

public IReadOnlyList<string> GetNames(int nameId)

Parameters

nameId int

Returns

IReadOnlyList<string>

Exceptions

InvalidFontException
The table is malformed.

GetPaletteType(int, bool, bool)

FontFace.cs

Tells the backgrounds a palette is made for.

public void GetPaletteType(int palette, out bool isForLightBackground, out bool isForDarkBackground)

Parameters

palette int
isForLightBackground bool
isForDarkBackground bool

GetTopSideBearing(int)

FontFace.cs

Gets the top side bearing of a glyph in the vmtx table, in font units: the one of the default instance of a variable font; 0 when the font has no vertical metrics.

public int GetTopSideBearing(int glyphId)

Parameters

glyphId int

Returns

int

GetVerticalOrigin(int, GlyphScratch?, int, int)

FontFace.cs

Gets the vertical origin of a glyph, in font units from its horizontal origin: the point of the glyph that is on the pen in a vertical line, at the top of its advance height and in the middle of its width.

public void GetVerticalOrigin(int glyphId, GlyphScratch? scratch, out int x, out int y)

Parameters

glyphId int
scratch GlyphScratch?
x int
y int

Remarks

Horizontally, the origin is the middle of the advance width. Vertically, it is the one the VORG table gives (with the delta of the VVAR table in an instance); without that table, the top of the outline plus the top side bearing of the vmtx table; without vertical metrics, the top of the outline plus half of what the advance height has more than the outline is tall, which centers the glyph in its advance. A glyph without outline, such as a space, has an outline without height at the baseline.

These are the rules of the reference shaper, which the positions of a vertical text are compared with.

IsColorGlyph(int)

FontFace.cs

Tells whether a glyph is drawn with its own colors.

public bool IsColorGlyph(int glyphId)

Parameters

glyphId int

Returns

bool

IsLayeredColorGlyph(int)

FontFace.cs

Tells whether a glyph is a color glyph made of layers (version 0 of the COLR table).

public bool IsLayeredColorGlyph(int glyphId)

Parameters

glyphId int

Returns

bool

IsMathExtendedShape(int)

FontFace.cs

Tells whether a glyph of mathematical layout is an extended shape, such as a large operator.

public bool IsMathExtendedShape(int glyphId)

Parameters

glyphId int

Returns

bool

Exceptions

InvalidFontException
The subtable is malformed.

MapCodePoint(int)

FontFace.cs

Gets the glyph of a character, or 0 when the font has none.

public int MapCodePoint(int codePoint)

Parameters

codePoint int

Returns

int

MapVariation(int, int, int)

FontFace.cs

Gets the glyph of a variation sequence.

public CmapVariation MapVariation(int codePoint, int selector, out int glyphId)

Parameters

codePoint int
selector int
glyphId int

Returns

CmapVariation

TryGetBaseline(bool, ReadOnlySpan<uint>, uint, int)

FontFace.cs

Gets a baseline of a script, in font units: along the y axis of the glyphs for horizontal lines, along their x axis for vertical lines.

public bool TryGetBaseline(bool isVertical, ReadOnlySpan<uint> scripts, uint baseline, out int coordinate)

Parameters

isVertical bool
true for the baselines of vertical lines.
scripts ReadOnlySpan<uint>
The script tags of the text, by order of preference.
baseline uint
The tag of the baseline.
coordinate int
The coordinate of the baseline, with the delta of the BASE table in an instance of a variable font.

Returns

bool false when the font has no BASE table, or the table does not give the baseline.

Exceptions

InvalidFontException
The table is malformed.

TryGetBitmapGlyph(int, double, BitmapGlyph)

FontFace.cs

Finds the image of a glyph the font gives as a bitmap, in the strike that suits a size.

public bool TryGetBitmapGlyph(int glyphId, double size, out BitmapGlyph glyph)

Parameters

glyphId int
size double
glyph BitmapGlyph

Returns

bool false when the font has no image for the glyph.

TryGetGlyphBounds(int, GlyphScratch, GlyphBox)

FontFace.cs

Gets the box of the outline of a glyph, in font units: the box the glyf table declares for the glyph in a font with TrueType outlines that does not vary them, otherwise the box of the points of its outline, rounded outward.

public bool TryGetGlyphBounds(int glyphId, GlyphScratch scratch, out GlyphBox bounds)

Parameters

glyphId int
The glyph.
scratch GlyphScratch
The working storage of the outline, when it has to be decoded.
bounds GlyphBox
The box.

Returns

bool false for a glyph without outline, such as a space.

Exceptions

InvalidFontException
The data of the glyph is malformed.
UnsupportedFontFeatureException
The outlines of the font are in a format that is not supported.
FontResourceLimitException
The glyph exceeds the complexity limit or the allocation limit.

TryGetIdeographicCenter(bool, ReadOnlySpan<uint>, double)

FontFace.cs

Gets the middle of the ideographic em box of a script, in font units: halfway between the bottom and the top of the box (the ideo and idtp baselines), one em apart when the table only gives one of them.

public bool TryGetIdeographicCenter(bool isVertical, ReadOnlySpan<uint> scripts, out double center)

Parameters

isVertical bool
true for the middle of the box of vertical lines, along the x axis of the glyphs.
scripts ReadOnlySpan<uint>
The script tags of the text, by order of preference.
center double
The middle of the box.

Returns

bool false when the font does not give the ideographic em box of the script.

Exceptions

InvalidFontException
The BASE table is malformed.

TryGetMathItalicsCorrection(int, int)

FontFace.cs

Gets the italics correction of a glyph of mathematical layout, in font units.

public bool TryGetMathItalicsCorrection(int glyphId, out int value)

Parameters

glyphId int
value int

Returns

bool false when the font gives none for the glyph.

Exceptions

InvalidFontException
The subtable is malformed.

TryGetMathTopAccentAttachment(int, int)

FontFace.cs

Gets where an accent above a glyph of mathematical layout is centered, in font units from its origin.

public bool TryGetMathTopAccentAttachment(int glyphId, out int value)

Parameters

glyphId int
value int

Returns

bool false when the font gives none for the glyph.

Exceptions

InvalidFontException
The subtable is malformed.

TryGetPaletteColor(int, int, int, int, int, int)

FontFace.cs

Gets a color of a palette: its red, green, blue and alpha components, from 0 to 255.

public bool TryGetPaletteColor(int palette, int entry, out int red, out int green, out int blue, out int alpha)

Parameters

palette int
entry int
red int
green int
blue int
alpha int

Returns

bool false when the font does not have the palette or the entry.

TryGetTable(uint, ReadOnlyMemory<byte>)

FontFace.cs

Gets a table of the face.

public bool TryGetTable(uint tag, out ReadOnlyMemory<byte> table)

Parameters

tag uint
table ReadOnlyMemory<byte>

Returns

bool false when the face does not have the table.

WithCoordinates(ReadOnlySpan<int>)

FontFace.cs

Gets the face of an instance of a variable font.

public FontFace WithCoordinates(ReadOnlySpan<int> userCoordinates)

Parameters

userCoordinates ReadOnlySpan<int>
The value of each axis, in the order of the axes, as 16.16 fixed-point numbers; an axis without value is at its default. A value outside the range of its axis is brought to the nearest end.

Returns

FontFace The face of the instance; the face of the default instance when every axis is at its default.