summaryrefslogtreecommitdiff
path: root/fonts/thai/fonts-tlwg/scripts/gen-test-ttf.py
blob: 9ea7563e9f583c224cadfdb59c37490c906b1c48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import sys
import os
import fontforge

sfd_file = sys.argv[1]

f = fontforge.open(sfd_file)

# Prepend "TTF" prefix to font/family name
f.fontname = "TTF" + f.fontname
f.familyname = "TTF" + f.familyname
f.fullname = "TTF" + f.fullname

# Prepend "TTF" prefix to "Preferred Family"
for name in f.sfnt_names:
    if name[0] == "English (US)" and name[1] == "Preferred Family":
        f.appendSFNTName(name[0], name[1], "TTF" + name[2])
        break

f.generate(f.fontname + ".ttf", layer="Quad")