00efbd0c10bc44d6e5321163b557d51b46d3c346
[unifont.git] / font / Makefile
1 #
2 # Makefile to build a version of GNU Unifont with the
3 # unifoundry.com GNU Unifont utilities.  This Makefile
4 # converts unifont-$(VERSION).hex and related files into a final
5 # GNU Unifont font file.
6 #
7 # This software is released under version 2.0 of the GNU Public License,
8 # or (at your option) a later version of the GPL.
9 #
10 # Paul Hardy, 7 July 2008
11 #
12 # commands will be interpreted with the Bourne Shell
13 #
14 SHELL = /bin/sh
15 INSTALL = install
16 GZFLAGS = -f -9 -n
17 FONTFORGE = fontforge
18 #
19 # assembly date of this version
20 #
21 UNICODE_VERSION = 7.0
22 PKG_REV = 06
23 VERSION = $(UNICODE_VERSION).$(PKG_REV)
24
25 COPYRIGHT = "Copyright (C) 2014 Roman Czyborra, Paul Hardy, Qianqian Fang, \
26 Andrew Miller, et al.  \
27 Licensed under the GNU General Public License; either version 2, or \
28 (at your option) a later version, with the GNU Font Embedding Exception."
29
30 #
31 # Path to local unifont-bin utilities.  If your system doesn't
32 # use GNU's version of "make", use the first BINDIR definition.
33 # If using GNU's "make", use the second BINDIR definition.
34 #
35 # BINDIR = ../bin
36 BINDIR = $(CURDIR)/../bin
37 #
38 # The top-level directory for installing fonts on the system,
39 # and the installation directories for PCF and TrueType fonts.
40 #
41 CONSOLEDEST = $(DESTDIR)/usr/share/consolefonts
42 FONTDEST    = $(DESTDIR)/usr/share/fonts
43 PCFDEST     = $(FONTDEST)/X11/misc
44 TTFDEST     = $(FONTDEST)/truetype/unifont
45 #
46 # destination directory for compiled fonts
47 #
48 COMPILED_DIR = compiled
49 #
50 # destination directory for .bmp or .png representation of font
51 #
52 BMPDIR = $(COMPILED_DIR)/bmp
53 PNGDIR = $(COMPILED_DIR)/png
54
55 # Choose one graphics format or neither.
56 GRAPHICS=png
57 # GRAPHICS=bmp
58 #
59 # Directory with original unifont-$(VERSION).hex files
60 #
61 HEXDIR = plane00
62 #
63 # These are the files for building GNU Unifont with the Qianqian Fang's
64 # Wen Quan Yi CJK ideographs.  This version provides complete coverage
65 # of the Unicode Basic Multilingual Plane.
66 #
67 # If you want don't want to inlcude blank glyphs in unassigned code points,
68 # uncomment the UNASSIGNED definition or override from the make command line.
69 #
70 # Likewise, uncomment the PUA definiation if you want to use Private
71 # Use Area glyphs.
72 #
73 UNASSIGNED = $(HEXDIR)/unassigned.hex
74 # UNASSIGNED =
75
76 #
77 # Non-printing glyphs.  There are only about 100 of these, and many end
78 # users do want to print representations of these glyphs, so they are
79 # included as an optional assignment.
80 #
81 NONPRINTING = $(HEXDIR)/nonprinting.hex
82 # NONPRINTING =
83
84 #
85 # Private Use Area glyphs.  Uncomment to include four-digit hexadecimal glyphs
86 # or override from the make command line.
87 #
88 # PUA = $(HEXDIR)/pua.hex
89 PUA = 
90
91 # The remaining .hex files will be constant unless a customized font
92 # is being built.
93 UNIFONTBASE = $(HEXDIR)/unifont-base.hex
94 CJK         = $(HEXDIR)/wqy.hex
95 HANGUL      = $(HEXDIR)/hangul-syllables.hex
96 SPACES      = $(HEXDIR)/spaces.hex
97
98 UNIFILES = $(UNIFONTBASE) $(CJK) $(HANGUL) $(SPACES) $(UNASSIGNED) \
99            $(NONPRINTING) $(PUA)
100
101 #
102 # Planes 1 through 14 (0x0E) are ordinary;
103 # Planes 15 (0x0F) and 16 (0x10) are Private Use Area
104 #
105 UPPER_FILES = plane0[1-E]/*.hex
106
107 #
108 # Location of the file containing a list of Unicode combining characters.
109 #
110 COMBINING = plane00/bmp-combining.txt
111
112 UPPER_COMBINING = plane0[0-E]/*combining*.txt
113
114 VPATH = plane00 ttfsrc
115
116 #
117 # Location of  TTF source directory, where TTF font is built.
118 #
119 TTFSRC = ttfsrc
120
121
122 all: compiled
123
124 compiled: $(UNIFILES) $(COMBINING) $(UPPER_FILES) $(UPPER_COMBINING)
125         $(MAKE) compiled-files
126
127 compiled-files: pcf psf $(GRAPHICS) ttf csurttf upperttf uppercsurttf bigpic coverage
128         install -p index.html $(COMPILED_DIR)/index.html
129
130 #
131 # Build the aggregate .hex font files
132 #
133 hex: distclean
134         if [ ! -d $(COMPILED_DIR) ] ; then \
135            mkdir -p $(COMPILED_DIR) ; \
136         fi
137         sort $(UNIFILES) > $(COMPILED_DIR)/unifont-$(VERSION).hex
138         (cd $(HEXDIR) && sort *.hex) | \
139           egrep -v "^FFF[EF]" | \
140            $(BINDIR)/unigencircles $(COMBINING) plane00/nonprinting.hex \
141            > $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
142         sort plane00csur/*.hex $(UNIFILES) \
143            > $(COMPILED_DIR)/unifont_csur-$(VERSION).hex
144         sort $(UPPER_FILES) \
145            > $(COMPILED_DIR)/unifont_upper-$(VERSION).hex
146         sort plane0[1-F]/*.hex plane0[1-F]csur/*.hex \
147            > $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex
148         sort $(UPPER_COMBINING) > $(COMPILED_DIR)/upper_combining.txt
149         sort plane0[1-F]/plane*-nonprinting.hex \
150            > $(COMPILED_DIR)/upper_nonprinting.hex
151         sort plane0[1-F]/*.hex | egrep -v "^..FFF[EF]" | \
152            $(BINDIR)/unigencircles $(COMPILED_DIR)/upper_combining.txt \
153            $(COMPILED_DIR)/upper_nonprinting.hex \
154            > $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).hex
155         # Create a .hex file with all CSUR glyphs, without combining circles
156         sort plane??csur/*.hex \
157            > $(COMPILED_DIR)/unifont_all_csur-$(VERSION).hex
158         # Create a .hex file with all CSUR glyphs, with combining circles
159         sort plane??csur/*combining.txt > $(COMPILED_DIR)/csur_combining.txt
160         $(BINDIR)/unigencircles \
161              $(COMPILED_DIR)/csur_combining.txt \
162              plane00/nonprinting.hex \
163            < $(COMPILED_DIR)/unifont_all_csur-$(VERSION).hex \
164            > $(COMPILED_DIR)/unifont_csur_sample-$(VERSION).hex
165
166 #
167 # Build a BDF font file from the final .hex file.
168 #
169 bdf: hex
170         # First make the default BDF font.  The font name will be "unifont".
171         $(BINDIR)/hex2bdf --version "$(VERSION)" --copyright $(COPYRIGHT) \
172            $(COMPILED_DIR)/unifont-$(VERSION).hex \
173            >$(COMPILED_DIR)/unifont-$(VERSION).bdf
174         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont-$(VERSION).bdf \
175                    >$(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
176         # Now make a version with combining circles.  The font name
177         # will be "unifont_sample" instead of "unifont" to distinguish
178         # it from the default font.
179         $(BINDIR)/hex2bdf --font "Unifont Sample" \
180            --version "$(VERSION)" --copyright $(COPYRIGHT) \
181              $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
182            > $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf
183         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
184                    >$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz
185         # Font with ConScript Unicode Registry (CSUR) glyphs added
186         $(BINDIR)/hex2bdf --font "Unifont CSUR" \
187            --version "$(VERSION)" --copyright $(COPYRIGHT) \
188              $(COMPILED_DIR)/unifont_csur-$(VERSION).hex \
189            > $(COMPILED_DIR)/unifont_csur-$(VERSION).bdf
190         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf \
191                    >$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf.gz
192         # Font with glyphs above Plane 0
193         $(BINDIR)/hex2bdf --font "Unifont Upper" \
194            --version "$(VERSION)" --copyright $(COPYRIGHT) \
195              $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
196            > $(COMPILED_DIR)/unifont_upper-$(VERSION).bdf
197         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf \
198                    >$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf.gz
199         # Font with glyphs above Plane 0 with CSUR glyphs above Plane 0
200         $(BINDIR)/hex2bdf --font "Unifont Upper CSUR" \
201            --version "$(VERSION)" --copyright $(COPYRIGHT) \
202              $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
203            > $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf
204         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf \
205                    >$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf.gz
206         # Font with glyphs above Plane 0 with combining circles added
207         $(BINDIR)/hex2bdf --font "Unifont Upper Sample" \
208            --version "$(VERSION)" --copyright $(COPYRIGHT) \
209              $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).hex \
210            > $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf
211         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf \
212                    >$(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf.gz
213
214 #
215 # Build a PCF font file from the final .hex file.
216 #
217 pcf: bdf
218         bdftopcf <$(COMPILED_DIR)/unifont-$(VERSION).bdf \
219                  >$(COMPILED_DIR)/unifont-$(VERSION).pcf
220         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont-$(VERSION).pcf
221         bdftopcf <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
222                  >$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
223         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
224         bdftopcf <$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf \
225                  >$(COMPILED_DIR)/unifont_csur-$(VERSION).pcf
226         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_csur-$(VERSION).pcf
227         bdftopcf <$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf \
228                  >$(COMPILED_DIR)/unifont_upper-$(VERSION).pcf
229         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_upper-$(VERSION).pcf
230         bdftopcf <$(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf \
231                  >$(COMPILED_DIR)/unifont_upper_sample-$(VERSION).pcf
232         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).pcf
233         bdftopcf <$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf \
234                  >$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf
235         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf
236
237 #
238 # Make the PSF (console) font for APL (A Programming Language).
239 #
240 psf: bdf
241         bdf2psf --fb \
242            $(COMPILED_DIR)/unifont-$(VERSION).bdf \
243            psf/apl-equivalents.txt \
244            psf/unifont-apl.txt \
245            512 \
246            $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf
247         gzip $(GZFLAGS) $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf
248
249 #
250 # Print coverage of scripts in Basic Multilingual Plane in .txt file.
251 #
252 # Note: can't use this older version unless unassigned.hex is merged
253 # with the rest of the built unifont-$(VERSION).hex final file.
254 #
255 # coverage: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unicoverage
256 #       $(BINDIR)/unicoverage < $(COMPILED_DIR)/unifont-$(VERSION).hex \
257 #                   > $(COMPILED_DIR)/coverage.txt
258 #
259 # Use this version because "unassigned.hex" isn't part of the final
260 # .hex font by default now:
261 #
262 coverage:
263         sort $(HEXDIR)/*.hex | \
264                 $(BINDIR)/unicoverage > $(COMPILED_DIR)/coverage.txt
265
266 #
267 # Print HTML page coverage in Basic Multilingual Plane in .txt file.
268 #
269 pagecount: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unipagecount
270         $(BINDIR)/unipagecount -l < $(COMPILED_DIR)/unifont-$(VERSION).hex \
271                         > $(COMPILED_DIR)/pagecount.html
272         if [ x$(GRAPHICS) = xbmp ] ; then \
273            sed -i 's/png/bmp/g' $(COMPILED_DIR)/plane00.html ; \
274         fi
275
276 #
277 # Create the .png (Portable Network Graphics) versions of the glyphs.
278 #
279 png: hex $(BINDIR)/unihex2png
280         if [ ! -d $(PNGDIR) ] ; then \
281            mkdir -p $(PNGDIR) ; \
282         fi
283         if [ ! -d $(PNGDIR)/plane00 ] ; then \
284            mkdir -p $(PNGDIR)/plane00 ; \
285         fi
286         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
287            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
288               $(BINDIR)/unihex2png -p 00$$i$$j \
289                  -i $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
290                  -o $(PNGDIR)/plane00/uni00$$i$$j.png ; \
291            done ; \
292         done
293         if [ ! -d $(PNGDIR)/plane01 ] ; then \
294            mkdir -p $(PNGDIR)/plane01 ; \
295         fi
296         # Generate files in plane01/all directory to create PNG files.
297         (cd plane01 && make)
298         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
299            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
300               $(BINDIR)/unihex2png -p 01$$i$$j \
301                  -i plane01/all/plane01-all.hex \
302                  -o $(PNGDIR)/plane01/uni01$$i$$j.png ; \
303            done ; \
304         done
305         if [ ! -d $(PNGDIR)/plane0E ] ; then \
306            mkdir -p $(PNGDIR)/plane0E ; \
307         fi
308         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
309            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
310               $(BINDIR)/unihex2png -p 0E$$i$$j \
311                  -i $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).hex \
312                  -o $(PNGDIR)/plane0E/uni0E$$i$$j.png ; \
313            done ; \
314         done
315         if [ ! -d $(PNGDIR)/csur ] ; then \
316            mkdir -p $(PNGDIR)/csur ; \
317         fi
318         for i in E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF \
319                  F0 F1 F2 F3 F4 F5 F6 F7 F8 ; do \
320               $(BINDIR)/unihex2png -p 00$$i \
321                  -i $(COMPILED_DIR)/unifont_csur_sample-$(VERSION).hex \
322                  -o $(PNGDIR)/csur/uni00$$i.png ; \
323         done
324         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
325            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
326               $(BINDIR)/unihex2png -p 0F$$i$$j \
327                  -i $(COMPILED_DIR)/unifont_csur_sample-$(VERSION).hex \
328                  -o $(PNGDIR)/csur/uni0F$$i$$j.png ; \
329            done ; \
330         done
331         # Create HTML table showing color-coded percent coverage in Plane 0.
332         $(BINDIR)/unipagecount -h < $(COMPILED_DIR)/unifont-$(VERSION).hex \
333                                   > $(COMPILED_DIR)/plane00.html
334         # Create HTML table showing color-coded percent coverage in Plane 1.
335         ../bin/unipagecount -P1 -h < plane01/all/plane01-all.hex \
336            > compiled/plane01.html
337         echo "Done creating $(PNGDIR)"
338
339
340 #
341 # Create the .bmp (Bitmap Graphics) versions of the glyphs.
342 #
343 bmp: hex $(BINDIR)/unihex2bmp
344         if [ ! -d $(BMPDIR) ] ; then \
345            mkdir -p $(BMPDIR) ; \
346         fi
347         if [ ! -d $(BMPDIR)/plane00 ] ; then \
348            mkdir -p $(BMPDIR)/plane00 ; \
349         fi
350         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
351            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
352               $(BINDIR)/unihex2bmp -p00$$i$$j \
353                  < $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
354                  > $(BMPDIR)/plane00/uni00$$i$$j.bmp ; \
355            done ; \
356         done
357         if [ ! -d $(BMPDIR)/plane01 ] ; then \
358            mkdir -p $(BMPDIR)/plane01 ; \
359         fi
360         # Generate files in plane01/all directory to create PNG files.
361         (cd plane01 && make)
362         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
363            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
364               $(BINDIR)/unihex2bmp -p01$$i$$j \
365                  < plane01/all/plane01-all.hex \
366                  > $(BMPDIR)/plane01/uni01$$i$$j.bmp ; \
367            done ; \
368         done
369         if [ ! -d $(BMPDIR)/plane0E ] ; then \
370            mkdir -p $(BMPDIR)/plane0E ; \
371         fi
372         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
373            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
374               $(BINDIR)/unihex2bmp -p0E$$i$$j \
375                  < $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).hex \
376                  > $(BMPDIR)/plane0E/uni0E$$i$$j.bmp ; \
377            done ; \
378         done
379         if [ ! -d $(BMPDIR)/csur ] ; then \
380            mkdir -p $(BMPDIR)/csur ; \
381         fi
382         for i in E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF \
383                  F0 F1 F2 F3 F4 F5 F6 F7 F8 ; do \
384               $(BINDIR)/unihex2bmp -p00$$i \
385                  < $(COMPILED_DIR)/unifont_csur_sample-$(VERSION).hex \
386                  > $(BMPDIR)/csur/uni00$$i.bmp ; \
387         done
388         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
389            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
390               $(BINDIR)/unihex2bmp -p0F$$i$$j \
391                  < $(COMPILED_DIR)/unifont_csur_sample-$(VERSION).hex \
392                  > $(BMPDIR)/csur/uni0F$$i$$j.bmp ; \
393            done ; \
394         done
395         # Create HTML table showing color-coded percent coverage in Plane 0.
396         $(BINDIR)/unipagecount -h < $(COMPILED_DIR)/unifont-$(VERSION).hex \
397                                   > $(COMPILED_DIR)/plane00.html
398         sed -i 's/png/bmp/g' $(COMPILED_DIR)/plane00.html ; \
399         # Create HTML table showing color-coded percent coverage in Plane 01.
400         ../bin/unipagecount -P1 -h < plane01/all/plane01-all.hex \
401            > $(COMPILED_DIR)/plane01.html
402         sed -i 's/png/bmp/g' $(COMPILED_DIR)/plane01.html ; \
403         echo "Done creating $(BMPDIR)"
404
405
406 #
407 # Build one bitmap of the entire Unifont as a 4096 x 16 grid.
408 # Use all the .hex files in $(HEXDIR) so we add the contents of
409 # omit.hex (FFFE & FFFF).  Those two glyphs aren't included in the
410 # unifont_sample font because they cause problems with MS Windows,
411 # but we can put them in the picture.
412 #
413 bigpic: $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
414         sort -u $(HEXDIR)/*.hex | \
415            $(BINDIR)/unifontpic -d120 > $(COMPILED_DIR)/unifont-$(VERSION).bmp
416
417 #
418 # Note that $(TTFSRC) must exist, because it contains some source files
419 # Perform a "make && make clean" because ALL of the files would consume
420 # over 200 Megabytes if left around.  The .sfd file is about 100 Megabytes,
421 # and it is created from merging "[0-F].sfd", which take up another 100 MB.
422 #
423
424 ttf:
425         # First, copy the ordinary version, to make a TrueType font.
426         install -p \
427                 $(COMPILED_DIR)/unifont-$(VERSION).hex \
428                 $(TTFSRC)/unifont.hex
429         install -p \
430                 $(HEXDIR)/bmp-combining.txt \
431                 $(TTFSRC)/combining.txt
432         cd $(TTFSRC) && \
433            $(MAKE) FONTFILE="unifont" COMBINING="combining" \
434                 FONTNAME="Unifont" PSNAME="Unifont"
435         mv $(TTFSRC)/unifont.sfd $(COMPILED_DIR)/unifont-$(VERSION).sfd 
436         mv $(TTFSRC)/unifont.ttf \
437                 $(COMPILED_DIR)/unifont-$(VERSION).ttf 
438         # Second, copy unifont_sample.bdf, to make an SBIT font.
439         install -p \
440                 $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
441                 $(TTFSRC)/unifont_sample.bdf
442         cd $(TTFSRC) && \
443            $(MAKE) sbit FONTFILE="unifont_sample" COMBINING="" \
444                 FONTNAME="Unifont Sample" PSNAME="UnifontSample"
445         mv $(TTFSRC)/unifont_sample.ttf \
446                 $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf 
447
448 #
449 # Now build the ConScript Unicode Registry PUA font.
450 #
451 csurttf:
452         install -p \
453                 $(COMPILED_DIR)/unifont_csur-$(VERSION).hex \
454                 $(TTFSRC)/unifont_csur.hex
455         sort -u plane00csur/csur-combining.txt $(HEXDIR)/bmp-combining.txt \
456                 > $(TTFSRC)/combining_csur.txt
457         cd $(TTFSRC) && \
458            $(MAKE) outline FONTFILE="unifont_csur" COMBINING="combining_csur" \
459                 FONTNAME="Unifont CSUR" PSNAME="UnifontCSUR"
460         mv $(TTFSRC)/unifont_csur.sfd \
461                 $(COMPILED_DIR)/unifont_csur-$(VERSION).sfd 
462         mv $(TTFSRC)/unifont_csur.ttf \
463                 $(COMPILED_DIR)/unifont_csur-$(VERSION).ttf 
464         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_csur-$(VERSION).sfd 
465
466 #
467 # Now build the ConScript Unicode Registry PUA font.
468 #
469 upperttf:
470         # First, copy the ordinary version, to make a TrueType font.
471         install -p \
472                 $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
473                 $(TTFSRC)/unifont_upper.hex
474         sort -u $(UPPER_COMBINING) > $(TTFSRC)/combining_upper.txt
475         cd $(TTFSRC) && \
476            $(MAKE) outline FONTFILE="unifont_upper" COMBINING="combining_upper" \
477                 FONTNAME="Unifont Upper" PSNAME="UnifontUpper"
478         mv $(TTFSRC)/unifont_upper.sfd \
479                 $(COMPILED_DIR)/unifont_upper-$(VERSION).sfd 
480         mv $(TTFSRC)/unifont_upper.ttf \
481                 $(COMPILED_DIR)/unifont_upper-$(VERSION).ttf 
482         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_upper-$(VERSION).sfd 
483         # Second, copy unifont_upper_sample.bdf, to make an SBIT font.
484         install -p \
485                 $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf \
486                 $(TTFSRC)/unifont_upper_sample.bdf
487         cd $(TTFSRC) && \
488            $(MAKE) sbit FONTFILE="unifont_upper_sample" COMBINING="" \
489                 FONTNAME="Unifont Upper Sample" PSNAME="UnifontUpperSample"
490         mv $(TTFSRC)/unifont_upper_sample.ttf \
491                 $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).ttf 
492
493
494
495 #
496 # ConScript Unicode Registry PUA font beyond Plane 0.
497 #
498 uppercsurttf:
499         install -p \
500                 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
501                 $(TTFSRC)/unifont_upper_csur.hex
502         sort -u plane0[1-F]/*combining*.txt plane0[1-F]csur/*combining*.txt \
503                 > $(TTFSRC)/combining_upper_csur.txt
504         cd $(TTFSRC) && \
505            $(MAKE) outline FONTFILE="unifont_upper_csur" COMBINING="combining_upper_csur" \
506                 FONTNAME="Unifont Upper CSUR" PSNAME="UnifontUpperCSUR"
507         mv $(TTFSRC)/unifont_upper_csur.sfd \
508                 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).sfd 
509         mv $(TTFSRC)/unifont_upper_csur.ttf \
510                 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf 
511         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).sfd 
512
513 #
514 #
515 # Copy the newly created files from $(COMPILED_DIR) to the precompiled/
516 # directory.  This has to be called manually, because the precompiled/
517 # directory usually remains untouched.
518 #
519 precompiled: all
520         \rm -rf precompiled
521         install -m0755 -d precompiled
522         install -m0644 -p $(COMPILED_DIR)/unifont-$(VERSION).hex \
523                           $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz \
524                           $(COMPILED_DIR)/unifont-$(VERSION).pcf.gz \
525                           $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf.gz \
526                           $(COMPILED_DIR)/unifont-$(VERSION).ttf \
527                           $(COMPILED_DIR)/unifont_csur-$(VERSION).pcf.gz \
528                           $(COMPILED_DIR)/unifont_csur-$(VERSION).ttf \
529                           $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
530                           $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz \
531                           $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz \
532                           $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf \
533                           $(COMPILED_DIR)/coverage.txt \
534                           $(COMPILED_DIR)/unifont-$(VERSION).bmp \
535                           $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
536                           $(COMPILED_DIR)/unifont_upper-$(VERSION).bdf.gz \
537                           $(COMPILED_DIR)/unifont_upper-$(VERSION).pcf.gz \
538                           $(COMPILED_DIR)/unifont_upper-$(VERSION).ttf \
539                           $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).hex \
540                           $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf.gz \
541                           $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).pcf.gz \
542                           $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).ttf \
543                           $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
544                           $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf.gz \
545                           $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf.gz \
546                           $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf \
547            precompiled
548
549 #
550 # This is set up for Debian.  Solaris places fonts in
551 # "/usr/share/fonts/TrueType".  Other unices use other directories.
552 # The original font format was BDF, but Debian doesn't use that and
553 # xfs should only need TrueType, so the BDF font isn't installed.
554 #
555 # The TrueType font is about 16 Megabytes.  To avoid duplication,
556 # the fonts are installed as symbolic links back to the original package.
557 # Alternatively, the fonts can be copied to the destination directory
558 # with "install -m0644" or moved there (but "mv" is a destructive
559 # one-time operation).
560 #
561 # After installing the new fonts, register them with X Window System using:
562 #
563 #      xset fp rehash
564 #
565 install:
566         if [ x$(CURDIR) = x ] ; \
567         then \
568            echo "Fatal Error: CURDIR not defined -- define in Makefile." ; \
569            exit 1 ; \
570         fi
571         $(INSTALL) -m0755 -d $(CONSOLEDEST)
572         $(INSTALL) -m0755 -d $(PCFDEST)
573         $(INSTALL) -m0755 -d $(TTFDEST)
574         if [ ! -d $(COMPILED_DIR) ] ; then \
575            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/Unifont-APL8x16-$(VERSION).psf.gz $(CONSOLEDEST)/Unifont-APL8x16.psf.gz ; \
576            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
577            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).pcf.gz $(PCFDEST)/unifont_sample.pcf.gz ; \
578            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_csur-$(VERSION).pcf.gz     $(PCFDEST)/unifont_csur.pcf.gz ; \
579            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).ttf             $(TTFDEST)/unifont.ttf ; \
580            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).ttf      $(TTFDEST)/unifont_sample.ttf ; \
581            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_csur-$(VERSION).ttf        $(TTFDEST)/unifont_csur.ttf ; \
582            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_upper-$(VERSION).ttf       $(TTFDEST)/unifont_upper.ttf ; \
583            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_upper_csur-$(VERSION).ttf  $(TTFDEST)/unifont_upper_csur.ttf ; \
584         else \
585            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf.gz $(CONSOLEDEST)/Unifont-APL8x16.psf.gz ; \
586            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
587            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz    $(PCFDEST)/unifont_sample.pcf.gz ; \
588            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_csur-$(VERSION).pcf.gz      $(PCFDEST)/unifont_csur.pcf.gz ; \
589            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).ttf              $(TTFDEST)/unifont.ttf ; \
590            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).ttf       $(TTFDEST)/unifont_sample.ttf ; \
591            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_csur-$(VERSION).ttf         $(TTFDEST)/unifont_csur.ttf ; \
592            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_upper-$(VERSION).ttf        $(TTFDEST)/unifont_upper.ttf ; \
593            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf   $(TTFDEST)/unifont_upper_csur.ttf ; \
594         fi
595
596 clean:
597         \rm -rf $(COMPILED_DIR)/png
598         \rm -f $(COMPILED_DIR)/unifont-$(VERSION).hex
599         \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf
600         \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
601         \rm -f $(COMPILED_DIR)/unifont-$(VERSION).sfd.gz
602         \rm -f *~
603
604 #
605 # Note that distclean leaves precompiled/ alone.  This is intentional.
606 # The .DS files are created under Mac OS X.
607 #
608 distclean:
609         \rm -rf $(COMPILED_DIR)
610         $(MAKE) -C plane01 distclean
611         $(MAKE) -C ttfsrc distclean
612         \rm -f *~
613         \rm -rf .DS* ._.DS*
614
615 .PHONY: all hex bdf pcf coverage pagecount png bigpic csurttf upper ttf \
616         precompiled install clean distclean 
617