-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (64 loc) · 2.52 KB
/
Makefile
File metadata and controls
78 lines (64 loc) · 2.52 KB
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
FONT_NAME = ZxGamut
WEIGHTS = Thin ExtraLight Light Regular Medium SemiBold Bold ExtraBold Black
SOURCE_DIR = sources
MAIN_GLYPHS_FILE = $(SOURCE_DIR)/$(FONT_NAME).glyphspackage
OUTPUT_DIR = fonts
OUTPUT_STATIC_DIR = $(OUTPUT_DIR)/static
OUTPUT_VARIABLE_DIR = $(OUTPUT_DIR)/variable
VF_SUFFIX = [wght]
WOFF2_DIR = woff2
setup:
pip install -r requirements.txt
if [ ! -e $(WOFF2_DIR) ]; then $(MAKE) setup-woff2; fi
setup-woff2:
git clone --recursive https://github.com/google/woff2.git $(WOFF2_DIR)
cd $(WOFF2_DIR) && make clean all
.PHONY: build
build:
$(MAKE) clean
$(MAKE) compile-all
compile-static: $(MAIN_GLYPHS_FILE)
fontmake -a -g $(MAIN_GLYPHS_FILE) -i --output-dir $(OUTPUT_STATIC_DIR)
@echo "Fixing hinting for all static fonts..."
@for weight in $(WEIGHTS); do \
if [ -f $(OUTPUT_STATIC_DIR)/$(FONT_NAME)-$$weight.ttf ]; then \
gftools fix-hinting $(OUTPUT_STATIC_DIR)/$(FONT_NAME)-$$weight.ttf; \
mv $(OUTPUT_STATIC_DIR)/$(FONT_NAME)-$$weight.ttf.fix $(OUTPUT_STATIC_DIR)/$(FONT_NAME)-$$weight.ttf; \
fi; \
if [ -f $(OUTPUT_STATIC_DIR)/$(FONT_NAME)-$$weight.otf ]; then \
gftools fix-hinting $(OUTPUT_STATIC_DIR)/$(FONT_NAME)-$$weight.otf; \
if [ -f $(OUTPUT_STATIC_DIR)/$(FONT_NAME)-$$weight.otf.fix ]; then \
mv $(OUTPUT_STATIC_DIR)/$(FONT_NAME)-$$weight.otf.fix $(OUTPUT_STATIC_DIR)/$(FONT_NAME)-$$weight.otf; \
fi; \
fi; \
done
compile-variable: $(MAIN_GLYPHS_FILE)
fontmake -a -g $(MAIN_GLYPHS_FILE) -o variable --output-path $(OUTPUT_VARIABLE_DIR)/$(FONT_NAME)$(VF_SUFFIX).ttf
python scripts/fix-stat-table.py $(OUTPUT_VARIABLE_DIR)/$(FONT_NAME)$(VF_SUFFIX).ttf
gftools fix-nonhinting $(OUTPUT_VARIABLE_DIR)/$(FONT_NAME)$(VF_SUFFIX).ttf $(OUTPUT_VARIABLE_DIR)/$(FONT_NAME)$(VF_SUFFIX).ttf
compile-woff2: compile-static compile-variable
@for weight in $(WEIGHTS); do \
./woff2/woff2_compress $(OUTPUT_STATIC_DIR)/$(FONT_NAME)-$$weight.ttf; \
done
./woff2/woff2_compress $(OUTPUT_VARIABLE_DIR)/$(FONT_NAME)$(VF_SUFFIX).ttf
compile-all: $(MAIN_GLYPHS_FILE)
$(MAKE) compile-woff2
.PHONY: clean
clean:
if [ -e $(OUTPUT_DIR) ]; then rm -rf $(OUTPUT_DIR); fi
install-variable: $(OUTPUT_VARIABLE_DIR)/$(FONT_NAME)VF.ttf
cp $(OUTPUT_VARIABLE_DIR)/$(FONT_NAME)VF.ttf $(HOME)/Library/Fonts
.PHONY: install
install:
$(MAKE) build
$(MAKE) install-variable
.PHONY: test
test:
$(MAKE) test-gf
test-gf:
$(MAKE) test-gf-variable
$(MAKE) test-gf-static
test-gf-variable:
fontbakery check-googlefonts fonts/variable/ZxGamut\[wght\].ttf
test-gf-static:
fontbakery check-googlefonts fonts/static/ZxGamut-Bold.ttf