Debian Codegraph @

build.py

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 from fontTools.ttLib.ttFont import newTable
2 from fontmake import __main__
3 from fontTools.ttLib import TTFont, newTable
4 import shutil, subprocess, glob
5 from pathlib import Path
6
7 print ("[Rampart] Generating TTFs")
8 __main__.main(("-g","sources/RampartOne.glyphs", "-o","ttf",))
9
10 for font in Path("master_ttf").glob("*.ttf"):
11 modifiedFont = TTFont(font)
12 print ("["+str(font).split("/")[1][:-4]+"] Adding stub DSIG")
13 modifiedFont["DSIG"] = newTable("DSIG") #need that stub dsig
14 modifiedFont["DSIG"].ulVersion = 1
15 modifiedFont["DSIG"].usFlag = 0
16 modifiedFont["DSIG"].usNumSigs = 0
17 modifiedFont["DSIG"].signatureRecords = []
18
19 print ("["+str(font).split("/")[1][:-4]+"] Making other changes")
20 modifiedFont["name"].addMultilingualName({'ja':'ランパート One'}, modifiedFont, nameID = 1, windows=True, mac=False)
21 modifiedFont["name"].addMultilingualName({'ja':'Regular'}, modifiedFont, nameID = 2, windows=True, mac=False)
22 modifiedFont["head"].flags |= 1 << 3 #sets flag to always round PPEM to integer
23
24 modifiedFont.save("fonts/ttf/"+str(font).split("/")[1])
25
26 shutil.rmtree("instance_ufo")
27 shutil.rmtree("master_ufo")
28 shutil.rmtree("master_ttf")
29
30 for font in Path("fonts/ttf/").glob("*.ttf"):
31 print ("["+str(font).split("/")[2][:-4]+"] Autohinting")
32 fontName = str(font)
33 hintedName = fontName[:-4]+"-hinted.ttf"
34 subprocess.check_call(
35 [
36 "ttfautohint",
37 "--stem-width",
38 "nsn",
39 fontName,
40 hintedName,
41 ]
42 )
43
44 shutil.move(hintedName, fontName)