Allow registering VP9 as a VT decoder
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / mathml / tools / use-typo-lineheight.py
1 #!/usr/bin/python
2
3 from __future__ import print_function
4 from utils.misc import MathMLAssociationCopyright
5 import fontforge
6
7 font = fontforge.font()
8 font.em = 1000
9 typoLineHeight = 2300
10 winHeight = 5000
11 name = "font-lineheight%d-typolineheight%d" % (winHeight, typoLineHeight)
12 font.fontname = name
13 font.familyname = name
14 font.fullname = name
15 font.copyright = MathMLAssociationCopyright
16
17 glyph = font.createChar(ord(" "), "space")
18 glyph.width = 1000
19 glyph = font.createChar(ord("O"))
20 pen = glyph.glyphPen()
21 pen.moveTo(0, -200)
22 pen.lineTo(0, 800)
23 pen.lineTo(1000, 800)
24 pen.lineTo(1000, -200)
25 pen.closePath();
26
27 font.os2_typoascent_add = False
28 font.os2_typoascent = 800
29 font.os2_typodescent_add = False
30 font.os2_typodescent = -200
31 font.os2_typolinegap = typoLineHeight - \
32                        (font.os2_typoascent - font.os2_typodescent)
33
34 font.hhea_ascent = winHeight / 2
35 font.hhea_ascent_add = False
36 font.hhea_descent = -winHeight / 2
37 font.hhea_descent_add = False
38 font.hhea_linegap = 0
39
40 font.os2_winascent = winHeight / 2
41 font.os2_winascent_add = False
42 font.os2_windescent = winHeight / 2
43 font.os2_windescent_add = False
44
45 font.os2_use_typo_metrics = True
46
47 path = "../../fonts/math/lineheight%d-typolineheight%d.woff" % (winHeight, typoLineHeight)
48 print("Generating %s..." % path, end="")
49 font.generate(path)
50 if font.validate() == 0:
51     print(" done.")
52 else:
53     print(" validation error!")
54     exit(1)