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, 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."
30 VERSION = 6.3.20140202
33 # How to build unifont.ttf from GNU Unifont's unifont.hex
34 # -------------------------------------------------------
35 # Written by Luis Alejandro Gonzalez Miranda - http://www.lgm.cl/
39 # 2008 - Paul Hardy created this Makefile from Luis' original
40 # howto-build.sh and other bash scripts. Those original scripts
41 # don't appear in this archive, but they can be retrieved from
45 # First of all, you need a Perl interpreter and FontForge.
47 # I don't remember all the steps, but I think it was as described by
50 # This division is done only so the Simplify and RemoveOverlap
51 # operations don't use up too much memory, and because
52 # a .sfd generated from the whole unifont.hex would be too big to
53 # process all at once.
58 # Commented out this operation on SFD file because not all applications
59 # correctly interpreted the settings:
61 # SetFontNames("UnifontMedium", "GNU", "Unifont", "Medium", $(COPYRIGHT), "$(VERSION)"); \
63 # Convert unifont.hex to unifont.sfd as a single file, then generate
64 # an outline TrueType font.
66 outline: $(FONTFILE).hex $(BINDIR)/hex2sfd
67 echo "Converting font as a single file."
68 $(BINDIR)/hex2sfd $(COMBINING).txt < $(FONTFILE).hex > $(FONTFILE).sfd
69 $(FONTFORGE) -lang=ff -c \
71 SetFontNames("$(PSNAME)Medium", \
72 "$(FONTNAME)", "$(FONTNAME)", "Medium", \
73 $(COPYRIGHT), "$(VERSION)"); \
79 echo "Converting .sfd font into .ttf font"
80 $(FONTFORGE) -lang=ff -c \
82 Generate($$2)' $(FONTFILE).sfd $(FONTFILE).ttf
83 \rm -f $(FONTFILE).hex $(COMBINING).txt
86 # This fontforge script reads a BDF font file and generates an SBIT font file.
87 # Author: written by Qianqian Fang, given to Paul Hardy in 2008.
88 # The SBIT font is far smaller than the default outline TrueType font
89 # and takes far less time to build than the outline font. However, it
90 # isn't scalable. An SBIT font could be created and merged with the
91 # larger TTF font using fontforge, but I (Paul Hardy) haven't noticed
92 # any degradation in the screen rendering of just the outline TTF font
93 # that this Makefile produces as its final product. This is with
94 # daily use of this Makefile's default TrueType font.
96 # This builds an SBIT font from the unifont_sample BDF font. The
97 # BDF font already contains font name, etc., so they don't need to
98 # be set using SetFontNames; those parameters are left null so the
99 # existing font's values will be preserved. However, Fontforge
100 # does not read the FONT_VERSION property so Paul Hardy added the
101 # the SetFontNames call.
103 # Commented out because not all applications correctly interpreted
106 # SetFontNames("","","","","","$(VERSION)"); \
108 sbit: $(FONTFILE).bdf
109 $(FONTFORGE) -lang=ff -c \
112 SetFontNames("","","","","","$(VERSION)"); \
113 Generate($$2, "ttf"); \
115 $(FONTFILE).bdf $(FONTFILE).ttf
116 \rm -f $(FONTFILE).bdf
119 # Delete files copied into this directory to build TTF fonts.
122 \rm -f *.bdf *.hex *.txt
125 # Delete files created within this directory while building TTF fonts.
130 .PHONY: all outline sbit clean distclean