# overscript is an accent. font.math.UpperLimitBaselineRiseMin = 0 font.math.StretchStackTopShiftUp = 0 font.math.AccentBaseHeight = 2 * mathfont.em font.math.OverbarVerticalGap = 0 createSizeVariants(font) for key in operatorDictionary: value = operatorDictionary[key] for c in value["characters"]: if c in font: continue if c == NonBreakingSpace: g = font.createChar(c) mathfont.drawRectangleGlyph(g, mathfont.em, mathfont.em / 3, 0) else: mathfont.createSquareGlyph(font, c) createStretchy(font, c, c in inlineAxisOperators) mathfont.save(font) # Generate the python file. for key in operatorDictionary: del operatorDictionary[key]["characters"] # Remove this temporary value. JSON = { "comment": "This file was automatically generated by operator-dictionary.py. Do not edit.", "dictionary": operatorDictionary } with open('../support/operator-dictionary.json', 'w') as fp: json.dump(JSON, fp, sort_keys=True, ensure_ascii=True)
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
from utils import mathfont import fontforge v1 = 5 * mathfont.em v2 = 1 * mathfont.em f = mathfont.create( "stack-bottomdisplaystyleshiftdown%d-axisheight%d" % (v1, v2), "Copyright (c) 2016 MathML Association") f.math.AxisHeight = v2 f.math.StackBottomDisplayStyleShiftDown = v1 f.math.StackBottomShiftDown = 0 f.math.StackDisplayStyleGapMin = 0 f.math.StackGapMin = 0 f.math.StackTopDisplayStyleShiftUp = 0 f.math.StackTopShiftUp = 0 mathfont.save(f) v1 = 6 * mathfont.em v2 = 1 * mathfont.em f = mathfont.create("stack-bottomshiftdown%d-axisheight%d" % (v1, v2), "Copyright (c) 2016 MathML Association") f.math.AxisHeight = v2 f.math.StackBottomDisplayStyleShiftDown = 0 f.math.StackBottomShiftDown = v1 f.math.StackDisplayStyleGapMin = 0 f.math.StackGapMin = 0 f.math.StackTopDisplayStyleShiftUp = 0 f.math.StackTopShiftUp = 0 mathfont.save(f) v = 4 * mathfont.em
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 ='\