MathFont class final
A math font: an OpenType font with a MATH table, measured in em.
This is what layout reads. Every length it returns is in em (font units ÷ units per em), so callers multiply by the font size.
A variable font is used at its default instance unless axis values
are given (variations, instance): then outlines, advances and
text shaping follow them, and so do the MATH table's constants,
italics corrections, top accent attachments and math kerning where
the font gives them variation deltas.
Constructors
- MathFont(OpenTypeFont font)
-
Wraps a parsed
font. Throws if it has noMATHtable. -
MathFont.fromBytes(Uint8List bytes, {Map<
String, double> variations = const {}}) -
Parses a font file; a variable font at axis
variations(tag → value, as in{'wght': 700}; see instance).factory -
MathFont.symbols(Uint8List bytes, {int index = 0, Map<
String, double> variations = const {}}) -
A font used only for its glyphs, as a symbol fallback after the math
font (layoutFormula's
fallbackFonts); it needs noMATHtable (Noto Sans Symbols, a system symbol font…).factory
Properties
-
axes
→ List<
FontAxis> -
The variation axes (
fvar); empty when the font does not vary.no setter -
constants
→ Map<
String, double> -
All constants as returned by constant.
no setter
- font → OpenTypeFont
-
The underlying font.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- minConnectorOverlap → double
-
Minimum connector overlap for assemblies, in em.
latefinal
- name → String
-
Family name.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unitsPerEm → double
-
Units per em.
no setter
-
variations
→ Map<
String, double> -
The axis values this font is at, tag → value, for every axis.
no setter
- xHeight → double
-
x-height in em.
latefinal
Methods
-
constant(
String name) → double -
A
MATHconstant in em. Percent constants (scriptPercentScaleDown,scriptScriptPercentScaleDown,radicalDegreeBottomRaisePercent) are returned as fractions (0.7). -
em(
num fontUnits) → double - Converts font units to em.
-
glyph(
int codePoint) → int -
The glyph for
codePoint, or 0 when the font has none. -
has(
int codePoint) → bool -
Whether the font maps
codePoint. -
horizontalStretch(
int glyph) → StretchInfo? -
How
glyphgrows horizontally, or null. -
instance(
Map< String, double> values) → MathFont -
This font at variation axis
values(tag → value in the axis's own units, as in{'wght': 700}), with its own glyph and metric caches; see OpenTypeFont.instance. Axes left out take their defaults, so values do not add up across calls. The same values give the same object, and the default values (or a font that does not vary) give the default font. -
isExtendedShape(
int glyph) → bool -
Whether
glyphis an extended shape. -
kern(
int glyph) → MathKernInfo? -
Math kerning for
glyph(font units inside), or null. -
kernAt(
int glyph, MathKernCorner corner, double heightEm) → double -
The kern for a script at
heightEmoncornerofglyph, in em. -
metrics(
int glyph) → GlyphMetrics -
Metrics of
glyph. -
mirroredVariant(
int glyph) → int? -
glyph's right-to-left mirrored form (rtlm), or null. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
outline(
int glyph) → GlyphPath -
The outline of
glyph, in font units, y up. -
scriptVariant(
int glyph, int level) → int -
glyph's script-size form (ssty) for scriptlevel1 (script) or 2 (scriptscript), orglyphwhen the font has none. -
toString(
) → String -
A string representation of this object.
inherited
-
verticalStretch(
int glyph) → StretchInfo? -
How
glyphgrows vertically, or null.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- latinModern → MathFont
-
Latin Modern Math, bundled with val_latex (GUST Font License).
no setter
- stixTwo → MathFont
-
STIX Two Math, bundled with val_latex (SIL Open Font License) as the
fallback for symbols Latin Modern Math lacks; decoded the first time
one is needed.
no setter