forked from nlci/taml-font-thiruvalluvar
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wscript
126 lines (111 loc) · 4.68 KB
/
wscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/python
# this is a smith configuration file
# thiruvalluvar
# command line options
opts = preprocess_args(
{'opt' : '-l'}, # build fonts from legacy for inclusion into final fonts
{'opt' : '-p'}, # do not run psfix on the final fonts
{'opt' : '-s'} # only build a single font
)
import os2
# set the default output folders
out='results'
# locations of files needed for some tasks
DOCDIR = ['documentation', 'web']
STANDARDS='tests/reference'
# set meta-information
script='taml'
APPNAME='nlci-' + script
DESC_SHORT='Tamil Unicode font with OT and Graphite support'
DESC_NAME='NLCI-' + script
DEBPKG='fonts-nlci-' + script
getufoinfo('source/ThiruValluvar-Regular.ufo')
# set test parameters
TESTSTRING=u'\u0c15'
#ftmlTest('tools/FTMLcreateList.xsl')
ftmlTest('tools/ftml-padauk.xsl')
testCommand('sile', cmd='${SILE} -o "${TGT}" "${SRC[0].abspath()}" -f "${SRC[1]}"', extracmds=['sile'], shapers=0, supports=['.sil'], ext='.pdf')
# set fonts to build
faces = ('ThiruValluvar', 'Auvaiyar', 'Vaigai')
facesLegacy = ('THIR', 'AUVA', 'VAIG')
styles = ('-R', '-B', '-I', '-BI')
stylesName = ('Regular', 'Bold', 'Italic', 'Bold Italic')
stylesLegacy = ('', 'BD', 'I', 'BI')
if '-s' in opts:
faces = (faces[0],)
facesLegacy = (facesLegacy[0],)
styles = (styles[0],)
stylesName = (stylesName[0],)
stylesLegacy = (stylesLegacy[0],)
# set build parameters
fontbase = 'source/'
archive = fontbase + 'archive/'
generated = 'generated/'
tag = script.upper()
panose = [2, 0, 0, 3]
codePageRange = [0, 29]
unicodeRange = [0, 1, 2, 3, 4, 5, 6, 7, 15, 20, 29, 31, 32, 33, 35, 38, 39, 40, 45, 57, 60, 62, 67, 69, 91]
hackos2 = os2.hackos2(panose, codePageRange, unicodeRange)
if '-l' in opts:
for f, fLegacy in zip(faces, facesLegacy):
for (s, sn, sLegacy) in zip(styles, stylesName, stylesLegacy):
gentium = '../../../../latn/fonts/gentium_local/basic/1.102/zip/unhinted/2048/GenBkBas' + s.replace('-', '') + '.ttf'
charis = '../../../../latn/fonts/charis_local/5.000/zip/unhinted/2048/CharisSIL' + s + '.ttf'
extra = '../' + archive + 'VAIG' + sLegacy + '.ttf'
missing_face = fLegacy
if missing_face == 'AUVA':
missing_face = 'VAIG' # used to be THIR
missing = '../' + archive + missing_face + sLegacy + '.ttf'
font(target = process('ufo/' + f + '-' + sn.replace(' ', '') + '.ttf',
cmd(hackos2 + ' ${DEP} ${TGT}'),
name(f, lang='en-US', subfamily=(sn))
),
source = legacy(f + s + '.ttf',
source = archive + 'unhinted/' + fLegacy + sLegacy + '.ttf',
xml = fontbase + 'thiruvalluvar_unicode.xml',
params = '-f ' + charis + ' -f ' + extra + ' -f ' + missing,
noap = '')
)
psfix = 'cp' if '-p' in opts else 'psfix'
# create('master.sfd', cmd("../tools/ffaddapstotaml ${SRC} ${TGT}", ["source/master_src.sfd"]))
if '-l' in opts:
faces = list()
for f in faces:
p = package(
appname = APPNAME + '-' + f.lower(),
version = VERSION,
docdir = DOCDIR # 'documentation'
)
for (s, sn) in zip(styles, stylesName):
snf = '-' + sn.replace(' ', '')
fontfilename = tag + f + snf
if f == 'ThiruValluvar':
ot = f + s
else:
ot = 'additional_faces'
font(target = process(fontfilename + '.ttf',
#cmd(hackos2 + ' ${DEP} ${TGT}'),
name(tag + ' ' + f, lang='en-US', subfamily=(sn))
),
source = fontbase + f + snf + '.ufo',
# source = fontbase + f + snf + '.sfd',
# sfd_master = 'master.sfd',
# opentype = internal(),
# sfd_master = 'source/master_src.sfd',
# opentype = fea(fontbase + 'master_src.fea', no_make = True),
opentype = fea(fontbase + 'master.fea', no_make = True),
# opentype = fea(fontbase + ot + '.fea', no_make = True),
graphite = gdl(generated + f + snf + '.gdl',
master = fontbase + 'master.gdl',
make_params = '-l last -p 1',
params = '-e ' + f + snf + '_gdlerr.txt'
),
#classes = fontbase + 'thiruvalluvar_classes.xml',
ap = generated + f + snf + '.xml',
version = VERSION,
woff = woff('woff/' + fontfilename + '.woff', params = '-v ' + VERSION + ' -m ../' + fontbase + f + '-WOFF-metadata.xml'),
script = 'taml',
# extra_srcs = ['tools/ffaddapstotaml'],
package = p,
fret = fret(params = '')
)