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