-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
345 lines (306 loc) · 13.4 KB
/
Makefile
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
#!/usr/bin/make -f
SHELL:=/bin/bash
PY=python3
FAMILY=Nupuram
STYLES=$(shell $(PY) tools/read_config.py styles)
SOURCEDIR=sources
FONTSDIR=fonts
PROOFDIR=proofs
TESTSDIR=tests
TTFDIR=${FONTSDIR}/ttf
OTFDIR=${FONTSDIR}/otf
WEBFONTSDIR=${FONTSDIR}/webfonts
UFODIR=${SOURCEDIR}/ufo
INSTALLDIR=~/.fonts/$(FAMILY)
UFO=$(STYLES:%=$(UFODIR)/$(FAMILY)-%.ufo) \
$(UFODIR)/$(FAMILY)-Color-Regular.ufo \
$(UFODIR)/$(FAMILY)-Color-Thin.ufo \
$(UFODIR)/$(FAMILY)-Color-Black.ufo \
$(UFODIR)/$(FAMILY)-Arrows-Color.ufo
.PHONY: $(STYLES) ufo clean glyphs build proofs autobuild update-deps init update
default: build
help:
@echo "Build targets"
@echo
@echo " make build: Builds the fonts and places them in the fonts/ directory"
@echo " make test: Tests the fonts with fontbakery"
@echo " make proof: Creates HTML proof documents in the proof/ directory"
@echo
build: ufo Nupuram Nupuram-Calligraphy Nupuram-Color Nupuram-Display Nupuram-Dots Nupuram-Arrows-Color
# Recursively watch the file changes and make the (debug) svgs.
# Useful in design workflow.
# Package inotify-tools are available in linux distros
autobuild:
while inotifywait -r -e MODIFY $(SOURCEDIR)/glyphs/; do $(MAKE) -C $(SOURCEDIR); done;
# Targets for preparing the glyphs from metapost and preparing master UFOs.
glyphs: $(STYLES)
$(STYLES):
@mkdir -p $(SOURCEDIR)/svgs/$@
VARIANT=$@ $(MAKE) -C $(SOURCEDIR)
$(UFODIR)/$(FAMILY)-%.ufo: %
@echo " BUILD UFO $(@F)"
@mkdir -p ${UFODIR}
$(PY) tools/builder.py --style $* --source $(SOURCEDIR)/svgs/$* --output $@
@ufonormalizer -q -m $@
@# remove dangling semicolons in features.fea which font editors cannot handle
@sed -i 's/ ;$\//g' $@/features.fea
$(UFODIR)/$(FAMILY)-Color-%.ufo: $(UFODIR)/$(FAMILY)-Regular.ufo $(UFODIR)/$(FAMILY)-Shadow-%.ufo
@echo " BUILD UFO $(@F)"
$(PY) tools/build_color_v0.py $@
@ufonormalizer -q -m $@
$(UFODIR)/$(FAMILY)-Arrows-Color.ufo: $(UFODIR)/$(FAMILY)-Arrows.ufo $(UFODIR)/$(FAMILY)-Regular.ufo
@echo " BUILD UFO $(@F)"
$(PY) tools/build_color_v0.py $@
@ufonormalizer -q -m $@
ufo: glyphs $(UFO)
# Build targets for prepating the fonts from master UFO sources.
Nupuram: $(FONTSDIR)/Nupuram/ttf-variable\
$(FONTSDIR)/Nupuram/otf-variable \
$(FONTSDIR)/Nupuram/otf \
$(FONTSDIR)/Nupuram/ttf \
$(FONTSDIR)/Nupuram/webfonts \
$(FONTSDIR)/Nupuram/ufo
Nupuram-Calligraphy: $(FONTSDIR)/Nupuram-Calligraphy/ttf-variable \
$(FONTSDIR)/Nupuram-Calligraphy/otf-variable \
$(FONTSDIR)/Nupuram-Calligraphy/otf \
$(FONTSDIR)/Nupuram-Calligraphy/ttf \
$(FONTSDIR)/Nupuram-Calligraphy/ufo \
$(FONTSDIR)/Nupuram-Calligraphy/webfonts
Nupuram-Color: $(FONTSDIR)/Nupuram-Color/ttf-variable \
$(FONTSDIR)/Nupuram-Color/otf-variable \
$(FONTSDIR)/Nupuram-Color/ttf-color \
$(FONTSDIR)/Nupuram-Color/otf-color \
$(FONTSDIR)/Nupuram-Color/webfonts \
$(FONTSDIR)/Nupuram-Color/ufo
# $(FONTSDIR)/Nupuram-Color/otf $(FONTSDIR)/Nupuram-Color/ttf \ They are failing in instance creation.
# See https://github.com/googlefonts/fontmake/issues/928#issuecomment-1227311804
Nupuram-Arrows-Color: $(FONTSDIR)/Nupuram-Arrows-Color/ttf-color \
$(FONTSDIR)/Nupuram-Arrows-Color/otf-color \
$(FONTSDIR)/Nupuram-Arrows-Color/webfonts
Nupuram-Display: $(FONTSDIR)/Nupuram-Display/otf \
$(FONTSDIR)/Nupuram-Display/ttf \
$(FONTSDIR)/Nupuram-Display/ufo \
$(FONTSDIR)/Nupuram-Display/webfonts
Nupuram-Dots: $(FONTSDIR)/Nupuram-Dots/otf \
$(FONTSDIR)/Nupuram-Dots/ttf \
$(FONTSDIR)/Nupuram-Dots/ufo \
$(FONTSDIR)/Nupuram-Dots/webfonts
# Create ttf instances if a designspace exist
$(FONTSDIR)/%/ttf: %.designspace
fontmake --mm-designspace $*.designspace \
--interpolate \
--flatten-components \
--filter DecomposeTransformedComponentsFilter \
--filter "ufo2ft.filters.dottedCircle::DottedCircleFilter(pre=True, dots=10)" \
--verbose WARNING \
--output-dir $@ \
--output ttf \
--optimize-cff 1
$(PY) tools/fix_font.py $(FONTSDIR)/$*/ttf/*.ttf
# Create otf instances if a designspace exist
$(FONTSDIR)/%/otf : %.designspace
fontmake --mm-designspace $*.designspace \
--verbose WARNING \
--flatten-components \
--filter DecomposeTransformedComponentsFilter \
--filter "ufo2ft.filters.dottedCircle::DottedCircleFilter(pre=True, dots=10)" \
--interpolate \
--optimize-cff 1 \
--output-dir $@ \
--output otf
$(PY) tools/fix_font.py $@/*.otf
# Create ttf variablefont from the given designspace
$(FONTSDIR)/%/ttf-variable: %.designspace
fontmake --mm-designspace $*.designspace \
--filter DecomposeTransformedComponentsFilter \
--filter "ufo2ft.filters.dottedCircle::DottedCircleFilter(pre=True, dots=10)" \
--flatten-components \
--verbose WARNING \
--output-dir $@ \
--optimize-cff 1 \
--output variable
$(PY) tools/fix_font.py $@/*.ttf
$(PY) tools/stat.py $* $@/*.ttf
# Create otf variablefont from the given designspace
$(FONTSDIR)/%/otf-variable : %.designspace
fontmake --mm-designspace $*.designspace \
--output-dir $@ \
--flatten-components \
--filter DecomposeTransformedComponentsFilter \
--filter "ufo2ft.filters.dottedCircle::DottedCircleFilter(pre=True, dots=10)" \
--verbose WARNING \
--optimize-cff 1 \
--output variable-cff2
$(PY) tools/fix_font.py $@/*.otf
$(PY) tools/stat.py $* $@/*.otf
# Create Variable Color fonts-OTF from variable font. The variable font will be colrv0 already
# We just rename as per naming conventions. Then build colrv1 from it.
$(FONTSDIR)/%/otf-color : $(FONTSDIR)/%/otf-variable
@mkdir -p $@
@mv $</$*-VF.otf $@/$*.colrv0.otf
$(PY) tools/build_color_v1.py $@/$*.colrv0.otf $@/$*.colrv1.otf
@rm -rf $<
# Create Color fonts-OTF from otf font. The otf font will be colrv0 already
# We just rename as per naming conventions. Then build colrv1 from it.
$(FONTSDIR)/%/otf-color : $(FONTSDIR)/%/otf
@mkdir -p $@
@mv $</$*.otf $@/$*.colrv0.otf
$(PY) tools/build_color_v1.py $@/$*.colrv0.otf $@/$*.colrv1.otf
@rm -rf $<
# Create Variable Color fonts-TTF from variable font. The variable font will be colrv0 already
# We just rename as per naming conventions. Then build colrv1 from it.
$(FONTSDIR)/%/ttf-color : $(FONTSDIR)/%/ttf-variable
@mkdir -p $@
@mv $</$*-VF.ttf $@/$*.colrv0.ttf
$(PY) tools/build_color_v1.py $@/$*.colrv0.ttf $@/$*.colrv1.ttf
@rm -rf $<
# Create Color fonts-TTF from TTF font. The otf font will be colrv0 already
# We just rename as per naming conventions. Then build colrv1 from it.
$(FONTSDIR)/%/ttf-color : $(FONTSDIR)/%/ttf
@mkdir -p $@
@mv $</$*.ttf $@/$*.colrv0.ttf
$(PY) tools/build_color_v1.py $@/$*.colrv0.ttf $@/$*.colrv1.ttf
@rm -rf $<
# Create UFO instances from the given designspace
# Note that ufo instance created for multi layer color fonts will be invalid
# See # See https://github.com/googlefonts/fontmake/issues/928#issuecomment-1227311804
$(FONTSDIR)/%/ufo: %.designspace
fontmake --mm-designspace $*.designspace \
--interpolate \
--output ufo
# Compile otf from UFO file. This target will be picked up only if designspace is missing for the variant
$(FONTSDIR)/%/otf: ${UFODIR}/%.ufo
fontmake --validate-ufo \
--verbose=WARNING \
--optimize-cff 1 \
--flatten-components \
--filter DecomposeTransformedComponentsFilter \
--filter "ufo2ft.filters.dottedCircle::DottedCircleFilter(pre=True, dots=10)" \
--output otf \
--output-dir $@ \
--ufo-paths $(UFODIR)/$*.ufo
$(PY) tools/fix_font.py $@/*
# Compile ttf from UFO file. This target will be picked up only if designspace is missing for the variant
$(FONTSDIR)/%/ttf: ${UFODIR}/%.ufo
@fontmake --verbose=WARNING \
--output ttf \
--flatten-components \
--filter DecomposeTransformedComponentsFilter \
--filter "ufo2ft.filters.dottedCircle::DottedCircleFilter(pre=True, dots=10)" \
--optimize-cff 1 \
--output-dir $@ \
--ufo-paths $(UFODIR)/$*.ufo
$(PY) tools/fix_font.py $@/*.ttf
# Package the ufo in fonts directory, directly from the source UFO.
$(FONTSDIR)/%/ufo: ${UFODIR}/%.ufo
@cp -r $</ $@/
# Create woff2 formatted webfonts for all the ttfs available
# Could be done using fonttools but using a python script to avoid hassles of loop
# and filename mangling in Makefile
$(FONTSDIR)/%/webfonts:
@mkdir -p $@
$(PY) tools/gen_webfonts.py $(FONTSDIR)/$*/**/*.otf
clean:
@find -iname "*.pyc" -delete
@rm -rf $(FONTSDIR) $(PROOFDIR)
proofs:
@mkdir -p ${PROOFDIR}
hb-view $(FONTSDIR)/Nupuram/otf/Nupuram-Regular.otf \
--font-size 24 \
--margin 100 \
--line-space 2.4 \
--foreground=333333 \
--text-file $(TESTSDIR)/ligatures.txt \
--output-file $(PROOFDIR)/ligatures.pdf;
hb-view $(FONTSDIR)/Nupuram/otf/Nupuram-Regular.otf \
--font-size 24 \
--margin 100 \
--line-space 2.4 \
--foreground=333333 \
--text-file $(TESTSDIR)/content.txt \
--output-file $(PROOFDIR)/content.pdf;
hb-view $(FONTSDIR)/Nupuram/otf/Nupuram-Regular.otf \
--font-size 24 \
--margin 100 \
--line-space 2.4 \
--foreground=333333 \
--text-file $(TESTSDIR)/kerning.txt \
--output-file $(PROOFDIR)/kerning.pdf ;
hb-view $(FONTSDIR)/Nupuram/otf/Nupuram-Regular.otf \
--font-size 24 \
--margin 100 \
--line-space 2.4 \
--foreground=333333 \
--text-file $(TESTSDIR)/latin.txt \
--output-file $(PROOFDIR)/latin.pdf ;
test: proofs
# fontbakery check-fontval $(FONTSDIR)/$(FAMILY)-Regular.ttf <- enable when https://github.com/microsoft/Font-Validator/issues/62 fixed
fontbakery check-ufo-sources $(FONTSDIR)/Nupuram/ufo/$(FAMILY)-Regular.ufo
fontbakery check-opentype $(FONTSDIR)/Nupuram/otf/Nupuram-Regular.otf
fontbakery check-googlefonts --full-lists --config fontbakery.yaml --html tests/fontbakery-report.html --ghmarkdown tests/fontbakery-report.md $(FONTSDIR)/Nupuram/ttf-variable/Nupuram-VF.ttf
install: build
@mkdir -p $(INSTALLDIR);
@cp $(FONTSDIR)/Nupuram/otf-variable/Nupuram-VF.otf $(INSTALLDIR);
@cp $(FONTSDIR)/Nupuram-Color/otf-color/Nupuram-Color.colrv1.otf $(INSTALLDIR);
@cp $(FONTSDIR)/Nupuram-Arrows-Color/otf-color/Nupuram-Arrows-Color.colrv1.otf $(INSTALLDIR);
@cp $(FONTSDIR)/Nupuram-Calligraphy/otf-variable/Nupuram-Calligraphy-VF.otf $(INSTALLDIR);
@cp $(FONTSDIR)/Nupuram-Dots/otf/Nupuram-Dots.otf $(INSTALLDIR);
@cp $(FONTSDIR)/Nupuram-Display/otf/Nupuram-Display.otf $(INSTALLDIR);
@fc-cache -fr
release:
# Tar files - Nupuram
tar czvf $(FONTSDIR)/Nupuram.tar.gz *.conf OFL.txt README.md $(FONTSDIR)/Nupuram
sha256sum $(FONTSDIR)/Nupuram.tar.gz > $(FONTSDIR)/Nupuram.tar.gz.sha256
md5sum $(FONTSDIR)/Nupuram.tar.gz > $(FONTSDIR)/Nupuram.tar.gz.md5
# Zip files
zip -r $(FONTSDIR)/Nupuram.zip README.md OFL.txt $(FONTSDIR)/Nupuram
sha256sum $(FONTSDIR)/Nupuram.zip > $(FONTSDIR)/Nupuram.zip.sha256
md5sum $(FONTSDIR)/Nupuram.zip > $(FONTSDIR)/Nupuram.zip.md5
# Tar files - Nupuram Calligraphy
tar czvf $(FONTSDIR)/Nupuram-Calligraphy.tar.gz *.conf OFL.txt README.md $(FONTSDIR)/Nupuram-Calligraphy
sha256sum $(FONTSDIR)/Nupuram-Calligraphy.tar.gz > $(FONTSDIR)/Nupuram-Calligraphy.tar.gz.sha256
md5sum $(FONTSDIR)/Nupuram-Calligraphy.tar.gz > $(FONTSDIR)/Nupuram-Calligraphy.tar.gz.md5
# Zip files
zip -r $(FONTSDIR)/Nupuram-Calligraphy.zip README.md OFL.txt $(FONTSDIR)/Nupuram-Calligraphy
sha256sum $(FONTSDIR)/Nupuram-Calligraphy.zip > $(FONTSDIR)/Nupuram-Calligraphy.zip.sha256
md5sum $(FONTSDIR)/Nupuram-Calligraphy.zip > $(FONTSDIR)/Nupuram-Calligraphy.zip.md5
# Tar files - Nupuram Color
tar czvf $(FONTSDIR)/Nupuram-Color.tar.gz *.conf OFL.txt README.md $(FONTSDIR)/Nupuram-Color
sha256sum $(FONTSDIR)/Nupuram-Color.tar.gz > $(FONTSDIR)/Nupuram-Color.tar.gz.sha256
md5sum $(FONTSDIR)/Nupuram-Color.tar.gz > $(FONTSDIR)/Nupuram-Color.tar.gz.md5
# Zip files
zip -r $(FONTSDIR)/Nupuram-Color.zip README.md OFL.txt $(FONTSDIR)/Nupuram-Color
sha256sum $(FONTSDIR)/Nupuram-Color.zip > $(FONTSDIR)/Nupuram-Color.zip.sha256
md5sum $(FONTSDIR)/Nupuram-Color.zip > $(FONTSDIR)/Nupuram-Color.zip.md5
# Tar files - Nupuram Arrows Color
tar czvf $(FONTSDIR)/Nupuram-Arrows-Color.tar.gz *.conf OFL.txt README.md $(FONTSDIR)/Nupuram-Arrows-Color
sha256sum $(FONTSDIR)/Nupuram-Arrows-Color.tar.gz > $(FONTSDIR)/Nupuram-Arrows-Color.tar.gz.sha256
md5sum $(FONTSDIR)/Nupuram-Arrows-Color.tar.gz > $(FONTSDIR)/Nupuram-Arrows-Color.tar.gz.md5
# Zip files
zip -r $(FONTSDIR)/Nupuram-Arrows-Color.zip README.md OFL.txt $(FONTSDIR)/Nupuram-Arrows-Color
sha256sum $(FONTSDIR)/Nupuram-Arrows-Color.zip > $(FONTSDIR)/Nupuram-Arrows-Color.zip.sha256
md5sum $(FONTSDIR)/Nupuram-Arrows-Color.zip > $(FONTSDIR)/Nupuram-Arrows-Color.zip.md5
# Tar files - Nupuram Dots
tar czvf $(FONTSDIR)/Nupuram-Dots.tar.gz *.conf OFL.txt README.md $(FONTSDIR)/Nupuram-Dots
sha256sum $(FONTSDIR)/Nupuram-Dots.tar.gz > $(FONTSDIR)/Nupuram-Dots.tar.gz.sha256
md5sum $(FONTSDIR)/Nupuram-Dots.tar.gz > $(FONTSDIR)/Nupuram-Dots.tar.gz.md5
# Zip files
zip -r $(FONTSDIR)/Nupuram-Dots.zip README.md OFL.txt $(FONTSDIR)/Nupuram-Dots
sha256sum $(FONTSDIR)/Nupuram-Dots.zip > $(FONTSDIR)/Nupuram-Dots.zip.sha256
md5sum $(FONTSDIR)/Nupuram-Dots.zip > $(FONTSDIR)/Nupuram-Dots.zip.md5
# Tar files - Nupuram Display
tar czvf $(FONTSDIR)/Nupuram-Display.tar.gz *.conf OFL.txt README.md $(FONTSDIR)/Nupuram-Display
sha256sum $(FONTSDIR)/Nupuram-Display.tar.gz > $(FONTSDIR)/Nupuram-Display.tar.gz.sha256
md5sum $(FONTSDIR)/Nupuram-Display.tar.gz > $(FONTSDIR)/Nupuram-Display.tar.gz.md5
# Zip files
zip -r $(FONTSDIR)/Nupuram-Display.zip README.md OFL.txt $(FONTSDIR)/Nupuram-Display
sha256sum $(FONTSDIR)/Nupuram-Display.zip > $(FONTSDIR)/Nupuram-Display.zip.sha256
md5sum $(FONTSDIR)/Nupuram-Display.zip > $(FONTSDIR)/Nupuram-Display.zip.md5
init:
pip-sync
pip check
update: update-deps init
update-deps:
export PIP_REQUIRE_VIRTUALENV=true
pip install --upgrade pip-tools pip wheel
pip-compile --upgrade --extra=tests,dev -o requirements.txt pyproject.toml