-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.sub
150 lines (112 loc) · 3.23 KB
/
Makefile.sub
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Araragi Font Makefile
#
# Variables
STYLE = Sans
WEIGHT = ExtraLight
ifeq ($(STYLE),Sans)
style = sans
endif
ifeq ($(STYLE),Serif)
style = serif
endif
BIN = bin
name = FontMenuNameDB
VER = Version
OTF = OTF
KYUJI = Kyuji.txt
SRC = src/SourceHan$(STYLE)
SRCfont = $(SRC)/$(WEIGHT)/cidfont.ps.JP
SRCfeat = $(SRC)/$(WEIGHT)/features.JP
SRCinfo = $(SRC)/$(WEIGHT)/cidfontinfo.JP
SRCcmap = $(SRC)/UniSourceHan$(STYLE)JP-UTF32-H
SRCivs = $(SRC)/SourceHan$(STYLE)_JP_sequences.txt
GITHUB = https://raw.githubusercontent.com/adobe-fonts/source-han-$(style)/master
U2CMAP = $(SRC)/uni2cidmap
REPLACE = $(SRC)/ReplaceList.txt
DST = Araragi$(STYLE)
font = $(DST)/$(WEIGHT)/font.ps
feat = $(DST)/$(WEIGHT)/features
info = $(DST)/$(WEIGHT)/info.txt
cmap = $(DST)/UniAraragi$(STYLE)-UTF32-H
version := $(shell cat $(VER))
.PHONY: all
all: $(OTF)/Araragi$(STYLE)-$(WEIGHT).otf
#
# Product
$(OTF)/Araragi$(STYLE)-$(WEIGHT).otf: $(font) $(feat) $(info) $(name) $(cmap)
mkdir -p $(OTF)/
makeotf -f $(font) \
-ff $(feat) \
-fi $(info) \
-mf $(name) -r -nS -cs 1 \
-ch $(cmap) \
-o $(OTF)/Araragi$(STYLE)-$(WEIGHT).otf
#
# Components
$(font): $(SRCfont) $(info)
mkdir -p $(DST)/$(WEIGHT)
fix-fontbbox.pl $(SRCfont) > fixed.ps
mergeFonts -cid $(info) $(font) fixed.ps
-rm -f fixed.ps
$(feat): $(SRCfeat) $(VER)
mkdir -p $(DST)/$(WEIGHT)
$(BIN)/clear-unnecessary-features.pl < $(SRCfeat) \
| $(BIN)/adjust-linegap.sh \
| $(BIN)/copyright.sh \
| sed -e 's/FontRevision .*;/FontRevision $(version);/g' > $(feat)
# todo: vertical letters and symbols
$(info): $(SRCinfo) $(VER)
mkdir -p $(DST)/$(WEIGHT)
$(BIN)/make-info.sh $(SRCinfo) $(version) > $(info)
$(cmap): $(SRCcmap)-EX $(REPLACE)
mkdir -p $(DST)/$(WEIGHT)
$(BIN)/replace.pl $(REPLACE) < $(SRCcmap)-EX \
| sed -e 's/SourceHan$(STYLE)JP/Araragi$(STYLE)/g' \
| cmap-tool.pl > $(cmap)
-rm -f UniAraragi$(STYLE)-UTF16-H UniAraragi$(STYLE)-UTF8-H
#
# Intermediate
$(REPLACE): $(U2CMAP) $(KYUJI)
$(BIN)/make-replacelist.pl $(U2CMAP) < $(KYUJI) > $(REPLACE)
$(U2CMAP): $(SRCcmap)-EX $(SRCivs)
$(BIN)/make-uni2cidmap.sh $(SRCcmap)-EX $(SRCivs) > $(U2CMAP)
$(SRCcmap)-EX: $(SRCcmap)
cmap-tool.pl -e < $(SRCcmap) > $(SRCcmap)-EX
-rm -f UniSourceHan$(STYLE)JP-UTF16-H UniSourceHan$(STYLE)JP-UTF8-H
.PHONY: clean
clean:
-rm -f $(OTF)/Araragi$(STYLE)-$(WEIGHT).otf
-rm -f $(font) $(feat) $(info) $(DST)/$(WEIGHT)/current.fpr
-rmdir $(DST)/$(WEIGHT)
#
# Original Resources
.PHONY: get_resources
get_resources:
$(MAKE) $(SRCfont)
$(MAKE) $(SRCfeat)
$(MAKE) $(SRCinfo)
$(MAKE) $(SRCcmap)
$(MAKE) $(SRCivs)
$(SRCfont):
mkdir -p $(SRC)/$(WEIGHT)/
curl --fail $(GITHUB)/$(WEIGHT)/cidfont.ps.JP > $(SRCfont)
$(SRCfeat):
mkdir -p $(SRC)/$(WEIGHT)/
curl --fail $(GITHUB)/$(WEIGHT)/features.JP > $(SRCfeat)
$(SRCinfo):
mkdir -p $(SRC)/$(WEIGHT)/
curl --fail $(GITHUB)/$(WEIGHT)/cidfontinfo.JP > $(SRCinfo)
$(SRCcmap):
mkdir -p $(SRC)/$(WEIGHT)/
curl --fail $(GITHUB)/UniSourceHan$(STYLE)JP-UTF32-H > $(SRCcmap)
$(SRCivs):
mkdir -p $(SRC)/$(WEIGHT)/
curl --fail $(GITHUB)/SourceHan$(STYLE)_JP_sequences.txt > $(SRCivs)
.PHONY: clean_resources
clean_resources:
-rm -f $(SRCfont) $(SRCfeat) $(SRCinfo)
-rmdir $(SRC)/$(WEIGHT)
.PHONY: clean_all
clean_all:
$(MAKE) clean
$(MAKE) clean_resources