Update web-platform-tests to revision e8bfc205e36ad699601212cd50083870bad9a75d

This commit is contained in:
Ms2ger 2016-11-14 11:07:09 +01:00
parent 65dd6d4340
commit ccdb0a3458
1428 changed files with 118036 additions and 9786 deletions

View file

@ -0,0 +1,23 @@
#!/usr/bin/python
from utils import mathfont
import fontforge
verticalArrowCodePoint = 0x21A8
v1 = 5 * mathfont.em
v2 = 14 * mathfont.em
f = mathfont.create("axisheight%d-verticalarrow%d" % (v1, v2))
f.math.AxisHeight = v1
mathfont.createSquareGlyph(f, verticalArrowCodePoint)
g = f.createChar(-1, "size1")
mathfont.drawRectangleGlyph(g, mathfont.em, v2 / 2, 0)
g = f.createChar(-1, "size2")
mathfont.drawRectangleGlyph(g, mathfont.em, v2, 0)
g = f.createChar(-1, "bot")
mathfont.drawRectangleGlyph(g, mathfont.em, v2 + v1, 0)
g = f.createChar(-1, "ext")
mathfont.drawRectangleGlyph(g, mathfont.em, mathfont.em, 0)
f[verticalArrowCodePoint].verticalVariants = "uni21A8 size1 size2"
f[verticalArrowCodePoint].verticalComponents = \
(("bot", False, 0, 0, mathfont.em), ("ext", True, 0, 0, mathfont.em));
mathfont.save(f)

View file

@ -0,0 +1,153 @@
#!/usr/bin/python
from utils import mathfont
import fontforge
v1 = 7 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("fraction-axisheight%d-rulethickness%d" % (v1, v2))
f.math.AxisHeight = v1
f.math.FractionDenominatorDisplayStyleGapMin = 0
f.math.FractionDenominatorDisplayStyleShiftDown = 0
f.math.FractionDenominatorGapMin = 0
f.math.FractionDenominatorShiftDown = 0
f.math.FractionNumeratorDisplayStyleGapMin = 0
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionNumeratorGapMin = 0
f.math.FractionNumeratorShiftUp = 0
f.math.FractionRuleThickness = v2
mathfont.save(f)
v1 = 5 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("fraction-denominatordisplaystylegapmin%d-rulethickness%d" % (v1, v2))
f.math.AxisHeight = 0
f.math.FractionDenominatorDisplayStyleGapMin = v1
f.math.FractionDenominatorDisplayStyleShiftDown = 0
f.math.FractionDenominatorGapMin = 0
f.math.FractionDenominatorShiftDown = 0
f.math.FractionNumeratorDisplayStyleGapMin = 0
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionNumeratorGapMin = 0
f.math.FractionNumeratorShiftUp = 0
f.math.FractionRuleThickness = v2
mathfont.save(f)
v1 = 6 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("fraction-denominatordisplaystyleshiftdown%d-rulethickness%d" % (v1, v2))
f.math.AxisHeight = 0
f.math.FractionDenominatorDisplayStyleGapMin = 0
f.math.FractionDenominatorDisplayStyleShiftDown = v1
f.math.FractionDenominatorGapMin = 0
f.math.FractionDenominatorShiftDown = 0
f.math.FractionNumeratorDisplayStyleGapMin = 0
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionNumeratorGapMin = 0
f.math.FractionNumeratorShiftUp = 0
f.math.FractionRuleThickness = v2
mathfont.save(f)
v1 = 4 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("fraction-denominatorgapmin%d-rulethickness%d" % (v1, v2))
f.math.AxisHeight = 0
f.math.FractionDenominatorDisplayStyleGapMin = 0
f.math.FractionDenominatorDisplayStyleShiftDown = 0
f.math.FractionDenominatorGapMin = v1
f.math.FractionDenominatorShiftDown = 0
f.math.FractionNumeratorDisplayStyleGapMin = 0
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionNumeratorGapMin = 0
f.math.FractionNumeratorShiftUp = 0
f.math.FractionRuleThickness = v2
mathfont.save(f)
v1 = 3 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("fraction-denominatorshiftdown%d-rulethickness%d" % (v1, v2))
f.math.AxisHeight = 0
f.math.FractionDenominatorDisplayStyleGapMin = 0
f.math.FractionDenominatorDisplayStyleShiftDown = 0
f.math.FractionDenominatorGapMin = 0
f.math.FractionDenominatorShiftDown = v1
f.math.FractionNumeratorDisplayStyleGapMin = 0
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionNumeratorGapMin = 0
f.math.FractionNumeratorShiftUp = 0
f.math.FractionRuleThickness = v2
mathfont.save(f)
v1 = 8 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("fraction-numeratordisplaystylegapmin%d-rulethickness%d" % (v1, v2))
f.math.AxisHeight = 0
f.math.FractionDenominatorDisplayStyleGapMin = 0
f.math.FractionDenominatorDisplayStyleShiftDown = 0
f.math.FractionDenominatorGapMin = 0
f.math.FractionDenominatorShiftDown = 0
f.math.FractionNumeratorDisplayStyleGapMin = v1
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionNumeratorGapMin = 0
f.math.FractionNumeratorShiftUp = 0
f.math.FractionRuleThickness = v2
mathfont.save(f)
v1 = 2 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("fraction-numeratordisplaystyleshiftup%d-rulethickness%d" % (v1, v2))
f.math.AxisHeight = 0
f.math.FractionDenominatorDisplayStyleGapMin = 0
f.math.FractionDenominatorDisplayStyleShiftDown = 0
f.math.FractionDenominatorGapMin = 0
f.math.FractionDenominatorShiftDown = 0
f.math.FractionNumeratorDisplayStyleGapMin = 0
f.math.FractionNumeratorDisplayStyleShiftUp = v1
f.math.FractionNumeratorGapMin = 0
f.math.FractionNumeratorShiftUp = 0
f.math.FractionRuleThickness = v2
mathfont.save(f)
v1 = 9 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("fraction-numeratorgapmin%d-rulethickness%d" % (v1, v2))
f.math.AxisHeight = 0
f.math.FractionDenominatorDisplayStyleGapMin = 0
f.math.FractionDenominatorDisplayStyleShiftDown = 0
f.math.FractionDenominatorGapMin = 0
f.math.FractionDenominatorShiftDown = 0
f.math.FractionNumeratorDisplayStyleGapMin = 0
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionNumeratorGapMin = v1
f.math.FractionNumeratorShiftUp = 0
f.math.FractionRuleThickness = v2
mathfont.save(f)
v1 = 11 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("fraction-numeratorshiftup%d-rulethickness%d" % (v1, v2))
f.math.AxisHeight = 0
f.math.FractionDenominatorDisplayStyleGapMin = 0
f.math.FractionDenominatorDisplayStyleShiftDown = 0
f.math.FractionDenominatorGapMin = 0
f.math.FractionDenominatorShiftDown = 0
f.math.FractionNumeratorDisplayStyleGapMin = 0
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionNumeratorGapMin = 0
f.math.FractionNumeratorShiftUp = v1
f.math.FractionRuleThickness = v2
mathfont.save(f)
v1 = 10 * mathfont.em
f = mathfont.create("fraction-rulethickness%d" % v1)
f.math.AxisHeight = 0
f.math.FractionDenominatorDisplayStyleGapMin = 0
f.math.FractionDenominatorDisplayStyleShiftDown = 0
f.math.FractionDenominatorGapMin = 0
f.math.FractionDenominatorShiftDown = 0
f.math.FractionNumeratorDisplayStyleGapMin = 0
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionNumeratorGapMin = 0
f.math.FractionNumeratorShiftUp = 0
f.math.FractionRuleThickness = v1
mathfont.save(f)

View file

@ -0,0 +1,14 @@
#!/usr/bin/python
from utils import mathfont
import fontforge
nAryWhiteVerticalBarCodePoint = 0x2AFF
v1 = 5 * mathfont.em
f = mathfont.create("largeop-displayoperatorminheight%d" % v1)
f.math.DisplayOperatorMinHeight = v1
mathfont.createSquareGlyph(f, nAryWhiteVerticalBarCodePoint)
g = f.createChar(-1, "uni2AFF.display")
mathfont.drawRectangleGlyph(g, mathfont.em, v1, 0)
f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.display"
mathfont.save(f)

View file

@ -0,0 +1,74 @@
#!/usr/bin/python
from utils import mathfont
import fontforge
nArySumCodePoint = 0x2211 # largeop operator
v = 3 * mathfont.em
f = mathfont.create("limits-lowerlimitbaselinedropmin%d" % v)
mathfont.createSquareGlyph(f, nArySumCodePoint)
f.math.LowerLimitBaselineDropMin = v
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = 0
mathfont.save(f)
v = 11 * mathfont.em
f = mathfont.create("limits-lowerlimitgapmin%d" % v)
mathfont.createSquareGlyph(f, nArySumCodePoint)
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = v
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = 0
mathfont.save(f)
v = 5 * mathfont.em
f = mathfont.create("limits-upperlimitbaselinerisemin%d" % v)
mathfont.createSquareGlyph(f, nArySumCodePoint)
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = v
f.math.UpperLimitGapMin = 0
mathfont.save(f)
v = 7 * mathfont.em
f = mathfont.create("limits-upperlimitgapmin%d" % v)
mathfont.createSquareGlyph(f, nArySumCodePoint)
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = v
mathfont.save(f)

View file

@ -0,0 +1,127 @@
#!/usr/bin/python
from __future__ import print_function
from lxml import etree
from utils.misc import downloadWithProgressBar
from utils import mathfont
import json
# Retrieve the unicode.xml file if necessary.
unicodeXML = downloadWithProgressBar("http://www.w3.org/2003/entities/2007xml/unicode.xml")
# Extract the mathvariants transformation.
xsltTransform = etree.XSLT(etree.XML('''\
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:template match="charlist">
<root><xsl:apply-templates select="character"/></root>
</xsl:template>
<xsl:template match="character">
<xsl:if test="surrogate">
<entry>
<xsl:attribute name="mathvariant">
<xsl:value-of select="surrogate/@mathvariant"/>
</xsl:attribute>
<xsl:attribute name="baseChar">
<xsl:value-of select="surrogate/@ref"/>
</xsl:attribute>
<xsl:attribute name="transformedChar">
<xsl:choose>
<xsl:when test="bmp">
<xsl:value-of select="bmp/@ref"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@id"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</entry>
</xsl:if>
</xsl:template>
</xsl:stylesheet>'''))
# Put the mathvariant transforms into a Python structure.
mathvariantTransforms = {}
root = xsltTransform(etree.parse(unicodeXML)).getroot()
def parseCodePoint(aHexaString):
return int("0x%s" % aHexaString[1:], 16)
for entry in root:
mathvariant = entry.get("mathvariant")
baseChar = parseCodePoint(entry.get("baseChar"))
transformedChar = parseCodePoint(entry.get("transformedChar"))
if mathvariant not in mathvariantTransforms:
mathvariantTransforms[mathvariant] = {}
mathvariantTransforms[mathvariant][baseChar] = transformedChar
# There is no "isolated" mathvariant.
del mathvariantTransforms["isolated"]
# Create a WOFF font for each mathvariant.
for mathvariant in mathvariantTransforms:
font = mathfont.create("mathvariant-%s" % mathvariant)
for baseChar in mathvariantTransforms[mathvariant]:
if baseChar not in font:
mathfont.createGlyphFromValue(font, baseChar)
transformedChar = mathvariantTransforms[mathvariant][baseChar]
mathfont.createGlyphFromValue(font, transformedChar)
mathfont.save(font)
# Create a test font for each mathvariant.
for mathvariant in mathvariantTransforms:
print("Generating test for %s..." % mathvariant, end="")
reftest = open("../relations/css-styling/mathvariant-%s.html" % mathvariant, "w")
reftestReference = open("../relations/css-styling/mathvariant-%s-ref.html" % mathvariant, "w")
source = '\
<!DOCTYPE html>\n\
<html>\n\
<head>\n\
<meta charset="utf-8"/>\n\
<title>mathvariant %s</title>\n'
reftest.write(source % mathvariant)
reftestReference.write(source % ("%s (reference)" % mathvariant))
source ='\
<link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S2.html#SS3.SSS1.tab2"/>\n\
<link rel="match" href="mathvariant-%s-ref.html"/>\n\
<meta name="assert" content="Verify that a single-char <mi> with a %s mathvariant is equivalent to an <mi> with the transformed unicode character.">\n'
reftest.write(source % (mathvariant, mathvariant))
source = '\
<style>\n\
@font-face {\n\
font-family: TestFont;\n\
src: url("/fonts/math/mathvariant-%s.woff");\n\
}\n\
body > span {\n\
padding: 10px;\n\
}\n\
span > span {\n\
font-family: monospace;\n\
font-size: 10px;\n\
}\n\
math {\n\
font-family: TestFont;\n\
font-size: 10px;\n\
}\n\
</style>\n\
<body>\n\
<!-- Generated by mathml/tools/mathvariant.py; DO NOT EDIT. -->\n\
<p>Test passes if all the equalities below are true.</p>\n' % mathvariant
reftest.write(source)
reftestReference.write(source)
charIndex = 0
for baseChar in mathvariantTransforms[mathvariant]:
transformedChar = mathvariantTransforms[mathvariant][baseChar]
reftest.write(' <span><math><mi mathvariant="%s">&#x%0X;</mi></math>=<span>%05X</span></span>' % (mathvariant, baseChar, transformedChar))
reftestReference.write(' <span><math><mi>&#x%0X;</mi></math>=<span>%05X</span></span>' % (transformedChar, transformedChar))
charIndex += 1
if charIndex % 10 == 0:
reftest.write('<br/>')
reftestReference.write('<br/>')
reftest.write('\n')
reftestReference.write('\n')
source = '</body>\n</html>\n'
reftest.write(source)
reftestReference.write(source)
reftest.close()
reftestReference.close()
print(" done.")

View file

@ -0,0 +1,109 @@
#!/usr/bin/python
from utils import mathfont
import fontforge
def createStretchyRadical(aFont):
radicalCodePoint = 0x221a
mathfont.createSquareGlyph(aFont, radicalCodePoint)
g = aFont.createChar(-1, "size1")
mathfont.drawRectangleGlyph(g, mathfont.em, 2 * mathfont.em, 0)
g = aFont.createChar(-1, "size2")
mathfont.drawRectangleGlyph(g, mathfont.em, 3 * mathfont.em, 0)
g = aFont.createChar(-1, "size3")
mathfont.drawRectangleGlyph(g, mathfont.em, 4 * mathfont.em, 0)
overlap = mathfont.em / 2
aFont[radicalCodePoint].verticalVariants = "radical size1 size2 size3"
aFont[radicalCodePoint].verticalComponents = \
(("size2", False, 0, mathfont.em, 3 * mathfont.em), \
("size1", True, mathfont.em, mathfont.em, 2 * mathfont.em))
v1 = 25
v2 = 1 * mathfont.em
f = mathfont.create("radical-degreebottomraisepercent%d-rulethickness%d" % (v1, v2))
createStretchyRadical(f)
f.math.RadicalDegreeBottomRaisePercent = v1
f.math.RadicalDisplayStyleVerticalGap = 0
f.math.RadicalExtraAscender = 0
f.math.RadicalKernAfterDegree = 0
f.math.RadicalKernBeforeDegree = 0
f.math.RadicalRuleThickness = v2
f.math.RadicalVerticalGap = 0
mathfont.save(f)
v1 = 7 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("radical-displaystyleverticalgap%d-rulethickness%d" % (v1, v2))
createStretchyRadical(f)
f.math.RadicalDegreeBottomRaisePercent = 0
f.math.RadicalDisplayStyleVerticalGap = v1
f.math.RadicalExtraAscender = 0
f.math.RadicalKernAfterDegree = 0
f.math.RadicalKernBeforeDegree = 0
f.math.RadicalRuleThickness = v2
f.math.RadicalVerticalGap = 0
mathfont.save(f)
v1 = 3 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("radical-extraascender%d-rulethickness%d" % (v1, v2))
createStretchyRadical(f)
f.math.RadicalDegreeBottomRaisePercent = 0
f.math.RadicalDisplayStyleVerticalGap = 0
f.math.RadicalExtraAscender = v1
f.math.RadicalKernAfterDegree = 0
f.math.RadicalKernBeforeDegree = 0
f.math.RadicalRuleThickness = v2
f.math.RadicalVerticalGap = 0
mathfont.save(f)
v1 = 5 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("radical-kernafterdegreeminus%d-rulethickness%d" % (v1, v2))
createStretchyRadical(f)
f.math.RadicalDegreeBottomRaisePercent = 0
f.math.RadicalDisplayStyleVerticalGap = 0
f.math.RadicalExtraAscender = 0
f.math.RadicalKernAfterDegree = -v1
f.math.RadicalKernBeforeDegree = 0
f.math.RadicalRuleThickness = v2
f.math.RadicalVerticalGap = 0
mathfont.save(f)
v1 = 4 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("radical-kernbeforedegree%d-rulethickness%d" % (v1, v2))
createStretchyRadical(f)
f.math.RadicalDegreeBottomRaisePercent = 0
f.math.RadicalDisplayStyleVerticalGap = 0
f.math.RadicalExtraAscender = 0
f.math.RadicalKernAfterDegree = 0
f.math.RadicalKernBeforeDegree = v1
f.math.RadicalRuleThickness = v2
f.math.RadicalVerticalGap = 0
mathfont.save(f)
v = 8 * mathfont.em
f = mathfont.create("radical-rulethickness%d" % v)
createStretchyRadical(f)
f.math.RadicalDegreeBottomRaisePercent = 0
f.math.RadicalDisplayStyleVerticalGap = 0
f.math.RadicalExtraAscender = 0
f.math.RadicalKernAfterDegree = 0
f.math.RadicalKernBeforeDegree = 0
f.math.RadicalRuleThickness = v
f.math.RadicalVerticalGap = 0
mathfont.save(f)
v1 = 6 * mathfont.em
v2 = 1 * mathfont.em
f = mathfont.create("radical-verticalgap%d-rulethickness%d" % (v1, v2))
createStretchyRadical(f)
f.math.RadicalDegreeBottomRaisePercent = 0
f.math.RadicalDisplayStyleVerticalGap = 0
f.math.RadicalExtraAscender = 0
f.math.RadicalKernAfterDegree = 0
f.math.RadicalKernBeforeDegree = 0
f.math.RadicalRuleThickness = v2
f.math.RadicalVerticalGap = v1
mathfont.save(f)

View file

@ -0,0 +1,145 @@
#!/usr/bin/python
from utils import mathfont
import fontforge
v = 3 * mathfont.em
f = mathfont.create("scripts-spaceafterscript%d" % v)
f.math.SpaceAfterScript = v
f.math.SubSuperscriptGapMin = 0
f.math.SubscriptBaselineDropMin = 0
f.math.SubscriptShiftDown = 0
f.math.SubscriptTopMax = 0
f.math.SuperscriptBaselineDropMax = 0
f.math.SuperscriptBottomMaxWithSubscript = 0
f.math.SuperscriptBottomMin = 0
f.math.SuperscriptShiftUp = 0
f.math.SuperscriptShiftUpCramped = 0
mathfont.save(f)
v = 7 * mathfont.em
f = mathfont.create("scripts-superscriptshiftup%d" % v)
f.math.SpaceAfterScript = 0
f.math.SubSuperscriptGapMin = 0
f.math.SubscriptBaselineDropMin = 0
f.math.SubscriptShiftDown = 0
f.math.SubscriptTopMax = 0
f.math.SuperscriptBaselineDropMax = 0
f.math.SuperscriptBottomMaxWithSubscript = 0
f.math.SuperscriptBottomMin = 0
f.math.SuperscriptShiftUp = v
f.math.SuperscriptShiftUpCramped = 0
mathfont.save(f)
v = 5 * mathfont.em
f = mathfont.create("scripts-superscriptshiftupcramped%d" % v)
f.math.SpaceAfterScript = 0
f.math.SubSuperscriptGapMin = 0
f.math.SubscriptBaselineDropMin = 0
f.math.SubscriptShiftDown = 0
f.math.SubscriptTopMax = 0
f.math.SuperscriptBaselineDropMax = 0
f.math.SuperscriptBottomMaxWithSubscript = 0
f.math.SuperscriptBottomMin = 0
f.math.SuperscriptShiftUp = 0
f.math.SuperscriptShiftUpCramped = v
mathfont.save(f)
v = 6 * mathfont.em
f = mathfont.create("scripts-subscriptshiftdown%d" % v)
f.math.SpaceAfterScript = 0
f.math.SubSuperscriptGapMin = 0
f.math.SubscriptBaselineDropMin = 0
f.math.SubscriptShiftDown = v
f.math.SubscriptTopMax = 0
f.math.SuperscriptBaselineDropMax = 0
f.math.SuperscriptBottomMaxWithSubscript = 0
f.math.SuperscriptBottomMin = 0
f.math.SuperscriptShiftUp = 0
f.math.SuperscriptShiftUpCramped = 0
mathfont.save(f)
v = 11 * mathfont.em
f = mathfont.create("scripts-subsuperscriptgapmin%d" % v)
f.math.SpaceAfterScript = 0
f.math.SubSuperscriptGapMin = v
f.math.SubscriptBaselineDropMin = 0
f.math.SubscriptShiftDown = 0
f.math.SubscriptTopMax = 0
f.math.SuperscriptBaselineDropMax = 0
f.math.SuperscriptBottomMaxWithSubscript = 0
f.math.SuperscriptBottomMin = 0
f.math.SuperscriptShiftUp = 0
f.math.SuperscriptShiftUpCramped = 0
mathfont.save(f)
v1 = 11 * mathfont.em
v2 = 3 * mathfont.em
f = mathfont.create("scripts-subsuperscriptgapmin%d-superscriptbottommaxwithsubscript%d" % (v1, v2))
f.math.SpaceAfterScript = 0
f.math.SubSuperscriptGapMin = v1
f.math.SubscriptBaselineDropMin = 0
f.math.SubscriptShiftDown = 0
f.math.SubscriptTopMax = 0
f.math.SuperscriptBaselineDropMax = 0
f.math.SuperscriptBottomMaxWithSubscript = v2
f.math.SuperscriptBottomMin = 0
f.math.SuperscriptShiftUp = 0
f.math.SuperscriptShiftUpCramped = 0
mathfont.save(f)
v = 4 * mathfont.em
f = mathfont.create("scripts-subscripttopmax%d" % v)
f.math.SpaceAfterScript = 0
f.math.SubSuperscriptGapMin = 0
f.math.SubscriptBaselineDropMin = 0
f.math.SubscriptShiftDown = 0
f.math.SubscriptTopMax = v
f.math.SuperscriptBaselineDropMax = 0
f.math.SuperscriptBottomMaxWithSubscript = 0
f.math.SuperscriptBottomMin = 0
f.math.SuperscriptShiftUp = 0
f.math.SuperscriptShiftUpCramped = 0
mathfont.save(f)
v = 8 * mathfont.em
f = mathfont.create("scripts-superscriptbottommin%d" % v)
f.math.SpaceAfterScript = 0
f.math.SubSuperscriptGapMin = 0
f.math.SubscriptBaselineDropMin = 0
f.math.SubscriptShiftDown = 0
f.math.SubscriptTopMax = 0
f.math.SuperscriptBaselineDropMax = 0
f.math.SuperscriptBottomMaxWithSubscript = 0
f.math.SuperscriptBottomMin = v
f.math.SuperscriptShiftUp = 0
f.math.SuperscriptShiftUpCramped = 0
mathfont.save(f)
v = 9 * mathfont.em
f = mathfont.create("scripts-subscriptbaselinedropmin%d" % v)
f.math.SpaceAfterScript = 0
f.math.SubSuperscriptGapMin = 0
f.math.SubscriptBaselineDropMin = v
f.math.SubscriptShiftDown = 0
f.math.SubscriptTopMax = 0
f.math.SuperscriptBaselineDropMax = 0
f.math.SuperscriptBottomMaxWithSubscript = 0
f.math.SuperscriptBottomMin = 0
f.math.SuperscriptShiftUp = 0
f.math.SuperscriptShiftUpCramped = 0
mathfont.save(f)
v = 10 * mathfont.em
f = mathfont.create("scripts-superscriptbaselinedropmax%d" % v)
f.math.SpaceAfterScript = 0
f.math.SubSuperscriptGapMin = 0
f.math.SubscriptBaselineDropMin = 0
f.math.SubscriptShiftDown = 0
f.math.SubscriptTopMax = 0
f.math.SuperscriptBaselineDropMax = v
f.math.SuperscriptBottomMaxWithSubscript = 0
f.math.SuperscriptBottomMin = 0
f.math.SuperscriptShiftUp = 0
f.math.SuperscriptShiftUpCramped = 0
mathfont.save(f)

View file

@ -0,0 +1,81 @@
#!/usr/bin/python
from utils import mathfont
import fontforge
v = 7 * mathfont.em
f = mathfont.create("stack-axisheight%d" % v)
f.math.AxisHeight = v
f.math.StackBottomDisplayStyleShiftDown = 0
f.math.StackBottomShiftDown = 0
f.math.StackDisplayStyleGapMin = 0
f.math.StackGapMin = 0
f.math.StackTopDisplayStyleShiftUp = 0
f.math.StackTopShiftUp = 0
mathfont.save(f)
v = 5 * mathfont.em
f = mathfont.create("stack-bottomdisplaystyleshiftdown%d" % v)
f.math.AxisHeight = 0
f.math.StackBottomDisplayStyleShiftDown = v
f.math.StackBottomShiftDown = 0
f.math.StackDisplayStyleGapMin = 0
f.math.StackGapMin = 0
f.math.StackTopDisplayStyleShiftUp = 0
f.math.StackTopShiftUp = 0
mathfont.save(f)
v = 6 * mathfont.em
f = mathfont.create("stack-bottomshiftdown%d" % v)
f.math.AxisHeight = 0
f.math.StackBottomDisplayStyleShiftDown = 0
f.math.StackBottomShiftDown = v
f.math.StackDisplayStyleGapMin = 0
f.math.StackGapMin = 0
f.math.StackTopDisplayStyleShiftUp = 0
f.math.StackTopShiftUp = 0
mathfont.save(f)
v = 4 * mathfont.em
f = mathfont.create("stack-displaystylegapmin%d" % v)
f.math.AxisHeight = 0
f.math.StackBottomDisplayStyleShiftDown = 0
f.math.StackBottomShiftDown = 0
f.math.StackDisplayStyleGapMin = v
f.math.StackGapMin = 0
f.math.StackTopDisplayStyleShiftUp = 0
f.math.StackTopShiftUp = 0
mathfont.save(f)
v = 8 * mathfont.em
f = mathfont.create("stack-gapmin%d" % v)
f.math.AxisHeight = 0
f.math.StackBottomDisplayStyleShiftDown = 0
f.math.StackBottomShiftDown = 0
f.math.StackDisplayStyleGapMin = 0
f.math.StackGapMin = v
f.math.StackTopDisplayStyleShiftUp = 0
f.math.StackTopShiftUp = 0
mathfont.save(f)
v = 3 * mathfont.em
f = mathfont.create("stack-topdisplaystyleshiftup%d" % v)
f.math.AxisHeight = 0
f.math.StackBottomDisplayStyleShiftDown = 0
f.math.StackBottomShiftDown = 0
f.math.StackDisplayStyleGapMin = 0
f.math.StackGapMin = 0
f.math.StackTopDisplayStyleShiftUp = v
f.math.StackTopShiftUp = 0
mathfont.save(f)
v = 9 * mathfont.em
f = mathfont.create("stack-topshiftup%d" % v)
f.math.AxisHeight = 0
f.math.StackBottomDisplayStyleShiftDown = 0
f.math.StackBottomShiftDown = 0
f.math.StackDisplayStyleGapMin = 0
f.math.StackGapMin = 0
f.math.StackTopDisplayStyleShiftUp = 0
f.math.StackTopShiftUp = v
mathfont.save(f)

View file

@ -0,0 +1,74 @@
#!/usr/bin/python
from utils import mathfont
import fontforge
arrowCodePoint = 0x2192 # horizontal stretch operator
v = 3 * mathfont.em
f = mathfont.create("stretchstack-bottomshiftdown%d" % v)
mathfont.createSquareGlyph(f, arrowCodePoint)
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = v
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = 0
mathfont.save(f)
v = 11 * mathfont.em
f = mathfont.create("stretchstack-gapbelowmin%d" % v)
mathfont.createSquareGlyph(f, arrowCodePoint)
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = v
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = 0
mathfont.save(f)
v = 5 * mathfont.em
f = mathfont.create("stretchstack-topshiftup%d" % v)
mathfont.createSquareGlyph(f, arrowCodePoint)
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = v
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = 0
mathfont.save(f)
v = 7 * mathfont.em
f = mathfont.create("stretchstack-gapabovemin%d" % v)
mathfont.createSquareGlyph(f, arrowCodePoint)
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = v
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = 0
mathfont.save(f)

View file

@ -0,0 +1,84 @@
#!/usr/bin/python
from utils import mathfont
import fontforge
breveCodePoint = 0x2D8 # accent operator
degreeCodePoint = 0xB0 # nonaccent operator
accentBaseHeight = 4 * mathfont.em
v = 3 * mathfont.em
f = mathfont.create("underover-accentbaseheight%d-overbarextraascender%d" % (accentBaseHeight, v))
mathfont.createSquareGlyph(f, breveCodePoint)
mathfont.createSquareGlyph(f, degreeCodePoint)
f.math.AccentBaseHeight = accentBaseHeight
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = v
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = 0
mathfont.save(f)
v = 11 * mathfont.em
f = mathfont.create("underover-accentbaseheight%d-overbarverticalgap%d" % (accentBaseHeight, v))
mathfont.createSquareGlyph(f, breveCodePoint)
mathfont.createSquareGlyph(f, degreeCodePoint)
f.math.AccentBaseHeight = accentBaseHeight
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = v
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = 0
mathfont.save(f)
v = 5 * mathfont.em
f = mathfont.create("underover-accentbaseheight%d-underbarextradescender%d" % (accentBaseHeight, v))
mathfont.createSquareGlyph(f, breveCodePoint)
mathfont.createSquareGlyph(f, degreeCodePoint)
f.math.AccentBaseHeight = accentBaseHeight
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = v
f.math.UnderbarVerticalGap = 0
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = 0
mathfont.save(f)
v = 7 * mathfont.em
f = mathfont.create("underover-accentbaseheight%d-underbarverticalgap%d" % (accentBaseHeight, v))
mathfont.createSquareGlyph(f, breveCodePoint)
mathfont.createSquareGlyph(f, degreeCodePoint)
f.math.AccentBaseHeight = accentBaseHeight
f.math.LowerLimitBaselineDropMin = 0
f.math.LowerLimitGapMin = 0
f.math.OverbarExtraAscender = 0
f.math.OverbarVerticalGap = 0
f.math.StretchStackBottomShiftDown = 0
f.math.StretchStackGapAboveMin = 0
f.math.StretchStackGapBelowMin = 0
f.math.StretchStackTopShiftUp = 0
f.math.UnderbarExtraDescender = 0
f.math.UnderbarVerticalGap = v
f.math.UpperLimitBaselineRiseMin = 0
f.math.UpperLimitGapMin = 0
mathfont.save(f)

View file

@ -0,0 +1,54 @@
#!/usr/bin/python
from __future__ import print_function
from utils.misc import MathMLAssociationCopyright
import fontforge
font = fontforge.font()
font.em = 1000
typoLineHeight = 2300
winHeight = 5000
name = "font-lineheight%d-typolineheight%d" % (winHeight, typoLineHeight)
font.fontname = name
font.familyname = name
font.fullname = name
font.copyright = MathMLAssociationCopyright
glyph = font.createChar(ord(" "), "space")
glyph.width = 1000
glyph = font.createChar(ord("O"))
pen = glyph.glyphPen()
pen.moveTo(0, -200)
pen.lineTo(0, 800)
pen.lineTo(1000, 800)
pen.lineTo(1000, -200)
pen.closePath();
font.os2_typoascent_add = False
font.os2_typoascent = 800
font.os2_typodescent_add = False
font.os2_typodescent = -200
font.os2_typolinegap = typoLineHeight - \
(font.os2_typoascent - font.os2_typodescent)
font.hhea_ascent = winHeight / 2
font.hhea_ascent_add = False
font.hhea_descent = -winHeight / 2
font.hhea_descent_add = False
font.hhea_linegap = 0
font.os2_winascent = winHeight / 2
font.os2_winascent_add = False
font.os2_windescent = winHeight / 2
font.os2_windescent_add = False
font.os2_use_typo_metrics = True
path = "../../fonts/math/lineheight%d-typolineheight%d.woff" % (winHeight, typoLineHeight)
print("Generating %s..." % path, end="")
font.generate(path)
if font.validate() == 0:
print(" done.")
else:
print(" validation error!")
exit(1)

View file

@ -0,0 +1,190 @@
from __future__ import print_function
import fontforge
from misc import MathMLAssociationCopyright
em = 1000
def create(aName):
print("Generating %s.woff..." % aName, end="")
mathFont = fontforge.font()
mathFont.fontname = aName
mathFont.familyname = aName
mathFont.fullname = aName
mathFont.copyright = MathMLAssociationCopyright
mathFont.encoding = "UnicodeFull"
# Create a space character. Also force the creation of some MATH subtables
# so that OTS will not reject the MATH table.
g = mathFont.createChar(ord(" "), "space")
g.width = em
g.italicCorrection = 0
g.topaccent = 0
g.mathKern.bottomLeft = tuple([(0,0)])
g.mathKern.bottomRight = tuple([(0,0)])
g.mathKern.topLeft = tuple([(0,0)])
g.mathKern.topRight = tuple([(0,0)])
mathFont[ord(" ")].horizontalVariants = "space"
mathFont[ord(" ")].verticalVariants = "space"
return mathFont
def drawRectangleGlyph(aGlyph, aWidth, aAscent, aDescent):
p = aGlyph.glyphPen()
p.moveTo(0, -aDescent)
p.lineTo(0, aAscent)
p.lineTo(aWidth, aAscent)
p.lineTo(aWidth, -aDescent)
p.closePath();
aGlyph.width = aWidth
def createSquareGlyph(aFont, aCodePoint):
g = aFont.createChar(aCodePoint)
drawRectangleGlyph(g, em, em, 0)
def drawHexaDigit(aGlyph, aX, aValue):
t = em / 10
p = aGlyph.glyphPen(replace = False)
if aValue == 0:
p.moveTo(aX + t, t)
p.lineTo(aX + t, em - t)
p.lineTo(aX + em / 2 - t, em - t)
p.lineTo(aX + em / 2 - t, t)
p.closePath()
elif aValue == 1:
p.moveTo(aX + em / 2 - t, em - t)
p.lineTo(aX + em / 2 - t, t)
p.endPath()
elif aValue == 2:
p.moveTo(aX + t, em - t)
p.lineTo(aX + em / 2 - t, em - t)
p.lineTo(aX + em / 2 - t, em / 2)
p.lineTo(aX + t, em / 2)
p.lineTo(aX + t, t)
p.lineTo(aX + em / 2 - t, t)
p.endPath()
elif aValue == 3:
p.moveTo(aX + t, em - t)
p.lineTo(aX + em / 2 - t, em - t)
p.lineTo(aX + em / 2 - t, t)
p.lineTo(aX + t, t)
p.endPath()
p.moveTo(aX + t, em / 2)
p.lineTo(aX + em / 2 - 2.5 * t, em / 2)
p.endPath()
elif aValue == 4:
p.moveTo(aX + em / 2 - t, em - t)
p.lineTo(aX + em / 2 - t, t)
p.endPath()
p.moveTo(aX + t, em - t)
p.lineTo(aX + t, em / 2)
p.lineTo(aX + em / 2 - 2.5 * t, em / 2)
p.endPath()
elif aValue == 5:
p.moveTo(aX + em / 2 - t, em - t)
p.lineTo(aX + t, em - t)
p.lineTo(aX + t, em / 2)
p.lineTo(aX + em / 2 - t, em / 2)
p.lineTo(aX + em / 2 - t, t)
p.lineTo(aX + t, t)
p.endPath()
elif aValue == 6:
p.moveTo(aX + em / 2 - t, em - t)
p.lineTo(aX + t, em - t)
p.lineTo(aX + t, t)
p.lineTo(aX + em / 2 - t, t)
p.lineTo(aX + em / 2 - t, em / 2)
p.lineTo(aX + 2.5 * t, em / 2)
p.endPath()
elif aValue == 7:
p.moveTo(aX + t, em - t)
p.lineTo(aX + em / 2 - t, em - t)
p.lineTo(aX + em / 2 - t, t)
p.endPath()
elif aValue == 8:
p.moveTo(aX + t, t)
p.lineTo(aX + t, em - t)
p.lineTo(aX + em / 2 - t, em - t)
p.lineTo(aX + em / 2 - t, t)
p.closePath()
p.moveTo(aX + 2.5 * t, em / 2)
p.lineTo(aX + em / 2 - 2.5 * t, em / 2)
p.endPath()
elif aValue == 9:
p.moveTo(aX + t, t)
p.lineTo(aX + em / 2 - t, t)
p.lineTo(aX + em / 2 - t, em - t)
p.lineTo(aX + t, em - t)
p.lineTo(aX + t, em / 2)
p.lineTo(aX + em / 2 - 2.5 * t, em / 2)
p.endPath()
elif aValue == 10: # A
p.moveTo(aX + t, t)
p.lineTo(aX + t, em - t)
p.lineTo(aX + em / 2 - t, em - t)
p.lineTo(aX + em / 2 - t, t)
p.endPath()
p.moveTo(aX + 2.5 * t, em / 2)
p.lineTo(aX + em / 2 - 2.5 * t, em / 2)
p.endPath()
elif aValue == 11: # b
p.moveTo(aX + t, em - t)
p.lineTo(aX + t, t)
p.lineTo(aX + em / 2 - t, t)
p.lineTo(aX + em / 2 - t, em / 2)
p.lineTo(aX + 2.5 * t, em / 2)
p.endPath()
elif aValue == 12: # C
p.moveTo(aX + em / 2 - t, em - t)
p.lineTo(aX + t, em - t)
p.lineTo(aX + t, t)
p.lineTo(aX + em / 2 - t, t)
p.endPath()
elif aValue == 13: # d
p.moveTo(aX + em / 2 - t, em - t)
p.lineTo(aX + em / 2 - t, t)
p.lineTo(aX + t, t)
p.lineTo(aX + t, em / 2)
p.lineTo(aX + em / 2 - 2.5 * t, em / 2)
p.endPath()
elif aValue == 14: # E
p.moveTo(aX + em / 2 - t, em - t)
p.lineTo(aX + t, em - t)
p.lineTo(aX + t, t)
p.lineTo(aX + em / 2 - t, t)
p.endPath()
p.moveTo(aX + em / 2 - t, em / 2)
p.lineTo(aX + 2.5 * t, em / 2)
p.endPath()
elif aValue == 15: # F
p.moveTo(aX + em / 2 - t, em - t)
p.lineTo(aX + t, em - t)
p.lineTo(aX + t, t)
p.endPath()
p.moveTo(aX + em / 2 - t, em / 2)
p.lineTo(aX + 2.5 * t, em / 2)
p.endPath()
def createGlyphFromValue(aFont, aCodePoint):
g = aFont.createChar(aCodePoint)
value = aCodePoint
for i in range(0, 5):
drawHexaDigit(g, (5 - (i + 1)) * em / 2, value % 16)
value /= 16
g.width = 5 * em / 2
g.stroke("circular", em / 10, "square", "miter", "cleanup")
def save(aFont):
aFont.em = em
aFont.ascent = aFont.hhea_ascent = aFont.os2_typoascent = em
aFont.descent = aFont.hhea_descent = aFont.os2_typodescent = 0
# aFont.os2_winascent, aFont.os2_windescent should be the maximum of
# ascent/descent for all glyphs. Does fontforge compute them automatically?
aFont.hhea_ascent_add = aFont.hhea_descent_add = 0
aFont.os2_typoascent_add = aFont.os2_typodescent_add = 0
aFont.os2_winascent_add = aFont.os2_windescent_add = 0
aFont.os2_use_typo_metrics = True
aFont.generate("../../fonts/math/%s.woff" % aFont.fontname)
if aFont.validate() == 0:
print(" done.")
else:
print(" validation error!")
exit(1)

View file

@ -0,0 +1,33 @@
from __future__ import print_function
import os
import progressbar
import urllib2
MathMLAssociationCopyright = "Copyright (c) 2016 MathML Association"
def downloadWithProgressBar(url, outputDirectory="./", forceDownload=False):
baseName = os.path.basename(url)
fileName = os.path.join(outputDirectory, baseName)
if not forceDownload and os.path.exists(fileName):
return fileName
request = urllib2.urlopen(url)
totalSize = int(request.info().getheader('Content-Length').strip())
bar = progressbar.ProgressBar(maxval=totalSize).start()
chunkSize = 16 * 1024
downloaded = 0
print("Downloading %s" % url)
os.umask(0002)
with open(fileName, 'wb') as fp:
while True:
chunk = request.read(chunkSize)
downloaded += len(chunk)
bar.update(downloaded)
if not chunk: break
fp.write(chunk)
bar.finish()
return fileName

View file

@ -0,0 +1,11 @@
#!/usr/bin/python
from utils import mathfont
import fontforge
v = mathfont.em / 2
f = mathfont.create("xheight%d" % v)
g = f.createChar(ord('x'))
mathfont.drawRectangleGlyph(g, mathfont.em, v, 0)
assert f.xHeight == v, "Bad x-height value!"
mathfont.save(f)