-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
73 lines (58 loc) · 1.27 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
NAME=hussaini-nastaleeq
VERSION=0.05
DIST=$(NAME)-$(VERSION)
OPT ?= t
PY=python3
define SCRIPT
import sys
import fontforge
f = fontforge.open(sys.argv[1])
f.mergeFeature(sys.argv[3])
f.version = "$(VERSION)"
flags = ["omit-instructions", "opentype", "no-mac-names"]
if sys.argv[4] == "t":
flags += ["short-post", "no-FFTM-table"]
f.generate(sys.argv[2], flags=flags)
f.close()
endef
export SCRIPT
define SVG_CSS
<style>
@media (prefers-color-scheme: dark) {
use:not([fill]) {
fill: white;
}
}
</style>
endef
export SVG_CSS
SFD=$(NAME:%=%.sfd)
TTF=$(NAME:%=%.ttf)
WOFF=$(NAME:%=%.woff)
WOFF2=$(NAME:%=%.woff2)
SVG=sample.svg
all: ttf svg
ttf: $(TTF)
svg: $(SVG)
$(NAME).ttf: $(NAME).sfd $(NAME).fea
@echo "Building $@"
fontforge -c "$$SCRIPT" $< $@ $(NAME).fea $(OPT)
%.woff: %.ttf
woff $<
%.woff2: %.ttf
woff2_compress $<
%.pdf: %.tex $(TTF)
lualatex --interaction=batchmode $<
%.svg: %.pdf
pdftocairo -svg $< $@
sed -i 's/<defs>/echo "$$SVG_CSS";echo "&"/e' $@
dist: $(TTF) $(WOFF) $(WOFF2)
@echo "Making dist tarball"
@mkdir -p $(DIST)/{desktop,web}
@cp $(TTF) $(DIST)/desktop
@cp $(WOFF) $(WOFF2) $(DIST)/web
@cp LICENSE $(DIST)
@cp README.md $(DIST)/README.txt
@zip -r $(DIST).zip $(DIST)
clean:
@rm -rf $(TTF) $(WOFF) $(WOFF2) $(DIST) $(DIST).zip