forked from danielbruce/entypo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
120 lines (95 loc) · 4.21 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
PROJECT := $(notdir ${PWD})
FONT_NAME := entypo
################################################################################
## ! DO NOT EDIT BELOW THIS LINE, UNLESS YOU REALLY KNOW WHAT ARE YOU DOING ! ##
################################################################################
TMP_PATH := /tmp/${PROJECT}-$(shell date +%s)
REMOTE_NAME ?= origin
REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url)
# Add local versions of ttf2eot nd ttfautohint to the PATH
PATH := $(PATH):./support/font-builder/support/ttf2eot
PATH := $(PATH):./support/font-builder/support/ttfautohint/frontend
PATH := $(PATH):./support/font-builder/bin
PATH := $(PATH):./bin
FONTFORGE ?= $(shell which fontforge)
RM_F ?= rm -f
all: dist
dist: font.zip
font.zip: font html
$(RM_F) font.zip
cd font && zip ../font.zip *
dump: src/svg/note.svg
src/svg/note.svg: src/original/entypo.svg src/original/entypo-social.svg config.yml
rm -rf src/svg
mkdir src/svg
font-dump.js --hcrop -c config.yml -f -i src/original/entypo.svg -o ./src/svg/ -d diff.yml
font-dump.js --hcrop -c config.yml -f -i src/original/entypo-social.svg -o ./src/svg/ -d diff.yml
%.svg: %.ttf
: # FIXME How to autofix missed points in FontForge?
$(FONTFORGE) -script ./bin/ffttf2svg.pe "$<" "[email protected]"
: # Changed descent to 0, accent to 500, to fix scale
sed -e 's,units-per-em="1000",units-per-em="500",g;s,ascent="750",ascent="500",g;s,descent="-250",descent="0",g' "[email protected]" >"$@"
rm "[email protected]"
%.ttf:
update-entypo.sh src/original
$(RM_F) src/original/*.svg
check.js --locals config.yml --input src/original/entypo.yml
src/original/entypo.svg: src/original/entypo.ttf
src/original/entypo-social.svg: src/original/entypo-social.ttf
font: font/$(FONT_NAME).ttf font/$(FONT_NAME).eot
font/$(FONT_NAME).ttf font/$(FONT_NAME).eot: support dump
rm -rf font
mkdir -p font
fontbuild.py -c ./config.yml -t ./src/font_template.sfd -i ./src/svg -o ./font/$(FONT_NAME).ttf
ttfautohint --latin-fallback --hinting-limit=200 --hinting-range-max=50 --symbol ./font/$(FONT_NAME).ttf ./font/$(FONT_NAME)-hinted.ttf
mv ./font/$(FONT_NAME)-hinted.ttf ./font/$(FONT_NAME).ttf
fontconvert.py -i ./font/$(FONT_NAME).ttf -o ./font
ttf2eot < ./font/$(FONT_NAME).ttf >./font/$(FONT_NAME).eot
package.json: support/font-builder/package.json
ln -s $<
npm-deps: node_modules/underscore
node_modules/underscore: package.json
@if test ! `which npm` ; then \
echo "Node.JS and NPM are required for html demo generation." >&2 ; \
echo "This is non-fatal error and you'll still be able to build font," >&2 ; \
echo "however, to build demo with >> make html << you need:" >&2 ; \
echo " - Install Node.JS and NPM" >&2 ; \
echo " - Run this task once again" >&2 ; \
exti 127; \
fi
: npm install jade js-yaml.bin
npm install
support: support/font-builder/support/ttf2eot/ttf2eot support/font-builder/support/ttfautohint/frontend/ttfautohint npm-deps
support/font-builder/Makefile support/font-builder/package.json:
git submodule init support/font-builder
git submodule update support/font-builder
support/font-builder/support/ttf2eot/ttf2eot support/font-builder/support/ttfautohint/frontend/ttfautohint: support/font-builder/Makefile
$(MAKE) -C support/font-builder
html: font/demo.html font/entypo.css
font/demo.html: support src/demo/demo.jade
tpl-render.js --locals config.yml --input ./src/demo/demo.jade --output ./font/demo.html
font/entypo.css: support src/demo/entypo.css.jade
tpl-render.js --locals config.yml --input ./src/demo/entypo.css.jade --output ./font/entypo.css
gh-pages:
@if test -z ${REMOTE_REPO} ; then \
echo 'Remote repo URL not found' >&2 ; \
exit 128 ; \
fi
cp -r ./font ${TMP_PATH} && \
touch ${TMP_PATH}/.nojekyll
cd ${TMP_PATH} && \
git init && \
git add . && \
git commit -q -m 'refreshed gh-pages'
cd ${TMP_PATH} && \
git remote add remote ${REMOTE_REPO} && \
git push --force remote +master:gh-pages
rm -rf ${TMP_PATH}
dev-deps: support/font-builder/Makefile
$(MAKE) -C support/font-builder $@
apt-get install -f fontforge nodejs
clean:
rm -rf font src/svg src/original support/font-builder node_modules
-test -L package.json && rm package.json
$(MAKE) support/font-builder/Makefile
.PHONY: dist dump font npm-deps support html clean dev-deps