axisheight.py (1027B)
1 #!/usr/bin/env python3 2 3 from utils import mathfont 4 import fontforge 5 6 verticalArrowCodePoint = 0x21A8 7 v1 = 5 * mathfont.em 8 v2 = 14 * mathfont.em 9 f = mathfont.create("axisheight%d-verticalarrow%d" % (v1, v2), 10 "Copyright (c) 2016 MathML Association") 11 f.math.AxisHeight = v1 12 f.math.MinConnectorOverlap = 0 13 mathfont.createSquareGlyph(f, verticalArrowCodePoint) 14 g = f.createChar(-1, "size1") 15 mathfont.drawRectangleGlyph(g, mathfont.em, v2 / 2, 0) 16 g = f.createChar(-1, "size2") 17 mathfont.drawRectangleGlyph(g, mathfont.em, v2, 0) 18 g = f.createChar(-1, "bot") 19 mathfont.drawRectangleGlyph(g, mathfont.em, v2 + v1, 0) 20 g = f.createChar(-1, "ext") 21 mathfont.drawRectangleGlyph(g, mathfont.em, mathfont.em, 0) 22 f[verticalArrowCodePoint].verticalVariants = "uni21A8 size1 size2" 23 # Part: (glyphName, isExtender, startConnector, endConnector, fullAdvance) 24 f[verticalArrowCodePoint].verticalComponents = \ 25 (("bot", False, 0, mathfont.em, v2 + v1), 26 ("ext", True, mathfont.em, mathfont.em, mathfont.em)) 27 mathfont.save(f)