]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/contributor/feta-font.itexi
Doc-fr: synch with master
[lilypond.git] / Documentation / contributor / feta-font.itexi
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @node Modifying the Emmentaler font
3 @chapter Modifying the Emmentaler font
4
5 @menu
6 * Overview of the Emmentaler font::
7 * Font creation tools::
8 * Adding a new font section::
9 * Adding a new glyph::
10 * Building the changed font::
11 * METAFONT formatting rules::
12 @end menu
13
14 @node Overview of the Emmentaler font
15 @section Overview of the Emmentaler font
16
17 Emmentaler was created specifically for use in LilyPond.  The font
18 consists of two @emph{sub-sets} of glyphs. @qq{Feta}, used for clasical
19 notation and @qq{Parmesan}, used for Ancient notation.  The sources of
20 which are all found in mf/*.mf.
21
22 The font is merged from a number of subfonts.  Each subfont can contain
23 at most 224 glyphs.  This is because each subfont is limited to a
24 one-byte address space (256 glyphs maximum) and we avoid the first 32
25 points in that address space, since they are non-printing control
26 characters in ASCII.
27
28 In LilyPond, glyphs are accessed by a @q{glyph name}, rather than by
29 code point.  Therefore, the name of a glyph is significant.
30
31 Information about correctly creating glyphs is found in @file{mf/README}.
32 Please make sure you read and understand this file.
33
34 TODO -- we should get mf/README automatically generated from texinfo
35 source and include it here.
36
37
38 @node Font creation tools
39 @section Font creation tools
40
41 The sources for Emmentaler are written in metafont.  The definitive
42 reference for metafont is "The METAFONT book" -- the source of which is
43 available at CTAN.
44
45 mf2pt1 is used to create type 1 fonts from the metafont sources.
46
47 FontForge is used to postprocess the output of mf2pt1 and clean up
48 details of the font.  It can also be used by a developer to
49 display the resulting glyph shapes.
50
51
52 @node Adding a new font section
53 @section Adding a new font section
54
55 The font is divided into sections, each of which contains less
56 than 224 glyphs.  If more than 224 glyphs are included in a section,
57 an error will be generated.
58
59 Each of the sections is contained in a separate @code{.mf} file.  The
60 files are named according to the type of glyphs in that section.
61
62 When adding a new section, it will be necessary to add the following:
63
64 @itemize
65 @item
66 The code for the glyphs, in a file @code{<section-name>.mf}
67 @item
68 Driver files used to create the font in different sizes
69 @item
70 An entry in the generic file used to create the font, or a new
71 generic file
72 @item
73 If necessary, new entries in the GNUmakefile
74 @item
75 An entry in @file{scripts/build/gen-emmentaler-scripts.py}
76 @end itemize
77
78 See the examples in @code{mf/} for more information.
79
80
81 @node Adding a new glyph
82 @section Adding a new glyph
83
84 Adding a new glyph is done by modifying the .mf file to which the
85 glyph will be added.
86
87 Necessary functions to draw the glyph can be added anywhere in the file,
88 but it is standard to put them immediately before the glyph definition.
89
90 The glyph definition begins with:
91
92 @example
93 fet_beginchar ("glyph description", "glyphname");
94 @end example
95
96 @noindent
97 with @code{glyph description} replaced with a short description of the
98 glyph, and @code{glyphname} replaced with the glyphname, which is chosen
99 to comply with the naming rules in @file{mf/README}.
100
101 The metafont code used to draw the glyph follows the @code{fet_beginchar}
102 entry.  The glyph is finished with:
103
104 @example
105 fet_endchar;
106 @end example
107
108
109 @node Building the changed font
110 @section Building the changed font
111
112 In order to rebuild the font after making the changes, the existing
113 font files must be deleted.  The simplest and quickest way to do this
114 is to do:
115
116 @example
117 rm mf/out/*
118 make
119 @end example
120
121
122 @node METAFONT formatting rules
123 @section METAFONT formatting rules
124
125 There are special formatting rules for METAFONT files.
126
127 Tabs are used for the indentation of commands.
128
129 When a path contains more than two points, put each point on a
130 separate line, with the operator at the beginning of the line.
131 The operators are indented to the same depth as the initial point
132 on the path using spaces.  The indentation mechanism is illustrated
133 below, with @samp{------->} indicating a tab character and any other
134 indentation created using spaces.
135
136 @example
137 def draw_something (test) =
138 ------->if test:
139 ------->------->fill z1
140 ------->------->     -- z2
141 ------->------->     -- z3
142 ------->------->     .. cycle;
143 ------->fi;
144 enddef;
145 @end example