1 \input texinfo @c -*-texinfo-*-
3 @setfilename unifont.info
10 This tutorial describes Unifont, a bitmap-based font covering the
11 Unicode Basic Multilingual Plane, and its utility programs.
13 Copyright @copyright{} 2008--2013 Paul Hardy
16 Permission is granted to copy, distribute and/or modify this document
17 under the terms of the GNU Free Documentation License, Version 1.3 or
18 any later version published by the Free Software Foundation; with no
19 Invariant Sections, with no Front-Cover Texts and no Back-Cover Texts.
27 * Unifont (unifont). A bitmap-based font covering the Unicode BMP.
35 @vskip 0pt plus 1filll
44 @node Top, Introduction, (dir), (dir)
47 * Introduction:: General overview.
48 * Tutorial:: Tutorial on Unifont utilities and Unifont modification.
49 * Reference:: Detailed description of each Unifont utility.
53 @node Introduction, Tutorial, Top, Top
57 This document describes the process of using the GNU Unifont utilities
58 to create a font. The steps described in the "Using Graphical Tools"
59 section in the "Tutorial" chapter are more or less the steps that
60 I (Paul Hardy) followed to add thousands of glyphs to GNU Unifont,
61 except that I didn't have the luxury of just typing @code{make}
62 to make a new font while adding those glyphs.
64 I streamlined the font build process after I was done drawing the
67 I know that plain ASCII text is *so* last millennium, especially for
68 a package related to Unicode. Yet ASCII can be read with anything;
71 If you have questions, please email
72 @code{unifoundry@@unifoundry.com}.
73 You can check for the latest Unifont news at
74 @code{http://savannah.gnu.org/projects/unifont} and
75 @code{http://unifoundry.com}.
76 You can also submit a bug report through the
77 @code{http://savannah.gnu.org/projects/unifont} page.
79 DISCLAIMER: Donald Knuth warned in his Metafont book that if someone
80 started designing type, they would never again be able to look at
81 a page of text normally and just read its content. There is a
82 point of no return beyond which a serious font designer begins
83 looking at how individual letters in a font on a page are drawn,
84 and how they might be improved. Be warned!
87 --- Paul Hardy (@code{unifoundry@@unifoundry.com}) 2008, 2013
90 @node Tutorial, Reference, Introduction, Top
93 This chapter provides a step-by-step tutorial on using the Unifont
94 utility programs to modify a font in the GNU Unifont format.
97 * Unicode:: Brief Overview of The Unicode Standard.
98 * Unifont Structure:: The format of Unifont files.
99 * Hex File Format:: The @code{unifont.hex} file format.
100 * Using Graphical Tools:: The Unifont graphical utilities.
101 * Using Hexdraw:: The Unifont ASCII utility for text editors.
102 * Checking Coverage:: Checking Unicode Basic Multilingual Plane coverage.
103 * Custom Builds:: Customizing the composition of a Unifont derivative.
104 * Seeing the Big Picture (Literally!):: Creating a Unifont poster.
105 * Combining Circles:: Glyphs with zero width.
106 * Installing Fonts on GNU/Linux:: font installation on Unix/Linux.
107 * Creating a Brand New Font:: advice on adding a new Unicode script.
108 * Updates to Unicode:: modifying Unifont for Unicode updates.
111 @node Unicode, Unifont Structure, Tutorial, Tutorial
115 Unicode is an international standard to encode all the world's
116 scripts with one universal scheme. Unicode is the default encoding
117 for web pages and is gaining popularity in many other applications.
118 To learn more about Unicode, look at code charts, and see the
119 latest developments, check out
125 Unifont follows the Unicode encoding scheme. Unicode
126 defines the numeric value of a character, but does not define
127 one particular font. There can be (and are) many fonts that
128 support a subset of Unicode characters.
130 In 1998, Roman Czyborra observed that there was still no font,
131 free or commercial, with complete Unicode coverage. He envisioned
132 a low-quality bitmapped font as an easy way to produce a font
133 that covered much of the Unicode standard.
136 @node Unifont Structure, Hex File Format, Unicode, Tutorial
137 @section Unifont Structure
140 GNU Unifont is a dual-width pixel font. Roman Czyborra
141 began this font in 1998 with a goal of having one glyph
142 rendered for each visible character in the Unicode Basic
143 Multilingual Plane (Plane 0, the first 65,536 characters).
144 His original writing on this is at @code{http://czyborra.com/unifont/}.
146 (Note that the term "character" is used very loosely here for
147 simplicity; the Unicode Standard has a stricter definition
148 of what constitutes a character.)
150 The font is dual-width. Each character is 16 pixels tall, and
151 either 8 or 16 pixels wide. The characters are stored in a
152 unique .hex file format invented by Roman Czyborra as a convenient
153 way of giving each character exactly a one line specification.
154 Conversion between this .hex format and BDF font format is trivial.
157 @node Hex File Format, Using Graphical Tools, Unifont Structure, Tutorial
158 @section Hex File Format
161 By convention, files containing the Unifont native font format
162 have the extension ".hex". Their format is extremely simple, consisting
163 of two fields separated with a colon (":") and ending with a newline.
165 The first field is the Unicode code point, in hexadecimal. For all
166 Plane 0 code points, this is a four digit hexadecimal number. Hexadecimal
167 digits are (in order) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E,
168 and F. The Unicode Standard uses a hexadecimal number to assign
169 each character a location. These locations are called "code points"
170 and their range is 0 through 10FFFF, inclusive.
172 The range 0 through FFFF, inclusive, is called the Basic Multilingual
173 Plane (BMP), or Plane 0. This plane contains glyphs for most of
174 the world's modern writing scripts.
176 Because the original goal of GNU Unifont was to cover the entire
177 Unicode Basic Multilingual Plane, a four digit hexadecimal number
178 suffices. In the future, I plan to allow the utilities to go beyond
179 the BMP now that coverage of the Unicode BMP is finally complete.
181 The programs will probably handle glyphs beyond the BMP properly, but
182 that capability is considered experimental, as the focus was to cover
183 the BMP. The C programs allow up to an eight digit hexadecimal code
184 point, but not all the utilities have been thoroughly tested beyond
187 The second field is a string of hexadecimal digits. There are 32
188 digits for a character that is 8 pixels wide, and 64 digits for a
189 character that is 16 pixels wide.
191 The good news is you don't have to worry about these long digit
192 strings. Roman Czyborra wrote a utility, @code{hexdraw}, to convert
193 .hex fonts to a form that can be edited with a plain text editor,
194 then converted back into .hex format.
196 Paul Hardy wrote two utilities to do the same thing except with
197 bitmapped graphics images for editing with a graphics editor:
198 @code{unihex2bmp} converts a block of 256 characters into a graphics
199 file, and @code{unibmp2hex} converts such a graphics file back into
200 .hex format. These bitmaps display the 256 characters in a block
201 arranged in a 16 by 16 character grid. The graphics editor must
202 maintain the image as a monochrome (black and white) file, with
203 one bit per pixel. After conversion from a .bmp file back to
204 a .hex file, the next step is conversion to a BDF font file. A BDF
205 file can only encode a pixel being on or off (i.e., black or white
206 only with no intermediate shades of gray).
208 Andrew Miller later converted @code{unihex2bmp} and @code{unibmp2hex}
209 to Perl, then transformed them into
210 @code{unihex2png} and @code{unipng2hex}, respectively. These programs
211 convert Unifont .hex files to and from Portable Network Graphics files.
214 @node Using Graphical Tools, Using Hexdraw, Hex File Format, Tutorial
215 @section Hex File Format
218 Let's look at an example. Suppose you want to modify the Coptic letters
219 in the range U+2C80..U+2CFF ("U+" is Unicode shorthand). These
220 letters are in the upper half of the block U+2C00..U+2CFF. The
221 Unicode utilities in this package refer to this as "page" 2C.
222 ("Page" is not a Unicode term --- it is just a term unique to this
223 package to refer to a block of 256 code points/characters).
225 The steps to follow will be:
229 Convert .hex version of the page 2C range as a 16 by 16
233 Modify the bitmap in any graphics editor, being careful
234 to re-save it as a Windows Bitmap (.bmp) or Wireless
235 Bitmap file when finished.
238 Convert the modified bitmap back into a .hex font file.
241 Merge the results with the original @code{unifont.hex} file
242 (or whatever its name might be).
245 Run @code{unidup} on the resulting file to guard against
246 duplicate character definitions.
249 Create the new bitmapped version of the font.
252 Check the compiled font for duplicates.
255 If there are duplicates, remove them and go back to Step 5.
258 Create the new TrueType version or other versions of the font.
262 @strong{Step 1:} Convert the .hex range into a bitmap grid.
263 Assuming our font file is named @code{unifont.hex}, type
266 unihex2bmp -p2C < unifont.hex > uni2C.bmp
269 @strong{Step 2:} Modify @code{uni2C.bmp} with your favorite graphics editor.
270 Note that whatever graphics editor you use must preserve the
271 file as a black and white bitmap (monochrome), with one bit
272 per pixel. During editing, you can draw guidelines outside
273 the actual 16x16 font pixel area; they will be ignored when
274 converting back into .hex format. You can also erase the
275 grid borders between code points on purpose or by accident,
276 and it will have no effect on the generated .hex file. Just
277 don't erase the code point numbers on the outer edges of
278 the grid. The conversion from .bmp back to .hex only looks
279 at the "U+0000" in the upper left-hand corner of the bitmap graphic
280 and other code point numbers, and at each code point's
281 16x16 pixel area inside its 32x32 pixel grid area. Every other
282 artifact in the final graphics file outside these areas is ignored.
284 If a new version of Unicode adds glyphs to a page that were
285 previously unassigned, be sure to remove the newly-assigned
286 code points from the @code{unassigned.hex} file because the code
287 point is no longer unassigned.
289 @strong{Step 3:} Convert the edited .bmp file back into .hex format:
292 unibmp2hex < uni2C.bmp > uni2C.hex
296 Note that the conversion from a bitmap image to a .hex file
297 can't distinguish between a legitimate single- or double-width
298 space character and a code point that does not have an assigned
299 value. Therefore, space glyphs are separately contained in the
300 @code{spaces.hex} file.
302 @strong{Step 4:} Merge the results with the original @code{unifont.hex} file.
303 This requires several sub-steps:
307 Edit the original @code{unifont.hex} file and delete the
308 lines that begin with "2C".
311 Insert the @code{uni2C.hex} file into @code{unifont.hex}, either with
312 a text editor such as @code{emacs} or @code{vi}, or with a GNU/Linux
316 sort uni2C.hex unifont.hex > new-unifont.hex
319 This second option (using @code{sort}) is preferred, because
320 @code{unidup} (in Step 5) might miss duplicate code points
321 if your final result isn't in proper order.
326 @strong{Step 5:} Make sure there are no duplicates with @code{unidup}:
336 unidup < new-unifont.hex
340 depending on the name of your final font file. If there
341 is no output, your modified font contains no duplicates.
343 This editing is best done on an input .hex file, such as
344 @code{unifont-base.hex}.
346 @strong{Step 6:} Create the new bitmapped version of the font. In the
347 @code{font/} directory, type
353 @strong{Step 7:} Check the compiled font for duplicates. Change to the
354 @code{font/compiled/} directory and run
357 unidup < mynewfontfile.hex
361 for whatever font file you created.
363 @strong{Step 8:} If there are duplicates, remove them in the @code{font/}
364 directory and go back to Step 5.
366 @strong{Step 9:} Create the new TrueType version of the font and all other
367 bitmapped versions. From the @code{font/} directory, type
370 make distclean && make
374 Then be prepared to wait a long time unless you are using
375 a computer with plenty of RAM and CPU horsepower. Your
376 computer should have at least 256 Megabytes of virtual
377 memory (RAM), and at least 250 Megabytes of free disk space.
379 To only create a BDF font, in the @code{font/} directory just type
385 To only create a BDF and PCF font, in the @code{font/} directory type
391 Creating a BDF font is the first step in creating a PCF font
392 (not counting generating the compiled master ".hex" input file).
393 BDF fonts can be created just with the tools in this package.
394 PCF fonts are created by running @code{bdftopcf} on the BDF font.
395 TrueType fonts require FontForge.
397 The Unifont package also includes two new programs
398 for working with Portable Network Graphics (PNG) files instead
399 of BMP files. These utilities are @code{unihex2png} and
400 @code{unipng2hex}. They work in a similar manner to the corresponding
401 programs @code{unihex2bmp} and @code{unibmp2hex}, respectively.
403 To use @code{unihex2png} instead of @code{unihex2bmp}, continuing
404 the example of the Coptic script in the U+2Cxx range, type:
407 unihex2png -p2C -i unifont.hex -o uni2C.png
410 Note that with @code{unihex2bmp} specifying input and output files
411 is optional, while with @code{unihex2png} they must be specified
412 explicitly. More specifically, @code{unihex2png} will read a .hex
413 file format input from STDIN if no "-i" argument is specified,
414 but the name of the binary PNG file must always be specified with
417 Then edit the resulting PNG file to your heart's content. When done,
418 convert the file back into a @code{unifont.hex} format file. In
422 unipng2hex -i uni2C.png -o uni2C.hex
425 Similar to @code{unihex2png}, the binary PNG file must be specified
426 with "-i" but the .hex format file will be written to STDOUT if the
427 "-o" option is omitted.
429 Finally, merge your changes in with your main .hex font file as
430 described previously in this section.
433 @node Using Hexdraw, Checking Coverage, Using Graphical Tools, Tutorial
434 @section Using Hexdraw
437 Roman Czyborra's original utility to edit glyphs is the @code{hexdraw}
438 Perl script. Using the same script as in the previous chapter, Coptic,
439 here are the steps for modifying @code{unifont.hex} using @code{hexdraw}.
441 First, realize that Unifont has tens of thousands of glyphs
442 (characters, using the term character loosely). In this example,
443 out of the tens of thousands of glyphs, we want to modify the range
444 U+2C80..U+2CFF (only 128 glyphs).
446 The range U+2C80..U+2CFF could be extracted from @code{unifont.hex} by
447 using the @code{egrep} utility to look for lines beginning with "2C8"
448 through "2CF", or that range could be isolated by copying @code{unifont.hex}
449 into another file, and deleting all lines except the desired range.
451 The following steps will probably minimize typographical errors,
452 but they aren't the only way.
456 "Grep" the desired block of 256 glyphs (using the @code{grep} utility)
457 and convert this into a text representation for editing.
460 Edit the block with a text editor, such as @code{emacs} or @code{vi}.
463 Convert the edited text file back into .hex format.
466 Delete the edited block range from the original font file.
469 Merge the two .hex files into one file.
472 Check for duplicates with @code{unidup}.
475 Generate new fonts as described in the "Using Graphical Tools" section above.
479 @strong{Step 1:} Extract the desired block with @code{grep}:
482 grep "^2C" unifont.hex | hexdraw > uni2C.txt
485 @strong{Step 2:} Edit @code{uni2C.txt} with a text editor.
487 @strong{Step 3:} Convert the text file back into .hex format:
490 hexdraw < uni2C.txt > uni2C.hex
493 @strong{Step 4:} Delete the lines in the original @code{unifont.hex}
494 file that begin with "2C".
496 @strong{Step 5:} Merge the two files:
499 sort unifont.hex uni2C.hex > new-unifont.hex
503 or use Roman's @code{hexmerge} utility:
506 hexmerge unifont.hex uni2C.hex > new-unifont.hex
509 @strong{Step 6:} Check for duplicates:
512 unidup < new-unifont.hex
516 Of course, remove any reported duplicates.
518 @strong{Step 7:} Build the font as in the "Using Graphical Tools" section
519 above. This can be as simple as typing
526 in the @code{font/} directory.
528 I (Paul Hardy) had only used @code{hexdraw} in the very beginning of my
529 work on Unifont. Once I got my graphics programs working,
530 I ignored it for months. Then I wanted to go through all of the
531 Yi Syllables and Yi Radicals --- over 1000 glyphs --- to fine-tune
532 their horizontal alignment after I drew them. @code{hexdraw} turned out
533 to be the perfect tool for this. By printing hyphens ("-") as
534 place holders where a pixel is off, it allowed me to verify space
535 to the left and right of each character. I later used @code{hexdraw}
536 for similar fine-tuning of spacing on Hangul and other glyphs.
537 It is ideal for the task.
540 @node Checking Coverage, Custom Builds, Using Hexdraw, Tutorial
541 @section Checking Coverage
544 There should never be duplicates in a .hex file. If there are, remove
545 them before the .hex font is turned into a BDF or other font file. The
546 recommendations above include making liberal use of @code{unidup} to avoid
549 The @code{unipagecount} program will print a hexadecimal number of code
550 points that have coverage within each 256 code point block. The
551 hexadecimal number will therefore range from 0 (no coverage) to
552 100 (= 256 decimal; full coverage). If a number is ever more than
553 100 hexadecimal, there's an extra character (glyph) for that page.
555 To further look at the coverage within just one 256 code point
556 page (using page 2C, containing Coptic, as our example) use
559 unipagecount -p2C < unifont.hex
562 Note that the "page number" can use upper- or lower-case letters:
563 @code{-p2C} or @code{-p2c} will both work. That will print a 16 x 16 grid
564 of U+2C00..U+2CFF. Of course, without placeholder glyphs for the
565 unassigned code points from @code{unassigned.hex} in the U+2C00..U+2CFF
566 range, unipagecount can give a lower number than the true coverage.
568 Using the @code{-l} flag with @code{unipagecount} will produce an HTML
569 table with links to corresponding graphics images. You can get
570 an idea of how this works in the @code{font/compiled/} directory after
571 running @code{make}; the @code{index.html} file in that directory will have
572 a table with links to the 256 glyph maps in the @code{font/compiled/bmp/}
575 With @code{unipagecount}, the background color of the cells will range from
576 red (for 0% complete in that 256 code point block) to orange
577 (a little coverage) to yellow (more coverage) to green
578 (complete coverage). If a cell looks light red or pink,
579 the corresponding code page probably has duplicate characters.
583 sort unifont.hex | unidup
587 (substituting the name of your .hex file for @code{unifont.hex}).
589 To see the coverage of each Unicode script, copy the file
590 @code{font/coverage.dat} into the same directory as the
591 @code{unifont.hex} file you're examining. Then run
594 unicoverage < unifont.hex > coverage.out
597 This will give you all the scripts within the Unicode Basic
598 Multilingual Plane, in order, with a percentage (0.0% through
599 100.0%) of each script's coverage. Note that to get the true
600 coverage of assigned code points, you'll have to merge @code{unassigned.hex}
601 with the rest of @code{unifont.hex} if not done by default in your setup.
603 Using the .hex files in @code{font/hexsrc/}, you can create a font with
604 all available glyphs with
607 sort font/hexsrc/*.hex >unifont-whole.hex
611 and run @code{unicoverage} using the resulting @code{unifont-whole.hex} file.
614 @node Custom Builds, Seeing the Big Picture (Literally!), Checking Coverage, Tutorial
615 @section Custom Builds
618 The font can be built from within the @code{font/} directory by simply typing
625 From the top-level directory (one level above the @code{font/} directory),
633 will also build the font. The font is not built by default by typing
634 @code{make} from the top-level directory, because a pre-built version
635 already exists in the @code{font/precompiled/} directory. Font files
636 are architecture-independent, so the only reason to build the font is
637 if you modify its composition.
639 By default, source glyphs are read from the @code{font/hexsrc/} directory.
640 Glyphs for unassigned code points are built into the font by default,
641 but glyphs for Private Use Area code points are not built into the font.
643 All of the .hex file names can be replaced selectively on the
644 @code{make} command line to override their default values.
645 Their locations are relative to the @code{font/} directory.
646 The list of component hex file variables is:
651 The bulk of Unifont scripts
654 Most of the CJK Ideographs
657 Hangul Syllables block
660 Space glyphs, single- and double-width
663 Glyphs for unassigned code points
666 Glyphs for the Private Use Area
670 So, for example, to build a font that includes four-digit hexadecimal
671 code point glyphs (as white digits on a black background) for the
672 Private Use Area, type
675 make PUA="hexsrc/pua.hex"
679 because those glyphs reside in the @code{font/hexsrc/pua.hex} file.
681 To build a font that includes your own special PUA glyphs, type
684 make PUA="mycoolPUA.hex"
688 or whatever the name of your PUA glyph .hex file is named.
690 To create a build that includes the supplied PUA glyphs but not the
691 unassigned code point glyphs, type
694 make PUA="hexsrc/pua.hex" UNASSIGNED=""
697 If you create a custom font build of your own in one gigantic file,
698 you can build with just this file by declaring all the ordinary files
702 make UNIFONTBASE="mycustomfont.hex" \ @*
703 CJK="" HANGUL="" UNASSIGNED="" PUA=""
706 Note that this command did not include an override for the glyphs for spaces
707 contained in the @code{font/hexsrc/spaces.hex} file; that is, the variable
708 SPACES was not redefined on the command line. You could also pass the
709 argument SPACES="", but just be aware that those spaces glyphs are in
710 a separate file for a reason. When graphical (".bmp") glyph files are
711 converted back into hex string (".hex") format, the @code{unibmp2hex} utility
712 doesn't know if a blank glyph area is a space glyph or not, so it doesn't
713 encode anything. The @code{font/hexsrc/spaces.hex} file contains glyphs that
714 are strings of 0s, with length depending on whether the space is nominally
715 a single- or double-width space. (Unifont does not distinguish between
716 finer spacing used in traditional typesetting, such as a thin space, en space,
717 em space, or quad space; all spaces are either 8 pixels wide or 16 pixels
721 @node Seeing the Big Picture (Literally!), Combining Circles, Custom Builds, Tutorial
722 @section Seeing the Big Picture (Literally!)
725 The GNU Unifont 6.3 release introduced a new program, @code{unifontpic}.
726 This produces a chart of all the Basic Multilingual Plane glyphs in
727 Unifont. By default the chart is arranged as a 256-by-256 glyph
728 table. Specifying the @code{-l} option produces a chart that is
729 16 glyphs wide by 4,096 glyphs long. See unifontpic(1) for more
732 The "long" version, created with @code{unifontpic -l}, only produces
733 16 glyphs per row. This is more useful for scrolling through on
736 GIMP, the GNU Image Manipulation Program, will properly display
737 the resulting long .bmp file (at least under GNOME), but not all
738 graphics utilities can. The output file is over 65,536 pixel rows tall,
739 which causes problems with some graphics programs.
741 To generate a chart with all your glyphs in one giant @code{unifont.hex}
742 file, type the command
745 unifontpic < unifont.hex > unifont.bmp
749 The output is a monochrome Bitmap Graphics Format (.bmp) file.
750 If you prefer PNG files, use your favorite graphics program or
751 conversion program to convert the BMP file to a PNG file.
753 This utility is especially useful if you're customizing the font,
754 for example if adding your own Private Use Area glyphs.
756 The default 256-by-256 code point chart will render satisfactorily
757 on a sheet of paper approximately 3 feet by 3 feet (1 meter by 1 meter)
758 at 120 dots per inch. Thus the square format is suitable for printing.
761 @node Combining Circles, Installing Fonts on GNU/Linux, Seeing the Big Picture (Literally!), Tutorial
762 @section Combining Circles
765 The earliest versions of Unifont (before the 5.1 release) used glyphs
766 that showed dashed circles for combining characters. This is how the
767 glyphs appear in The Unicode Standard code charts. In version 5.1,
768 Paul Hardy was able to get combining characters to appear superimposed
769 correctly in the TrueType version of the font. There are no plans
770 to try to get combining characters to work in a BDF or PCF version
771 owing to the limitations of those bitmapped font formats.
773 With combining characters working, Paul Hardy created variations of
774 Unifont with and without combining circles, the idea being that the
775 version without combining circles would be used to create the TrueType
776 font. The variation with combining circles was kept for reference.
778 Unifont Version 6.2 simplified the build to produce only one font variation,
779 without combining circles.
781 Unifont Version 6.3 introduced a new utility, @code{unigencircles},
782 to superimpose combining circles over glyphs with code points in
783 a @code{combining.txt} file.
785 The latest Unifont release contains a parallel set of font files
786 named @code{unifont_sample.*}. These "Unifont Sample" font files
787 contain glyphs with combining circles where appropriate. The
788 "Unifont Sample" font is therefore not intended for general-purpose
789 writing, but only for illustrating each individual glyph as represented
790 in The Unicode Standard.
792 To run @code{unigencircles}, start with the file
793 @code{font/ttfsrc/combining.txt} and type a command of this form:
796 unigencircles combining.txt < unifont.hex > unifont-circles.hex
800 where @code{unifont.hex} is a single file containing all the glyphs you
801 wish to render. You could create such a file from the @code{font/}
802 directory with the command
805 sort hexsrc/*.hex >unifont.hex
808 Because the output is another .hex file, you can use all Unifont
809 utilities with this resulting file just as you would with the .hex files
810 in @code{font/hexsrc/}.
812 If you want to build a font from this generated @code{unifont.hex} file,
816 make UNIFONTBASE="unifont-circles.hex" CJK="" HANGUL="" \ @*
821 as discussed above. In this case, if you included
822 @code{font/hexsrc/spaces.hex} in the @code{unifont.hex} input file,
823 you should also set SPACES="" on the command line so that you only
824 read in your final custom @code{unifont-circles.hex} file.
827 @node Installing Fonts on GNU/Linux, Creating a Brand New Font, Combining Circles, Tutorial
828 @section Installing Fonts on GNU/Linux
831 The original standard font format of Unifont was a BDF font. The newer
832 PCF font format loads much faster when a program begins, and so is preferable
833 for installations using the X Window System and similar environments.
835 Compress PCF fonts using
841 Copy the resulting @code{fontname.pcf.gz} file to
842 @code{/usr/share/fonts/X11/misc/} or place in a
843 local font directory if your windowing software supports that (for
844 example, @code{~/.fonts/}).
846 Copy TrueType fonts to @code{/usr/share/fonts/truetype/} uncompressed or place
847 in your local font directory. Note: on some versions of Unix, such as
848 Solaris, the name of the TrueType directory might be TrueType and
849 might be under @code{/usr/share/fonts/X11/} --- examine the system fonts
850 directories, then modify the font @code{make install} rule accordingly.
852 On most flavors of GNU/Linux with the latest @code{xset} utility (including
853 the latest Debian and Red Hat releases), the following command should
854 allow you to start using the font immediately:
860 The safest way to make sure the system knows about the new fonts will
861 be to restart the X Window System or even reboot.
864 @node Creating a Brand New Font, Updates to Unicode, Installing Fonts on GNU/Linux, Tutorial
865 @section Creating a Brand New Font
868 The original tools will only produce glyphs that are 16 pixels tall, and
869 either 8 or 16 pixels wide. The utilities @code{unihex2png},
870 @code{unipng2hex}, @code{hexdraw}, and @code{hex2bdf} now also support
871 glyph heights of 24 and 32 pixels, and glyph widths of up to 32 pixels,
872 but this is not fully tested. These new dimensions are currently
873 available for experimental use. See the respective sections for each
874 of these programs in the Reference chapter of this document, or their
875 respective man pages.
877 This current release is furthermore only fully
878 tested over the Unicode Basic Multilingual Plane (code points from
879 U+0000 through U+FFFF, with none above that range --- this will change
880 in the future). The tools can be used to create and manipulate
881 any bitmapped font within those constraints.
883 To create a brand new font (or even to add a new script to Unifont
884 in the future), plan out the basic dimensions of the characters:
889 How far above the lowest pixel will the baseline appear
890 (in other words, how many rows are necessary for descenders
891 such as in the glyphs for `g', `q', and `y')?
894 How many pixels must be empty on top and bottom for accents
895 (in other words, what will the height of capital letters be)?
898 Must glyphs be centered, left-aligned, or right-aligned?
901 For a Latin font, what will the "x-height" be (the height of
902 a lower-case "x" and related letters, such as "n" and "r")?
906 Consistent capital heights, x-heights, descender depths, and centering
907 will produce a better looking font. Look over the entire script and
908 plan out a template grid that is consistent for the entire script.
909 Then use that template for each glyph you draw for the script.
911 Unifont characters for the most part leave the right-most column
912 of pixels blank if possible for left-to-right scripts. Centering is
913 done around the fourth pixel (if a glyph is eight pixels wide) or
914 around the eighth pixel (if a glyph is 16 pixels wide).
916 Experimenting and (above all) having fun with these utilities is
917 the best way to learn.
920 @node Updates to Unicode, , Creating a Brand New Font, Tutorial
921 @section Updates to Unicode
924 If a currently unassigned code point is assigned to a character
925 in the future, the font can be updated as follows:
930 Delete the code point's entry from @code{font/hexsrc/unassigned.hex},
931 as that code point will no longer be unassigned.
934 Determine which existing .hex file should contain the
935 newly defined character (examine the files to see
936 which one contains other glyphs in the script.
941 @code{unifont-base.hex} contains most scripts
944 @code{wqy.hex} contains most CJK ideographs; its name pays homage
945 to the Wen Quan Yi font, the source of almost all of its glyphs
948 @code{hangul-syllables.hex} contains the Hangul Syllables block
949 (U+AC00..U+D7A3); this should never have new code points added as
950 it covers the fixed range of the Unicode Hangul Syllables block
953 @code{spaces.hex} contains the list of single- and double-width spaces
957 If in doubt (for example, if a new script is added to
958 Unicode and you're not sure which .hex file to augment),
959 add the new glyphs to @code{unifont-base.hex}.
962 Update the appropriate .hex file.
965 Consider if @code{font/coverage.dat} has to be updated.
966 Follow its existing format to insert a new script,
967 being sure to change any previously unassigned ranges
968 before or after the newly added script.
971 Make a new .hex version of the font, and verify that
972 you didn't introduce any duplicates.
975 Run @code{unipagecount} and/or @code{unicoverage} as described
976 previously to verify that you have not mistakenly deleted
977 any existing characters.
984 @node Reference, , Tutorial, Top
1011 @include bdfimplode.texi
1012 @include hex2bdf.texi
1013 @include hex2sfd.texi
1014 @include hexbraille.texi
1015 @include hexdraw.texi
1016 @include hexmerge.texi
1017 @include johab2ucs2.texi
1018 @include unibdf2hex.texi
1019 @include unibmp2hex.texi
1020 @include unicoverage.texi
1021 @include unidup.texi
1022 @include unifontchojung.texi
1023 @include unifontksx.texi
1024 @include unifontpic.texi
1025 @include unigencircles.texi
1026 @include unigenwidth.texi
1027 @include unihex2bmp.texi
1028 @include unihex2png.texi
1029 @include unihexgen.texi
1030 @include unipagecount.texi
1031 @include unipng2hex.texi