MathConstants
in package
Parsed MathConstants sub-table from an OpenType MATH table.
Spec: https://learn.microsoft.com/en-us/typography/opentype/spec/math#mathconstants-table
Every value is in font design units (FUnit) unless otherwise noted; the consumer scales by (size / unitsPerEm) to get points. Percent-scale fields are signed Int16 percentages (so a 0.7 scale-down is stored as 70).
The painter consumes these constants to replace the hardcoded em-fractions baked into the tracer-bullet (SCRIPT_FONT_SCALE, SUP_RAISE_EM, fraction-bar thickness, etc.) with font-correct values that match the rendered glyph metrics.
v1 of this parser handles the FWord half of each MathValueRecord field. The Device-table half (per-PPEM corrections for hinting) is read but discarded - hinting at math-typesetting sizes is negligible and adds parser surface area for no observable gain.
Table of Contents
Properties
- $accentBaseHeight : int
- Vertical alignment for an accent's bottom relative to the base glyph's top.
- $axisHeight : int
- Vertical position of the mathematical axis (the centerline for fraction bars, sum operators, etc.) above baseline.
- $delimitedSubFormulaMinHeight : int
- Minimum height (in design units) at which a delimiter is drawn as the next stretched variant. Used by stretchy brackets and radicals.
- $displayOperatorMinHeight : int
- Minimum height (design units) at which an operator switches to its display (large) form.
- $flattenedAccentBaseHeight : int
- Vertical alignment for a flattened accent's bottom.
- $fractionDenomDisplayStyleGapMin : int
- $fractionDenominatorDisplayStyleShiftDown : int
- $fractionDenominatorGapMin : int
- $fractionDenominatorShiftDown : int
- $fractionNumDisplayStyleGapMin : int
- $fractionNumeratorDisplayStyleShiftUp : int
- $fractionNumeratorGapMin : int
- $fractionNumeratorShiftUp : int
- $fractionRuleThickness : int
- Thickness of the horizontal bar in fractions.
- $lowerLimitBaselineDropMin : int
- $lowerLimitGapMin : int
- $mathLeading : int
- Recommended gap between top of a math row and the top of its tallest glyph.
- $overbarExtraAscender : int
- $overbarRuleThickness : int
- $overbarVerticalGap : int
- $radicalDegreeBottomRaisePercent : int
- Percent of radical sign height the degree base rises (e.g. 60).
- $radicalDisplayStyleVerticalGap : int
- $radicalExtraAscender : int
- $radicalKernAfterDegree : int
- $radicalKernBeforeDegree : int
- $radicalRuleThickness : int
- $radicalVerticalGap : int
- $scriptPercentScaleDown : int
- Percent scale-down for script-level glyphs (e.g. 70 => 70%).
- $scriptScriptPercentScaleDown : int
- Percent scale-down for script-script-level glyphs (e.g. 55).
- $skewedFractionHorizontalGap : int
- $skewedFractionVerticalGap : int
- $spaceAfterScript : int
- $stackBottomDisplayStyleShiftDown : int
- $stackBottomShiftDown : int
- $stackDisplayStyleGapMin : int
- $stackGapMin : int
- $stackTopDisplayStyleShiftUp : int
- $stackTopShiftUp : int
- $stretchStackBottomShiftDown : int
- $stretchStackGapAboveMin : int
- $stretchStackGapBelowMin : int
- $stretchStackTopShiftUp : int
- $subscriptBaselineDropMin : int
- $subscriptShiftDown : int
- $subscriptTopMax : int
- $subSuperscriptGapMin : int
- $superscriptBaselineDropMax : int
- $superscriptBottomMaxWithSubscript : int
- $superscriptBottomMin : int
- $superscriptShiftUp : int
- $superscriptShiftUpCramped : int
- $underbarExtraDescender : int
- $underbarRuleThickness : int
- $underbarVerticalGap : int
- $upperLimitBaselineRiseMin : int
- $upperLimitGapMin : int
Methods
- __construct() : mixed
Properties
$accentBaseHeight
Vertical alignment for an accent's bottom relative to the base glyph's top.
public
int
$accentBaseHeight
$axisHeight
Vertical position of the mathematical axis (the centerline for fraction bars, sum operators, etc.) above baseline.
public
int
$axisHeight
$delimitedSubFormulaMinHeight
Minimum height (in design units) at which a delimiter is drawn as the next stretched variant. Used by stretchy brackets and radicals.
public
int
$delimitedSubFormulaMinHeight
$displayOperatorMinHeight
Minimum height (design units) at which an operator switches to its display (large) form.
public
int
$displayOperatorMinHeight
$flattenedAccentBaseHeight
Vertical alignment for a flattened accent's bottom.
public
int
$flattenedAccentBaseHeight
$fractionDenomDisplayStyleGapMin
public
int
$fractionDenomDisplayStyleGapMin
$fractionDenominatorDisplayStyleShiftDown
public
int
$fractionDenominatorDisplayStyleShiftDown
$fractionDenominatorGapMin
public
int
$fractionDenominatorGapMin
$fractionDenominatorShiftDown
public
int
$fractionDenominatorShiftDown
$fractionNumDisplayStyleGapMin
public
int
$fractionNumDisplayStyleGapMin
$fractionNumeratorDisplayStyleShiftUp
public
int
$fractionNumeratorDisplayStyleShiftUp
$fractionNumeratorGapMin
public
int
$fractionNumeratorGapMin
$fractionNumeratorShiftUp
public
int
$fractionNumeratorShiftUp
$fractionRuleThickness
Thickness of the horizontal bar in fractions.
public
int
$fractionRuleThickness
$lowerLimitBaselineDropMin
public
int
$lowerLimitBaselineDropMin
$lowerLimitGapMin
public
int
$lowerLimitGapMin
$mathLeading
Recommended gap between top of a math row and the top of its tallest glyph.
public
int
$mathLeading
$overbarExtraAscender
public
int
$overbarExtraAscender
$overbarRuleThickness
public
int
$overbarRuleThickness
$overbarVerticalGap
public
int
$overbarVerticalGap
$radicalDegreeBottomRaisePercent
Percent of radical sign height the degree base rises (e.g. 60).
public
int
$radicalDegreeBottomRaisePercent
$radicalDisplayStyleVerticalGap
public
int
$radicalDisplayStyleVerticalGap
$radicalExtraAscender
public
int
$radicalExtraAscender
$radicalKernAfterDegree
public
int
$radicalKernAfterDegree
$radicalKernBeforeDegree
public
int
$radicalKernBeforeDegree
$radicalRuleThickness
public
int
$radicalRuleThickness
$radicalVerticalGap
public
int
$radicalVerticalGap
$scriptPercentScaleDown
Percent scale-down for script-level glyphs (e.g. 70 => 70%).
public
int
$scriptPercentScaleDown
$scriptScriptPercentScaleDown
Percent scale-down for script-script-level glyphs (e.g. 55).
public
int
$scriptScriptPercentScaleDown
$skewedFractionHorizontalGap
public
int
$skewedFractionHorizontalGap
$skewedFractionVerticalGap
public
int
$skewedFractionVerticalGap
$spaceAfterScript
public
int
$spaceAfterScript
$stackBottomDisplayStyleShiftDown
public
int
$stackBottomDisplayStyleShiftDown
$stackBottomShiftDown
public
int
$stackBottomShiftDown
$stackDisplayStyleGapMin
public
int
$stackDisplayStyleGapMin
$stackGapMin
public
int
$stackGapMin
$stackTopDisplayStyleShiftUp
public
int
$stackTopDisplayStyleShiftUp
$stackTopShiftUp
public
int
$stackTopShiftUp
$stretchStackBottomShiftDown
public
int
$stretchStackBottomShiftDown
$stretchStackGapAboveMin
public
int
$stretchStackGapAboveMin
$stretchStackGapBelowMin
public
int
$stretchStackGapBelowMin
$stretchStackTopShiftUp
public
int
$stretchStackTopShiftUp
$subscriptBaselineDropMin
public
int
$subscriptBaselineDropMin
$subscriptShiftDown
public
int
$subscriptShiftDown
$subscriptTopMax
public
int
$subscriptTopMax
$subSuperscriptGapMin
public
int
$subSuperscriptGapMin
$superscriptBaselineDropMax
public
int
$superscriptBaselineDropMax
$superscriptBottomMaxWithSubscript
public
int
$superscriptBottomMaxWithSubscript
$superscriptBottomMin
public
int
$superscriptBottomMin
$superscriptShiftUp
public
int
$superscriptShiftUp
$superscriptShiftUpCramped
public
int
$superscriptShiftUpCramped
$underbarExtraDescender
public
int
$underbarExtraDescender
$underbarRuleThickness
public
int
$underbarRuleThickness
$underbarVerticalGap
public
int
$underbarVerticalGap
$upperLimitBaselineRiseMin
public
int
$upperLimitBaselineRiseMin
$upperLimitGapMin
public
int
$upperLimitGapMin
Methods
__construct()
public
__construct(int $scriptPercentScaleDown, int $scriptScriptPercentScaleDown, int $delimitedSubFormulaMinHeight, int $displayOperatorMinHeight, int $mathLeading, int $axisHeight, int $accentBaseHeight, int $flattenedAccentBaseHeight, int $subscriptShiftDown, int $subscriptTopMax, int $subscriptBaselineDropMin, int $superscriptShiftUp, int $superscriptShiftUpCramped, int $superscriptBottomMin, int $superscriptBaselineDropMax, int $subSuperscriptGapMin, int $superscriptBottomMaxWithSubscript, int $spaceAfterScript, int $upperLimitGapMin, int $upperLimitBaselineRiseMin, int $lowerLimitGapMin, int $lowerLimitBaselineDropMin, int $stackTopShiftUp, int $stackTopDisplayStyleShiftUp, int $stackBottomShiftDown, int $stackBottomDisplayStyleShiftDown, int $stackGapMin, int $stackDisplayStyleGapMin, int $stretchStackTopShiftUp, int $stretchStackBottomShiftDown, int $stretchStackGapAboveMin, int $stretchStackGapBelowMin, int $fractionNumeratorShiftUp, int $fractionNumeratorDisplayStyleShiftUp, int $fractionDenominatorShiftDown, int $fractionDenominatorDisplayStyleShiftDown, int $fractionNumeratorGapMin, int $fractionNumDisplayStyleGapMin, int $fractionRuleThickness, int $fractionDenominatorGapMin, int $fractionDenomDisplayStyleGapMin, int $skewedFractionHorizontalGap, int $skewedFractionVerticalGap, int $overbarVerticalGap, int $overbarRuleThickness, int $overbarExtraAscender, int $underbarVerticalGap, int $underbarRuleThickness, int $underbarExtraDescender, int $radicalVerticalGap, int $radicalDisplayStyleVerticalGap, int $radicalRuleThickness, int $radicalExtraAscender, int $radicalKernBeforeDegree, int $radicalKernAfterDegree, int $radicalDegreeBottomRaisePercent) : mixed
Parameters
- $scriptPercentScaleDown : int
- $scriptScriptPercentScaleDown : int
- $delimitedSubFormulaMinHeight : int
- $displayOperatorMinHeight : int
- $mathLeading : int
- $axisHeight : int
- $accentBaseHeight : int
- $flattenedAccentBaseHeight : int
- $subscriptShiftDown : int
- $subscriptTopMax : int
- $subscriptBaselineDropMin : int
- $superscriptShiftUp : int
- $superscriptShiftUpCramped : int
- $superscriptBottomMin : int
- $superscriptBaselineDropMax : int
- $subSuperscriptGapMin : int
- $superscriptBottomMaxWithSubscript : int
- $spaceAfterScript : int
- $upperLimitGapMin : int
- $upperLimitBaselineRiseMin : int
- $lowerLimitGapMin : int
- $lowerLimitBaselineDropMin : int
- $stackTopShiftUp : int
- $stackTopDisplayStyleShiftUp : int
- $stackBottomShiftDown : int
- $stackBottomDisplayStyleShiftDown : int
- $stackGapMin : int
- $stackDisplayStyleGapMin : int
- $stretchStackTopShiftUp : int
- $stretchStackBottomShiftDown : int
- $stretchStackGapAboveMin : int
- $stretchStackGapBelowMin : int
- $fractionNumeratorShiftUp : int
- $fractionNumeratorDisplayStyleShiftUp : int
- $fractionDenominatorShiftDown : int
- $fractionDenominatorDisplayStyleShiftDown : int
- $fractionNumeratorGapMin : int
- $fractionNumDisplayStyleGapMin : int
- $fractionRuleThickness : int
- $fractionDenominatorGapMin : int
- $fractionDenomDisplayStyleGapMin : int
- $skewedFractionHorizontalGap : int
- $skewedFractionVerticalGap : int
- $overbarVerticalGap : int
- $overbarRuleThickness : int
- $overbarExtraAscender : int
- $underbarVerticalGap : int
- $underbarRuleThickness : int
- $underbarExtraDescender : int
- $radicalVerticalGap : int
- $radicalDisplayStyleVerticalGap : int
- $radicalRuleThickness : int
- $radicalExtraAscender : int
- $radicalKernBeforeDegree : int
- $radicalKernAfterDegree : int
- $radicalDegreeBottomRaisePercent : int