]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/contributor/feta-font.itexi
Merge branch 'master' of git://git.savannah.gnu.org/lilypond.git
[lilypond.git] / Documentation / contributor / feta-font.itexi
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @node Modifying the feta font
3 @chapter Modifying the feta font
4
5 @menu
6 * Overview of the feta font::
7 * Font creation tools::
8 * Adding a new font section::
9 * Adding a new glyph::
10 * Building the changed font::
11 @end menu
12
13 @node Overview of the feta font
14 @section Overview of the feta font
15
16 The feta font is a font that was created specifically for use in
17 LilyPond.  The sources for the font are found in mf/*.mf.
18
19 The feta font is merged from a number of subfonts.  Each subfont
20 can contain at most 224 glyphs.  This is because each subfont is
21 limited to a one-byte address space (256 glyphs maximum) and we
22 avoid the first 32 points in that address space, since they are
23 non-printing control characters in ASCII.
24
25 In LilyPond, glyphs are accessed by glyph name, rather than by code point.
26 Therefore, the naming of glyphs is significant.
27
28 Information about correctly creating glyphs is found in @file{mf/README}.
29 Please make sure you read and understand this file.
30
31 TODO -- we should get mf/README automatically generated from texinfo source
32 and include it here.
33
34
35 @node Font creation tools
36 @section Font creation tools
37
38 The sources for the feta font are written in metafont.  The definitive
39 reference for metafont is "The METAFONT book".  Source for the book is
40 available at CTAN.
41
42 mf2pt1 is used to create type 1 fonts from the metafont sources.
43
44 FontForge is used to postprocess the output of mf2pt1 and clean up
45 details of the font.  It can also be used by a developer to
46 display the resulting glyph shapes.
47
48 @node Adding a new font section
49 @section Adding a new font section
50
51 The font is divided into sections, each of which contains less
52 than 224 glyphs.  If more than 224 glyphs are included in a section,
53 an error will be generated.
54
55 Each of the sections is contained in a separate @code{.mf} file.  The
56 files are named according to the type of glyphs in that section.
57
58 When adding a new section, it will be necessary to add the following:
59
60 @itemize
61 @item
62 The code for the glyphs, in a file @code{<section-name>.mf}
63 @item
64 Driver files used to create the font in different sizes
65 @item
66 An entry in the generic file used to create the font, or a new
67 generic file
68 @item
69 If necessary, new entries in the GNUmakefile
70 @item
71 An entry in @file{scripts/build/gen-emmentaler-scripts.py}
72 @end itemize
73
74 See the examples in @code{mf/} for more information.
75
76 @node Adding a new glyph
77 @section Adding a new glyph
78
79 Adding a new glyph is done by modifying the .mf file to which the
80 glyph will be added.
81
82 Necessary functions to draw the glyph can be added anywhere in the file,
83 but it is standard to put them immediately before the glyph definition.
84
85 The glyph definition begins with:
86
87 @example
88 fet_beginchar ("glyph description", "glyphname");
89 @end example
90
91 @noindent
92 with @code{glyph description} replaced with a short description of the
93 glyph, and @code{glyphname} replaced with the glyphname, which is chosen
94 to comply with the naming rules in @file{mf/README}.
95
96 The metafont code used to draw the glyph follows the @code{fet_beginchar}
97 entry.  The glyph is finished with:
98
99 @example
100 fet_endchar;
101 @end example
102
103 @node Building the changed font
104 @section Building the changed font
105
106 In order to rebuild the font after making the changes, the existing
107 font files must be deleted.  The simplest and quickest way to do this
108 is to do:
109
110 @example
111 rm mf/out/*
112 make
113 @end example