Debian Codegraph @

tools/postprocess-static.py

raw symbols SCIP
1 import sys
2
3 from fontTools.ttLib import TTFont, newTable
4 from fontTools.otlLib.maxContextCalc import maxCtxFont
5
6
7 def main():
8 font = TTFont(sys.argv[1])
9
10 name = font["name"]
11 head = font["head"]
12 OS_2 = font["OS/2"]
13 family = name.getName(1, 3, 1)
14 if str(family).endswith(" Italic"):
15 family.string = str(family).replace(" Italic", "")
16 name.setName("Italic", 2, family.platformID, family.platEncID, family.langID)
17
18 # Set italic bits
19 head.macStyle |= 1 << 1
20 OS_2.fsSelection |= 1 << 0
21
22 # Clear regular bit
23 OS_2.fsSelection &= ~(1 << 6)
24
25 # Force ppem to integer values, since the fonts are hinted.
26 head.flags |= 1 << 3
27
28 OS_2.usMaxContext = maxCtxFont(font)
29
30 font["DSIG"] = DSIG = newTable("DSIG")
31 DSIG.ulVersion = 1
32 DSIG.usFlag = 0
33 DSIG.usNumSigs = 0
34 DSIG.signatureRecords = []
35
36 font.save(sys.argv[1])
37
38
39 if __name__ == "__main__":
40 sys.exit(main())