9 # Default values, if not set on the command line when make is invoked:
11 # FONTFILE: Prefix of the file name for input and output files.
12 # FONTNAME: Name of the font inside a TTF file.
13 # PSNAME: PostScript name of the font inside a TTF file; can't have spaces.
14 # COMBINING: Prefix of the file containing a list of combining characters.
22 # The PostScript name of a font can't contain spaces--remove them.
23 # Could also use bash string replacement if you know you're using bash.
26 COPYRIGHT = "Copyright (C) 2014 Roman Czyborra, Paul Hardy, Qianqian Fang, \
27 Andrew Miller, et al. \
28 Licensed under the GNU General Public License; either version 2, or \
29 (at your option) a later version, with the GNU Font Embedding Exception."
31 VERSION = 6.3.20140214
34 # How to build unifont.ttf from GNU Unifont's unifont.hex
35 # -------------------------------------------------------
36 # Written by Luis Alejandro Gonzalez Miranda - http://www.lgm.cl/
40 # 2008 - Paul Hardy created this Makefile from Luis' original
41 # howto-build.sh and other bash scripts. Those original scripts
42 # don't appear in this archive, but they can be retrieved from
46 # First of all, you need a Perl interpreter and FontForge.
48 # I don't remember all the steps, but I think it was as described by
51 # This division is done only so the Simplify and RemoveOverlap
52 # operations don't use up too much memory, and because
53 # a .sfd generated from the whole unifont.hex would be too big to
54 # process all at once.
59 # Commented out this operation on SFD file because not all applications
60 # correctly interpreted the settings:
62 # SetFontNames("UnifontMedium", "GNU", "Unifont", "Medium", $(COPYRIGHT), "$(VERSION)"); \
64 # Convert unifont.hex to unifont.sfd as a single file, then generate
65 # an outline TrueType font.
67 outline: $(FONTFILE).hex $(BINDIR)/hex2sfd
68 echo "Converting font as a single file."
69 $(BINDIR)/hex2sfd $(COMBINING).txt < $(FONTFILE).hex > $(FONTFILE).sfd
70 $(FONTFORGE) -lang=ff -c \
72 SetFontNames("$(PSNAME)Medium", \
73 "$(FONTNAME)", "$(FONTNAME)", "Medium", \
74 $(COPYRIGHT), "$(VERSION)"); \
80 echo "Converting .sfd font into .ttf font"
81 $(FONTFORGE) -lang=ff -c \
83 Generate($$2)' $(FONTFILE).sfd $(FONTFILE).ttf
84 \rm -f $(FONTFILE).hex $(COMBINING).txt
87 # This fontforge script reads a BDF font file and generates an SBIT font file.
88 # Author: written by Qianqian Fang, given to Paul Hardy in 2008.
89 # The SBIT font is far smaller than the default outline TrueType font
90 # and takes far less time to build than the outline font. However, it
91 # isn't scalable. An SBIT font could be created and merged with the
92 # larger TTF font using fontforge, but I (Paul Hardy) haven't noticed
93 # any degradation in the screen rendering of just the outline TTF font
94 # that this Makefile produces as its final product. This is with
95 # daily use of this Makefile's default TrueType font.
97 # This builds an SBIT font from the unifont_sample BDF font. The
98 # BDF font already contains font name, etc., so they don't need to
99 # be set using SetFontNames; those parameters are left null so the
100 # existing font's values will be preserved. However, Fontforge
101 # does not read the FONT_VERSION property so Paul Hardy added the
102 # the SetFontNames call.
104 # Commented out because not all applications correctly interpreted
107 # SetFontNames("","","","","","$(VERSION)"); \
109 sbit: $(FONTFILE).bdf
110 $(FONTFORGE) -lang=ff -c \
113 SetFontNames("","","","","","$(VERSION)"); \
114 Generate($$2, "ttf"); \
116 $(FONTFILE).bdf $(FONTFILE).ttf
117 \rm -f $(FONTFILE).bdf
120 # Delete files copied into this directory to build TTF fonts.
123 \rm -f *.bdf *.hex *.txt
126 # Delete files created within this directory while building TTF fonts.
131 .PHONY: all outline sbit clean distclean