unifont-8.0.01.tar.gz
[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 = 8.0
22 PKG_REV = 01
23 VERSION = $(UNICODE_VERSION).$(PKG_REV)
24
25 COPYRIGHT = "Copyright (C) 2015 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 \
128            bigpic coverage
129         install -p index.html $(COMPILED_DIR)/index.html
130
131 #
132 # Build the aggregate .hex font files
133 #
134 hex:
135         if [ ! -d $(COMPILED_DIR) ] ; then \
136            mkdir -p $(COMPILED_DIR) ; \
137         fi
138         sort $(UNIFILES) > $(COMPILED_DIR)/unifont-$(VERSION).hex
139         (cd $(HEXDIR) && sort *.hex) | \
140           egrep -v "^FFF[EF]" | \
141            $(BINDIR)/unigencircles $(COMBINING) plane00/nonprinting.hex \
142            > $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
143         sort plane00csur/*.hex $(UNIFILES) \
144            > $(COMPILED_DIR)/unifont_csur-$(VERSION).hex
145         sort $(UPPER_FILES) \
146            > $(COMPILED_DIR)/unifont_upper-$(VERSION).hex
147         sort plane0[1-F]/*.hex plane0[1-F]csur/*.hex \
148            > $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex
149         sort $(UPPER_COMBINING) > $(COMPILED_DIR)/upper_combining.txt
150         sort plane0[1-F]/plane*-nonprinting.hex \
151            > $(COMPILED_DIR)/upper_nonprinting.hex
152         sort plane0[1-F]/*.hex | egrep -v "^..FFF[EF]" | \
153            $(BINDIR)/unigencircles $(COMPILED_DIR)/upper_combining.txt \
154            $(COMPILED_DIR)/upper_nonprinting.hex \
155            > $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).hex
156         # Create a .hex file with all CSUR glyphs, without combining circles
157         sort plane??csur/*.hex \
158            > $(COMPILED_DIR)/unifont_all_csur-$(VERSION).hex
159         # Create a .hex file with all CSUR glyphs, with combining circles
160         sort plane??csur/*combining.txt > $(COMPILED_DIR)/csur_combining.txt
161         $(BINDIR)/unigencircles \
162              $(COMPILED_DIR)/csur_combining.txt \
163              plane00/nonprinting.hex \
164            < $(COMPILED_DIR)/unifont_all_csur-$(VERSION).hex \
165            > $(COMPILED_DIR)/unifont_csur_sample-$(VERSION).hex
166
167 #
168 # Build a BDF font file from the final .hex file.
169 #
170 bdf: hex
171         # First make the default BDF font.  The font name will be "unifont".
172         $(BINDIR)/hex2bdf --version "$(VERSION)" --copyright $(COPYRIGHT) \
173            $(COMPILED_DIR)/unifont-$(VERSION).hex \
174            >$(COMPILED_DIR)/unifont-$(VERSION).bdf
175         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont-$(VERSION).bdf \
176                    >$(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
177         # Now make a version with combining circles.  The font name
178         # will be "unifont_sample" instead of "unifont" to distinguish
179         # it from the default font.
180         $(BINDIR)/hex2bdf --font "Unifont Sample" \
181            --version "$(VERSION)" --copyright $(COPYRIGHT) \
182              $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
183            > $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf
184         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
185                    >$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz
186         # Font with ConScript Unicode Registry (CSUR) glyphs added
187         $(BINDIR)/hex2bdf --font "Unifont CSUR" \
188            --version "$(VERSION)" --copyright $(COPYRIGHT) \
189              $(COMPILED_DIR)/unifont_csur-$(VERSION).hex \
190            > $(COMPILED_DIR)/unifont_csur-$(VERSION).bdf
191         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf \
192                    >$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf.gz
193         # Font with glyphs above Plane 0
194         $(BINDIR)/hex2bdf --font "Unifont Upper" \
195            --version "$(VERSION)" --copyright $(COPYRIGHT) \
196              $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
197            > $(COMPILED_DIR)/unifont_upper-$(VERSION).bdf
198         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf \
199                    >$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf.gz
200         # Font with glyphs above Plane 0 with CSUR glyphs above Plane 0
201         $(BINDIR)/hex2bdf --font "Unifont Upper CSUR" \
202            --version "$(VERSION)" --copyright $(COPYRIGHT) \
203              $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
204            > $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf
205         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf \
206                    >$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf.gz
207         # Font with glyphs above Plane 0 with combining circles added
208         $(BINDIR)/hex2bdf --font "Unifont Upper Sample" \
209            --version "$(VERSION)" --copyright $(COPYRIGHT) \
210              $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).hex \
211            > $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf
212         gzip $(GZFLAGS) <$(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf \
213                    >$(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf.gz
214
215 #
216 # Build a PCF font file from the final .hex file.
217 #
218 pcf: bdf
219         bdftopcf <$(COMPILED_DIR)/unifont-$(VERSION).bdf \
220                  >$(COMPILED_DIR)/unifont-$(VERSION).pcf
221         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont-$(VERSION).pcf
222         bdftopcf <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
223                  >$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
224         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
225         bdftopcf <$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf \
226                  >$(COMPILED_DIR)/unifont_csur-$(VERSION).pcf
227         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_csur-$(VERSION).pcf
228
229
230 # The following are removed from the pcf: target, as PCF fonts
231 # don't support glyphs above Plane 0.
232 #       bdftopcf <$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf \
233 #                >$(COMPILED_DIR)/unifont_upper-$(VERSION).pcf
234 #       gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_upper-$(VERSION).pcf
235 #       bdftopcf <$(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf \
236 #                >$(COMPILED_DIR)/unifont_upper_sample-$(VERSION).pcf
237 #       gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).pcf
238 #       bdftopcf <$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf \
239 #                >$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf
240 #       gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf
241
242 #
243 # Make the PSF (console) font for APL (A Programming Language).
244 #
245 psf: bdf
246         bdf2psf --fb \
247            $(COMPILED_DIR)/unifont-$(VERSION).bdf \
248            psf/apl-equivalents.txt \
249            psf/unifont-apl.txt \
250            512 \
251            $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf
252         gzip $(GZFLAGS) $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf
253
254 #
255 # Print coverage of scripts in Basic Multilingual Plane in .txt file.
256 #
257 # Note: can't use this older version unless unassigned.hex is merged
258 # with the rest of the built unifont-$(VERSION).hex final file.
259 #
260 # coverage: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unicoverage
261 #       $(BINDIR)/unicoverage < $(COMPILED_DIR)/unifont-$(VERSION).hex \
262 #                   > $(COMPILED_DIR)/coverage.txt
263 #
264 # Use this version because "unassigned.hex" isn't part of the final
265 # .hex font by default now:
266 #
267 coverage:
268         sort $(HEXDIR)/*.hex | \
269                 $(BINDIR)/unicoverage > $(COMPILED_DIR)/coverage.txt
270
271 #
272 # Print HTML page coverage in Basic Multilingual Plane in .txt file.
273 #
274 pagecount: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unipagecount
275         $(BINDIR)/unipagecount -l < $(COMPILED_DIR)/unifont-$(VERSION).hex \
276                         > $(COMPILED_DIR)/pagecount.html
277         if [ x$(GRAPHICS) = xbmp ] ; then \
278            sed -i 's/png/bmp/g' $(COMPILED_DIR)/plane00.html ; \
279         fi
280
281 #
282 # Create the .png (Portable Network Graphics) versions of the glyphs.
283 #
284 png: hex $(BINDIR)/unihex2png
285         if [ ! -d $(PNGDIR) ] ; then \
286            mkdir -p $(PNGDIR) ; \
287         fi
288         if [ ! -d $(PNGDIR)/plane00 ] ; then \
289            mkdir -p $(PNGDIR)/plane00 ; \
290         fi
291         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
292            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
293               $(BINDIR)/unihex2png -p 00$$i$$j \
294                  -i $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
295                  -o $(PNGDIR)/plane00/uni00$$i$$j.png ; \
296            done ; \
297         done
298         if [ ! -d $(PNGDIR)/plane01 ] ; then \
299            mkdir -p $(PNGDIR)/plane01 ; \
300         fi
301         # Generate files in plane01/all directory to create PNG files.
302         (cd plane01 && make)
303         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
304            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
305               $(BINDIR)/unihex2png -p 01$$i$$j \
306                  -i plane01/all/plane01-all.hex \
307                  -o $(PNGDIR)/plane01/uni01$$i$$j.png ; \
308            done ; \
309         done
310         if [ ! -d $(PNGDIR)/plane0E ] ; then \
311            mkdir -p $(PNGDIR)/plane0E ; \
312         fi
313         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
314            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
315               $(BINDIR)/unihex2png -p 0E$$i$$j \
316                  -i $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).hex \
317                  -o $(PNGDIR)/plane0E/uni0E$$i$$j.png ; \
318            done ; \
319         done
320         if [ ! -d $(PNGDIR)/csur ] ; then \
321            mkdir -p $(PNGDIR)/csur ; \
322         fi
323         for i in E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF \
324                  F0 F1 F2 F3 F4 F5 F6 F7 F8 ; do \
325               $(BINDIR)/unihex2png -p 00$$i \
326                  -i $(COMPILED_DIR)/unifont_csur_sample-$(VERSION).hex \
327                  -o $(PNGDIR)/csur/uni00$$i.png ; \
328         done
329         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
330            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
331               $(BINDIR)/unihex2png -p 0F$$i$$j \
332                  -i $(COMPILED_DIR)/unifont_csur_sample-$(VERSION).hex \
333                  -o $(PNGDIR)/csur/uni0F$$i$$j.png ; \
334            done ; \
335         done
336         # Create HTML table showing color-coded percent coverage in Plane 0.
337         $(BINDIR)/unipagecount -h < $(COMPILED_DIR)/unifont-$(VERSION).hex \
338                                   > $(COMPILED_DIR)/plane00.html
339         # Create HTML table showing color-coded percent coverage in Plane 1.
340         ../bin/unipagecount -P1 -h < plane01/all/plane01-all.hex \
341            > compiled/plane01.html
342         echo "Done creating $(PNGDIR)"
343
344
345 #
346 # Create the .bmp (Bitmap Graphics) versions of the glyphs.
347 #
348 bmp: hex $(BINDIR)/unihex2bmp
349         if [ ! -d $(BMPDIR) ] ; then \
350            mkdir -p $(BMPDIR) ; \
351         fi
352         if [ ! -d $(BMPDIR)/plane00 ] ; then \
353            mkdir -p $(BMPDIR)/plane00 ; \
354         fi
355         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
356            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
357               $(BINDIR)/unihex2bmp -p00$$i$$j \
358                  < $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
359                  > $(BMPDIR)/plane00/uni00$$i$$j.bmp ; \
360            done ; \
361         done
362         if [ ! -d $(BMPDIR)/plane01 ] ; then \
363            mkdir -p $(BMPDIR)/plane01 ; \
364         fi
365         # Generate files in plane01/all directory to create PNG files.
366         (cd plane01 && make)
367         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
368            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
369               $(BINDIR)/unihex2bmp -p01$$i$$j \
370                  < plane01/all/plane01-all.hex \
371                  > $(BMPDIR)/plane01/uni01$$i$$j.bmp ; \
372            done ; \
373         done
374         if [ ! -d $(BMPDIR)/plane0E ] ; then \
375            mkdir -p $(BMPDIR)/plane0E ; \
376         fi
377         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
378            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
379               $(BINDIR)/unihex2bmp -p0E$$i$$j \
380                  < $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).hex \
381                  > $(BMPDIR)/plane0E/uni0E$$i$$j.bmp ; \
382            done ; \
383         done
384         if [ ! -d $(BMPDIR)/csur ] ; then \
385            mkdir -p $(BMPDIR)/csur ; \
386         fi
387         for i in E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF \
388                  F0 F1 F2 F3 F4 F5 F6 F7 F8 ; do \
389               $(BINDIR)/unihex2bmp -p00$$i \
390                  < $(COMPILED_DIR)/unifont_csur_sample-$(VERSION).hex \
391                  > $(BMPDIR)/csur/uni00$$i.bmp ; \
392         done
393         for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
394            for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
395               $(BINDIR)/unihex2bmp -p0F$$i$$j \
396                  < $(COMPILED_DIR)/unifont_csur_sample-$(VERSION).hex \
397                  > $(BMPDIR)/csur/uni0F$$i$$j.bmp ; \
398            done ; \
399         done
400         # Create HTML table showing color-coded percent coverage in Plane 0.
401         $(BINDIR)/unipagecount -h < $(COMPILED_DIR)/unifont-$(VERSION).hex \
402                                   > $(COMPILED_DIR)/plane00.html
403         sed -i 's/png/bmp/g' $(COMPILED_DIR)/plane00.html ; \
404         # Create HTML table showing color-coded percent coverage in Plane 01.
405         ../bin/unipagecount -P1 -h < plane01/all/plane01-all.hex \
406            > $(COMPILED_DIR)/plane01.html
407         sed -i 's/png/bmp/g' $(COMPILED_DIR)/plane01.html ; \
408         echo "Done creating $(BMPDIR)"
409
410
411 #
412 # Build one bitmap of the entire Unifont as a 4096 x 16 grid.
413 # Use all the .hex files in $(HEXDIR) so we add the contents of
414 # omit.hex (FFFE & FFFF).  Those two glyphs aren't included in the
415 # unifont_sample font because they cause problems with MS Windows,
416 # but we can put them in the picture.
417 #
418 bigpic: $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
419         sort -u $(HEXDIR)/*.hex | \
420            $(BINDIR)/unifontpic -d120 > $(COMPILED_DIR)/unifont-$(VERSION).bmp
421
422 #
423 # Note that $(TTFSRC) must exist, because it contains some source files
424 # Perform a "make && make clean" because ALL of the files would consume
425 # over 200 Megabytes if left around.  The .sfd file is about 100 Megabytes,
426 # and it is created from merging "[0-F].sfd", which take up another 100 MB.
427 #
428
429 ttf:
430         # First, copy the ordinary version, to make a TrueType font.
431         install -p \
432                 $(COMPILED_DIR)/unifont-$(VERSION).hex \
433                 $(TTFSRC)/unifont.hex
434         install -p \
435                 $(HEXDIR)/bmp-combining.txt \
436                 $(TTFSRC)/combining.txt
437         cd $(TTFSRC) && \
438            $(MAKE) FONTFILE="unifont" COMBINING="combining" \
439                 FONTNAME="Unifont" PSNAME="Unifont"
440         mv $(TTFSRC)/unifont.sfd $(COMPILED_DIR)/unifont-$(VERSION).sfd 
441         mv $(TTFSRC)/unifont.ttf \
442                 $(COMPILED_DIR)/unifont-$(VERSION).ttf 
443         # Second, copy unifont_sample.bdf, to make an SBIT font.
444         install -p \
445                 $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
446                 $(TTFSRC)/unifont_sample.bdf
447         cd $(TTFSRC) && \
448            $(MAKE) sbit FONTFILE="unifont_sample" COMBINING="" \
449                 FONTNAME="Unifont Sample" PSNAME="UnifontSample"
450         mv $(TTFSRC)/unifont_sample.ttf \
451                 $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf 
452
453 #
454 # Now build the ConScript Unicode Registry PUA font.
455 #
456 csurttf:
457         install -p \
458                 $(COMPILED_DIR)/unifont_csur-$(VERSION).hex \
459                 $(TTFSRC)/unifont_csur.hex
460         sort -u plane00csur/csur-combining.txt $(HEXDIR)/bmp-combining.txt \
461                 > $(TTFSRC)/combining_csur.txt
462         cd $(TTFSRC) && \
463            $(MAKE) outline FONTFILE="unifont_csur" COMBINING="combining_csur" \
464                 FONTNAME="Unifont CSUR" PSNAME="UnifontCSUR"
465         mv $(TTFSRC)/unifont_csur.sfd \
466                 $(COMPILED_DIR)/unifont_csur-$(VERSION).sfd 
467         mv $(TTFSRC)/unifont_csur.ttf \
468                 $(COMPILED_DIR)/unifont_csur-$(VERSION).ttf 
469         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_csur-$(VERSION).sfd 
470
471 #
472 # Now build the ConScript Unicode Registry PUA font.
473 #
474 upperttf:
475         # First, copy the ordinary version, to make a TrueType font.
476         install -p \
477                 $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
478                 $(TTFSRC)/unifont_upper.hex
479         sort -u $(UPPER_COMBINING) > $(TTFSRC)/combining_upper.txt
480         cd $(TTFSRC) && \
481            $(MAKE) outline FONTFILE="unifont_upper" COMBINING="combining_upper" \
482                 FONTNAME="Unifont Upper" PSNAME="UnifontUpper"
483         mv $(TTFSRC)/unifont_upper.sfd \
484                 $(COMPILED_DIR)/unifont_upper-$(VERSION).sfd 
485         mv $(TTFSRC)/unifont_upper.ttf \
486                 $(COMPILED_DIR)/unifont_upper-$(VERSION).ttf 
487         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_upper-$(VERSION).sfd 
488         # Second, copy unifont_upper_sample.bdf, to make an SBIT font.
489         install -p \
490                 $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf \
491                 $(TTFSRC)/unifont_upper_sample.bdf
492         cd $(TTFSRC) && \
493            $(MAKE) sbit FONTFILE="unifont_upper_sample" COMBINING="" \
494                 FONTNAME="Unifont Upper Sample" PSNAME="UnifontUpperSample"
495         mv $(TTFSRC)/unifont_upper_sample.ttf \
496                 $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).ttf 
497
498
499
500 #
501 # ConScript Unicode Registry PUA font beyond Plane 0.
502 #
503 uppercsurttf:
504         install -p \
505                 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
506                 $(TTFSRC)/unifont_upper_csur.hex
507         sort -u plane0[1-F]/*combining*.txt plane0[1-F]csur/*combining*.txt \
508                 > $(TTFSRC)/combining_upper_csur.txt
509         cd $(TTFSRC) && \
510            $(MAKE) outline FONTFILE="unifont_upper_csur" COMBINING="combining_upper_csur" \
511                 FONTNAME="Unifont Upper CSUR" PSNAME="UnifontUpperCSUR"
512         mv $(TTFSRC)/unifont_upper_csur.sfd \
513                 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).sfd 
514         mv $(TTFSRC)/unifont_upper_csur.ttf \
515                 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf 
516         gzip $(GZFLAGS) $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).sfd 
517
518 #
519 #
520 # Copy the newly created files from $(COMPILED_DIR) to the precompiled/
521 # directory.  This has to be called manually, because the precompiled/
522 # directory usually remains untouched.
523 #
524 precompiled: all
525         \rm -rf precompiled
526         install -m0755 -d precompiled
527         install -m0644 -p $(COMPILED_DIR)/unifont-$(VERSION).hex \
528                           $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz \
529                           $(COMPILED_DIR)/unifont-$(VERSION).pcf.gz \
530                           $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf.gz \
531                           $(COMPILED_DIR)/unifont-$(VERSION).ttf \
532                           $(COMPILED_DIR)/unifont_csur-$(VERSION).pcf.gz \
533                           $(COMPILED_DIR)/unifont_csur-$(VERSION).ttf \
534                           $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
535                           $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz \
536                           $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz \
537                           $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf \
538                           $(COMPILED_DIR)/coverage.txt \
539                           $(COMPILED_DIR)/unifont-$(VERSION).bmp \
540                           $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
541                           $(COMPILED_DIR)/unifont_upper-$(VERSION).ttf \
542                           $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).hex \
543                           $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).ttf \
544                           $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
545                           $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf \
546            precompiled
547
548 # Removed from the "precompiled" target above:
549 # $(COMPILED_DIR)/unifont_upper-$(VERSION).bdf.gz \
550 # $(COMPILED_DIR)/unifont_upper-$(VERSION).pcf.gz \
551 # $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).bdf.gz \
552 # $(COMPILED_DIR)/unifont_upper_sample-$(VERSION).pcf.gz \
553 # $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf.gz \
554 # $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf.gz \
555 #
556
557 #
558 # This is set up for Debian.  Solaris places fonts in
559 # "/usr/share/fonts/TrueType".  Other unices use other directories.
560 # The original font format was BDF, but Debian doesn't use that and
561 # xfs should only need TrueType, so the BDF font isn't installed.
562 #
563 # The TrueType font is about 16 Megabytes.  To avoid duplication,
564 # the fonts are installed as symbolic links back to the original package.
565 # Alternatively, the fonts can be copied to the destination directory
566 # with "install -m0644" or moved there (but "mv" is a destructive
567 # one-time operation).
568 #
569 # After installing the new fonts, register them with X Window System using:
570 #
571 #      xset fp rehash
572 #
573 install:
574         if [ x$(CURDIR) = x ] ; \
575         then \
576            echo "Fatal Error: CURDIR not defined -- define in Makefile." ; \
577            exit 1 ; \
578         fi
579         $(INSTALL) -m0755 -d $(CONSOLEDEST)
580         $(INSTALL) -m0755 -d $(PCFDEST)
581         $(INSTALL) -m0755 -d $(TTFDEST)
582         if [ ! -d $(COMPILED_DIR) ] ; then \
583            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/Unifont-APL8x16-$(VERSION).psf.gz $(CONSOLEDEST)/Unifont-APL8x16.psf.gz ; \
584            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
585            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).pcf.gz $(PCFDEST)/unifont_sample.pcf.gz ; \
586            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_csur-$(VERSION).pcf.gz     $(PCFDEST)/unifont_csur.pcf.gz ; \
587            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).ttf             $(TTFDEST)/unifont.ttf ; \
588            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).ttf      $(TTFDEST)/unifont_sample.ttf ; \
589            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_csur-$(VERSION).ttf        $(TTFDEST)/unifont_csur.ttf ; \
590            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_upper-$(VERSION).ttf       $(TTFDEST)/unifont_upper.ttf ; \
591            $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_upper_csur-$(VERSION).ttf  $(TTFDEST)/unifont_upper_csur.ttf ; \
592         else \
593            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf.gz $(CONSOLEDEST)/Unifont-APL8x16.psf.gz ; \
594            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
595            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz    $(PCFDEST)/unifont_sample.pcf.gz ; \
596            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_csur-$(VERSION).pcf.gz      $(PCFDEST)/unifont_csur.pcf.gz ; \
597            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).ttf              $(TTFDEST)/unifont.ttf ; \
598            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).ttf       $(TTFDEST)/unifont_sample.ttf ; \
599            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_csur-$(VERSION).ttf         $(TTFDEST)/unifont_csur.ttf ; \
600            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_upper-$(VERSION).ttf        $(TTFDEST)/unifont_upper.ttf ; \
601            $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf   $(TTFDEST)/unifont_upper_csur.ttf ; \
602         fi
603
604 clean:
605         \rm -rf $(COMPILED_DIR)/png
606         \rm -f $(COMPILED_DIR)/unifont-$(VERSION).hex
607         \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf
608         \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
609         \rm -f $(COMPILED_DIR)/unifont-$(VERSION).sfd.gz
610         \rm -f *~
611
612 #
613 # Note that distclean leaves precompiled/ alone.  This is intentional.
614 # The .DS files are created under Mac OS X.
615 #
616 distclean:
617         \rm -rf $(COMPILED_DIR)
618         $(MAKE) -C plane01 distclean
619         $(MAKE) -C ttfsrc distclean
620         \rm -f *~
621         \rm -rf .DS* ._.DS*
622
623 .PHONY: all hex bdf pcf coverage pagecount png bigpic csurttf upper ttf \
624         precompiled install clean distclean 
625