-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
54 lines (42 loc) · 1.54 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
FONT_NAME = 0xProto
FAMILIES = Regular Italic Bold
SOURCE_DIR = sources
ROMAN_GLYPHS_FILE = $(SOURCE_DIR)/$(FONT_NAME).glyphspackage
ITALIC_GLYPHS_FILE = $(SOURCE_DIR)/$(FONT_NAME)-Italic.glyphspackage
OUTPUT_DIR = fonts
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-woff2-roman: $(OUTPUT_DIR)/$(FONT_NAME)-$(MAIN_WEIGHT).ttf $(OUTPUT_DIR)/$(FONT_NAME)-$(BOLD_WEIGHT).ttf
./woff2/woff2_compress $(OUTPUT_DIR)/$(FONT_NAME)-$(MAIN_WEIGHT).ttf
./woff2/woff2_compress $(OUTPUT_DIR)/$(FONT_NAME)-$(BOLD_WEIGHT).ttf
compile-woff2-italic: $(OUTPUT_DIR)/$(FONT_NAME)-$(ITALIC).ttf
./woff2/woff2_compress $(OUTPUT_DIR)/$(FONT_NAME)-$(ITALIC).ttf
compile-roman: $(ROMAN_GLYPHS_FILE)
fontmake -a -g $(ROMAN_GLYPHS_FILE) -i --output-dir $(OUTPUT_DIR)
compile-italic: $(ITALIC_GLYPHS_FILE)
fontmake -a -g $(ITALIC_GLYPHS_FILE) --output-dir $(OUTPUT_DIR)
compile-woff2: compile-roman compile-italic
@for family in $(FAMILIES); do \
./woff2/woff2_compress $(OUTPUT_DIR)/$(FONT_NAME)-$$family.ttf; \
done
compile-all:
$(MAKE) compile-woff2
.PHONY: clean
clean:
if [ -e $(OUTPUT_DIR) ]; then rm -rf $(OUTPUT_DIR); fi
install-otf: $(OUTPUT_DIR)
@for family in $(FAMILIES); do \
cp $(OUTPUT_DIR)/$(FONT_NAME)-$$family.otf $(HOME)/Library/Fonts; \
done
.PHONY: install
install:
$(MAKE) build && $(MAKE) install-otf