]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/fonts.tex
e9c18ab9c4a4f0c87121af4363fab0537239be75
[lilypond.git] / Documentation / fonts.tex
1 \documentclass{article}
2 \def\kdots{,\ldots,}
3 \title{Not the Font-En-Tja font}
4 \author{HWN \& JCN} 
5 \begin{document}
6 \maketitle
7
8
9 \section{Introduction}
10
11 This document are some design notes of the Feta font.  Feta (not an
12 abbreviation of Font-En-Tja) is a font of music symbols.  All MetaFont
13 %ugh sources are original.  The symbols are modelled after various
14 editions of music, notably
15 \begin{itemize}
16 \item B\"arenreiter
17 \item Hofmeister
18 \item Breitkopf
19 \item Durand \& C'ie
20 \end{itemize}
21
22 The best references on Music engraving are Wanske\cite{wanske} and
23 Ross\cite{ross} quite some of their insights were used.  Although it
24 is a matter of taste, I'd say that B\"arenreiter has the finest
25 typography of all.
26
27
28 \section{Bezier curves for slurs}
29
30 Objective:  slurs in music are curved objects designating that notes
31 should fluently bound.  They are drawn as smooth curves, with their
32 center thicker and the endings tapered.
33
34 There are some variants: the simplest slur shape only has the width as
35 parameter.  Then we give some suggestions for tuning the shapes.  The
36 simple slur algorithm is used for drawing ties as well.
37
38
39
40 \subsection{Simple slurs}
41
42 Long slurs are flat, whereas short slurs look like small circle arcs.
43 Details are given in Wanske\cite{ross} and Ross\cite{wanske}.  The
44 shape of a slur can be given as a Bezier curve with four control
45 points:
46
47 \begin{eqnarray*}
48   B(t) &=& (1-t)^3c_1 +3(1-t)^2tc_2 + 3(1-t)t^2c_3 + t^3c_4.
49 \end{eqnarray*}
50
51 We will assume that the slur connects two notes of the same
52 pitch.  Different slurs can be created by rotating the derived shape.
53 We will also assume that the slur has a vertical axis of symmetry
54 through its center.  The left point will be the origin.     So we have
55 the following equations for the control points $c_1\kdots c_4$.
56
57 \begin{eqnarray*}
58 c_1&=& (0,0)\\
59 c_2&=& (i, h)\\
60 c_3&=& (b-i, h)\\
61 c_4&=& (b, 0)
62 \end{eqnarray*}
63
64 The quantity $b$ is given, it is the width of the slur.  The
65 conditions on the shape of the slur for small and large $b$ transform
66 to
67 \begin{eqnarray*}
68  h \to h_{\infty} , &&\quad b \to \infty\\
69  h \approx r_{0} b, &&\quad b \to 0.
70 \end{eqnarray*}
71 To tackle  this, we  will  assume that $h   = F(b)$, for  some kind of
72 $F(\cdot)$.  One function that satisfies the above conditions is
73 $$
74 F(b) = h_{\infty} \frac{2}{\pi} \arctan \left( \frac{\pi r_0}{2
75 h_{\infty}} b \right).
76 $$
77
78 For satisfying results we choose $h_{\infty} = 2\cdot \texttt{interline}$
79 and $r_0 = \frac 13$.
80
81 \subsection{Height correction}
82
83 Aside from being a smooth curve, slurs should avoid crossing
84 enclosed notes and their stems.
85
86 An easy way to achieve this is to extend the slur's height,
87 so that the slur will curve just above any disturbing notes.
88
89 The parameter $i$ determines the flatness of the curve.  Satisfying
90 results have been obtained with $i = h$.
91
92 The formula can be generalised to allow for corrections in the shape, 
93 \begin{eqnarray*}
94 c_1&=& (0,0)\\
95 c_2&=& (i', h')\\
96 c_3&=& (b-i', h')\\
97 c_4&=& (b, 0)
98 \end{eqnarray*}
99 Where
100 $$
101 i' = h(b) (1 + i_{corr}), \quad h' = h(b) (1 + h_{corr}).
102 $$
103
104 The default values for these corrections are $0$.  A $h_{corr}$ that is
105 negative, makes the curve flatter in the center.  A $h_{corr}$ that is
106 positive make the curve higher. 
107
108 At every encompassed note's x position the difference $\delta _y$ 
109 between the slur's height and the note is calculated.  The greatest 
110 $\delta _y$ is used to calculate $h_{corr}$ is by lineair extrapolation.
111
112 However, this simple method produces satisfactory results only for 
113 small and symmetric disturbances.
114
115
116 \subsection{Tangent method correction}
117
118 A somewhat more elaborate\footnote{While staying in the realm 
119 of emperic computer science} way of having a slur avoid 
120 disturbing notes is by first defining the slur's ideal shape 
121 and then using the height correction.  The ideal shape of a 
122 slur can be guessed by calculating the tangents of the disturbing 
123 notes:
124 % a picture wouldn't hurt...
125 \begin{eqnarray*}
126   y_{disturb,l} &=& \rm{rc}_l x\\
127   y_{disturb,r} &=& \rm{rc}_r + c_{3,x},
128 \end{eqnarray*}
129 where
130 \begin{eqnarray*}
131   \rm{rc}_l &=& \frac{y_{disturb,l} - y_{encompass,1}}
132     {x_{disturb,l} - x_{encompass,1}}\dot x\\
133   \rm{rc}_r &=& \frac{y_{encompass,n} - y_{disturb,r}}
134     {x_{encompass,n} - x_{disturb,r}} \dot x + c_{3,x}.
135 \end{eqnarray*}
136
137 We assume that having the control points $c_2$ and $c_3$ located 
138 on tangent$_1$ and tangent$_2$ resp. 
139 % t: tangent
140 \begin{eqnarray*}
141   y_{tangent,l} &=& \alpha \rm{rc}_l x\\
142   y_{tangent,r} &=& \alpha \rm{rc}_r + c_{3,x}.
143 \end{eqnarray*}
144
145 Beautiful slurs have rather strong curvature at the extreme
146 control points.  That's why we'll have $\alpha > 1$.
147 Satisfactory resulsts have been obtained with
148 $$
149   \alpha \approx 2.4.
150 $$
151
152 The positions of control points $c_2$ and $c_3$ are obtained
153 by solving with the height-line
154 \begin{eqnarray*}
155   y_h &=& \rm{rc}_h + c_h.
156 \end{eqnarray*}
157
158 The top-line runs through the points disturb$_{left}$ and
159 disturb$_{right}$.  In the case that 
160 $$
161 z_{disturb,l} = z_{disturb,r},
162 $$
163 we'll have 
164 $$
165   \angle(y_{tangent,l},y_h) = \angle(y_{tangent,r},y_h).
166 $$
167
168
169
170 \section{Sizes}
171
172 Traditional engraving uses a set of 9 standardised sizes for Staffs
173 (running from 0 to 8).  
174
175 We have tried to measure these (helped by a magnifying glass), and
176 found the staffsizes in the following table.  One should note that
177 these are estimates, so I think there could be a measuring error of ~
178 .5 pt.  Moreover [Ross] states that not all engravers use exactly
179 those sizes.
180
181 \begin{table}
182 \begin{tabular}{lll}
183 Staffsize       &Numbers                &Name\\
184 \hline\\
185 26.2pt  &No. 0\\
186 22.6pt  &No. 1          &Giant/English\\
187 21.3pt  &No. 2          &Giant/English\\
188 19.9pt  &No. 3          &Regular, Ordinary, Common\\
189 19.1pt  &No. 4          &Peter\\
190 17.1pt  &No. 5          &Large middle\\
191 15.9pt  &No. 6          &Small middle\\
192 13.7pt  &No. 7          &Cadenza\\
193 11.1pt  &No. 8          &Pearl\\
194 \end{tabular}
195 \caption{Font and staff sizes}
196 \end{table}
197
198
199 This table is partially taken from [Ross].  Most music is set in No.3,
200 but the papersizes usually are bigger than standard printer paper
201 (such as A4).  If you plot these, you'll notice that the sizes (With
202 exception of 26) almost (but not quite) form a arithmetic progression.
203
204 Ross states that the dies (the stamps to make the symbols) come in
205 12 different sizes.
206
207 \bibliographystyle{plain}
208 \bibliography{engraving}
209
210
211
212 \end{document}