-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile_HanaMin
113 lines (85 loc) · 3.88 KB
/
Makefile_HanaMin
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
# GlyphWiki Font Generator -*- mode: Makefile -*-
PROG = .
PERL = perl
SCRIPTS = $(HOME)/.ghq/github.com/adobe-type-tools/perl-scripts
PS2PDF = ps2pdf
version = $(shell date "+%y.%j")
sub = A
# If you set "-S" to the following variable, makeotf will subroutinze, but it will take a long time.
subrtnz =
# ---
BASE = HanaMin$(sub)
work = ./$(BASE).work
.PHONY: all otf proof pdf all clean distclean
# ---
dump.tar.gz:
wget http://glyphwiki.org/dump.tar.gz
HalfwidthGlyphs.txt:
wget -O HalfwidthGlyphs.txt 'http://glyphwiki.org/get_source.cgi?name=Group:HalfwidthGlyphs'
NonSpacingGlyphs-Halfwidth.txt:
wget -O NonSpacingGlyphs-Halfwidth.txt 'http://glyphwiki.org/get_source.cgi?name=Group:NonSpacingGlyphs-Halfwidth'
Blocks.txt:
wget http://www.unicode.org/Public/UNIDATA/Blocks.txt
# 漢文 (U+319X) には '-vert' を追記。
dump_all_versions.txt dump_newest_only.txt: dump.tar.gz
tar xvfz dump.tar.gz dump_all_versions.txt dump_newest_only.txt
touch dump_all_versions.txt
$(PERL) -i -pe 's/^( u319[-0-9a-z]*)(.*)$$/\1\2\n\1-vert\2/' dump_newest_only.txt
# ---
# 下記は HanaMinXX.sfont も作成。
$(BASE).list $(BASE).fmndb $(BASE).cidinfo: Blocks.txt dump_newest_only.txt
emacs --script $(PROG)/gw-list.el $(version)
# cask exec emacs --script $(PROG)/gw-list.el $(version)
# 空白文字を追記し、ufff[ef]を削除。
$(BASE).map $(BASE).alias $(BASE).source: dump_all_versions.txt dump_newest_only.txt $(BASE).list
$(PERL) $(PROG)/dumpucs.pl $(BASE)
$(PERL) -pi -e '$$_="" if /^0ufff[ef]/' $(BASE).source
echo "0u0020 0:0:0:0\n0u3000 0:0:0:0" >> $(BASE).source
$(BASE).svg: $(BASE).source
-rm -rf $(work)
rhino $(PROG)/makesvg.js $(BASE)
for file in $(work)/*.svg; do $(PERL) unionpoly.pl $$file; done
$(PERL) $(PROG)/makeSVGFont.pl $(BASE) >$(BASE).log 2>$(BASE).err
$(BASE).pfa: $(BASE).svg HalfwidthGlyphs.txt NonSpacingGlyphs-Halfwidth.txt
ruby makeSVG-half.rb $(BASE).svg $(BASE).map
tx -t1 $(BASE).svg $(BASE).pfa >>$(BASE).log 2>>$(BASE).err
$(BASE).dump: $(BASE).pfa
tx -dump $(BASE).pfa > $(BASE).dump
$(BASE).cmap $(BASE).ivs $(BASE).cidmap $(BASE).features $(BASE).html: $(BASE).map $(BASE).alias $(BASE).dump
emacs --script $(PROG)/gw-afdko.el $(BASE) >>$(BASE).log 2>>$(BASE).err
emacs --script $(PROG)/fix-features.el $(BASE).features
sed -e s/\$$version/$(version)/ $(PROG)/template.tables >> $(BASE).features
$(PERL) $(SCRIPTS)/cmap-tool.pl < $(BASE).cmap > $(BASE).tmp.cmap
mv $(BASE).tmp.cmap $(BASE).cmap
$(BASE).raw: $(BASE).cidinfo $(BASE).cidmap $(BASE).pfa
mergeFonts -cid $(BASE).cidinfo $(BASE).raw $(BASE).cidmap $(BASE).pfa >>$(BASE).log 2>>$(BASE).err
# checkOutlines -e -k -O -x $(BASE).pfa >/dev/null 2>>$(BASE).err
$(BASE).hinted.raw: $(BASE).raw
$(PERL) $(SCRIPTS)/hintcidfont.pl $(PROG)/hintparam.txt < $(BASE).raw > $(BASE).hinted.raw
autohint -r -q $(BASE).hinted.raw >>$(BASE).log 2>>$(BASE).err
$(BASE).otf: $(BASE).fmndb $(BASE).ivs $(BASE).cmap $(BASE).hinted.raw $(BASE).features
makeotf $(subrtnz) -newNameID4 -mf $(BASE).fmndb -cs 1 -ci \
$(BASE).ivs -ch $(BASE).cmap -f $(BASE).hinted.raw -ff \
$(BASE).features -o $@
$(BASE).pdf: $(BASE).otf
tx -pdf $(BASE).otf > $(BASE).pdf
$(BASE).proof.pdf: $(BASE).otf
spot -Proof $(BASE).otf | $(PS2PDF) - $(BASE).proof.pdf
$(BASE).tar.xz: $(BASE).otf $(BASE).html $(BASE).proof.pdf $(BASE).pdf
if [ -s $(BASE).proof.pdf ]; then \
tar cvfJ $(BASE).tar.xz $(BASE).otf $(BASE).html $(BASE).proof.pdf $(BASE).pdf $(BASE).cmap ; \
else \
tar cvfJ $(BASE).tar.xz $(BASE).otf $(BASE).html $(BASE).pdf $(BASE).cmap ; \
fi
otf: $(BASE).otf
proof: $(BASE).proof.pdf
pdf: $(BASE).pdf
clean:
-rm -rf $(work)
find . \( -name "$(BASE).*" -not -name "*.pdf" -not -name "*.otf" -not -name "*.tar.xz" \) -exec rm {} \;
-rm -f checkOutlines.log* current.fpr
-rm -f Blocks.txt HalfwidthGlyphs.txt NonSpacingGlyphs-Halfwidth.txt
-rm -f dump*.txt dump.tar.gz
distclean: clean
-rm -rf $(BASE).*
-rm -rf *.sfont