1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @node Modifying the feta font
3 @chapter Modifying the feta font
6 * Overview of the feta font::
7 * Font creation tools::
8 * Adding a new font section::
10 * Building the changed font::
11 * METAFONT formatting rules::
14 @node Overview of the feta font
15 @section Overview of the feta font
17 The feta font is a font that was created specifically for use in
18 LilyPond. The sources for the font are found in mf/*.mf.
20 The feta font is merged from a number of subfonts. Each subfont
21 can contain at most 224 glyphs. This is because each subfont is
22 limited to a one-byte address space (256 glyphs maximum) and we
23 avoid the first 32 points in that address space, since they are
24 non-printing control characters in ASCII.
26 In LilyPond, glyphs are accessed by glyph name, rather than by code point.
27 Therefore, the naming of glyphs is significant.
29 Information about correctly creating glyphs is found in @file{mf/README}.
30 Please make sure you read and understand this file.
32 TODO -- we should get mf/README automatically generated from texinfo source
36 @node Font creation tools
37 @section Font creation tools
39 The sources for the feta font are written in metafont. The definitive
40 reference for metafont is "The METAFONT book". Source for the book is
43 mf2pt1 is used to create type 1 fonts from the metafont sources.
45 FontForge is used to postprocess the output of mf2pt1 and clean up
46 details of the font. It can also be used by a developer to
47 display the resulting glyph shapes.
49 @node Adding a new font section
50 @section Adding a new font section
52 The font is divided into sections, each of which contains less
53 than 224 glyphs. If more than 224 glyphs are included in a section,
54 an error will be generated.
56 Each of the sections is contained in a separate @code{.mf} file. The
57 files are named according to the type of glyphs in that section.
59 When adding a new section, it will be necessary to add the following:
63 The code for the glyphs, in a file @code{<section-name>.mf}
65 Driver files used to create the font in different sizes
67 An entry in the generic file used to create the font, or a new
70 If necessary, new entries in the GNUmakefile
72 An entry in @file{scripts/build/gen-emmentaler-scripts.py}
75 See the examples in @code{mf/} for more information.
77 @node Adding a new glyph
78 @section Adding a new glyph
80 Adding a new glyph is done by modifying the .mf file to which the
83 Necessary functions to draw the glyph can be added anywhere in the file,
84 but it is standard to put them immediately before the glyph definition.
86 The glyph definition begins with:
89 fet_beginchar ("glyph description", "glyphname");
93 with @code{glyph description} replaced with a short description of the
94 glyph, and @code{glyphname} replaced with the glyphname, which is chosen
95 to comply with the naming rules in @file{mf/README}.
97 The metafont code used to draw the glyph follows the @code{fet_beginchar}
98 entry. The glyph is finished with:
104 @node Building the changed font
105 @section Building the changed font
107 In order to rebuild the font after making the changes, the existing
108 font files must be deleted. The simplest and quickest way to do this
116 @node METAFONT formatting rules
117 @section METAFONT formatting rules
119 There are special formatting rules for METAFONT files.
121 Tabs are used for the indentation of commands.
123 When a path contains more than two points, put each point on a
124 separate line, with the operator at the beginning of the line.
125 The operators are indented to the same depth as the initial point
126 on the path using spaces. The indentation mechanism is illustrated
127 below, with @samp{------->} indicating a tab character and any other
128 indentation created using spaces.
131 def draw_something (test) =
133 ------->------->fill z1
134 ------->-------> -- z2
135 ------->-------> -- z3
136 ------->-------> .. cycle;