[MathML] Import WPT test to replace mathml/opentype/large-operators-italic-correction...
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / mathml / tools / largeop.py
1 #!/usr/bin/python
2
3 from utils import mathfont
4 import fontforge
5
6 nAryWhiteVerticalBarCodePoint = 0x2AFF
7 v1 = 5 * mathfont.em
8 f = mathfont.create("largeop-displayoperatorminheight%d" % v1)
9 f.math.DisplayOperatorMinHeight = v1
10 mathfont.createSquareGlyph(f, nAryWhiteVerticalBarCodePoint)
11 g = f.createChar(-1, "uni2AFF.display")
12 mathfont.drawRectangleGlyph(g, mathfont.em, v1, 0)
13 f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.display"
14 mathfont.save(f)
15
16 v1 = 2 * mathfont.em
17 v2 = 3 * mathfont.em
18 f = mathfont.create("largeop-displayoperatorminheight%d-2AFF-italiccorrection%d" % (v1, v2))
19 f.copyright = "Copyright (c) 2018 Igalia S.L."
20 f.math.DisplayOperatorMinHeight = v1
21 mathfont.createSquareGlyph(f, nAryWhiteVerticalBarCodePoint)
22 g = f.createChar(-1, "uni2AFF.display")
23 p = g.glyphPen()
24 p.moveTo(0, 0)
25 p.lineTo(v2, v1)
26 p.lineTo(v2 + mathfont.em, v1)
27 p.lineTo(mathfont.em, 0)
28 p.closePath();
29 g.width = mathfont.em + v2
30 g.italicCorrection = v2
31 f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.display"
32 mathfont.save(f)