]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/fonts.tex
release: 0.1.58
[lilypond.git] / Documentation / fonts.tex
index 81c87e3c094818c71f47500d421c3cf08dcccf4e..e9c18ab9c4a4f0c87121af4363fab0537239be75 100644 (file)
@@ -8,10 +8,10 @@
 
 \section{Introduction}
 
-Feta (not an abbreviation of Font-En-Tja) is a font of music symbols.
-All MetaFont                   %ugh
-sources are original.  The symbols are modelled after
-various editions of music, notably
+This document are some design notes of the Feta font.  Feta (not an
+abbreviation of Font-En-Tja) is a font of music symbols.  All MetaFont
+%ugh sources are original.  The symbols are modelled after various
+editions of music, notably
 \begin{itemize}
 \item B\"arenreiter
 \item Hofmeister
@@ -25,16 +25,30 @@ is a matter of taste, I'd say that B\"arenreiter has the finest
 typography of all.
 
 
-\section{Bezier curves for simple slurs}
+\section{Bezier curves for slurs}
 
 Objective:  slurs in music are curved objects designating that notes
 should fluently bound.  They are drawn as smooth curves, with their
 center thicker and the endings tapered.
 
+There are some variants: the simplest slur shape only has the width as
+parameter.  Then we give some suggestions for tuning the shapes.  The
+simple slur algorithm is used for drawing ties as well.
+
+
+
+\subsection{Simple slurs}
+
 Long slurs are flat, whereas short slurs look like small circle arcs.
 Details are given in Wanske\cite{ross} and Ross\cite{wanske}.  The
 shape of a slur can be given as a Bezier curve with four control
-points.  We will assume that the slur connects two notes of the same
+points:
+
+\begin{eqnarray*}
+  B(t) &=& (1-t)^3c_1 +3(1-t)^2tc_2 + 3(1-t)t^2c_3 + t^3c_4.
+\end{eqnarray*}
+
+We will assume that the slur connects two notes of the same
 pitch.  Different slurs can be created by rotating the derived shape.
 We will also assume that the slur has a vertical axis of symmetry
 through its center.  The left point will be the origin.     So we have
@@ -64,6 +78,14 @@ $$
 For satisfying results we choose $h_{\infty} = 2\cdot \texttt{interline}$
 and $r_0 = \frac 13$.
 
+\subsection{Height correction}
+
+Aside from being a smooth curve, slurs should avoid crossing
+enclosed notes and their stems.
+
+An easy way to achieve this is to extend the slur's height,
+so that the slur will curve just above any disturbing notes.
+
 The parameter $i$ determines the flatness of the curve.  Satisfying
 results have been obtained with $i = h$.
 
@@ -81,11 +103,71 @@ $$
 
 The default values for these corrections are $0$.  A $h_{corr}$ that is
 negative, makes the curve flatter in the center.  A $h_{corr}$ that is
-positive make the curve higher.
+positive make the curve higher. 
 
+At every encompassed note's x position the difference $\delta _y$ 
+between the slur's height and the note is calculated.  The greatest 
+$\delta _y$ is used to calculate $h_{corr}$ is by lineair extrapolation.
 
-\section{Sizes}
+However, this simple method produces satisfactory results only for 
+small and symmetric disturbances.
+
+
+\subsection{Tangent method correction}
+
+A somewhat more elaborate\footnote{While staying in the realm 
+of emperic computer science} way of having a slur avoid 
+disturbing notes is by first defining the slur's ideal shape 
+and then using the height correction.  The ideal shape of a 
+slur can be guessed by calculating the tangents of the disturbing 
+notes:
+% a picture wouldn't hurt...
+\begin{eqnarray*}
+  y_{disturb,l} &=& \rm{rc}_l x\\
+  y_{disturb,r} &=& \rm{rc}_r + c_{3,x},
+\end{eqnarray*}
+where
+\begin{eqnarray*}
+  \rm{rc}_l &=& \frac{y_{disturb,l} - y_{encompass,1}}
+    {x_{disturb,l} - x_{encompass,1}}\dot x\\
+  \rm{rc}_r &=& \frac{y_{encompass,n} - y_{disturb,r}}
+    {x_{encompass,n} - x_{disturb,r}} \dot x + c_{3,x}.
+\end{eqnarray*}
+
+We assume that having the control points $c_2$ and $c_3$ located 
+on tangent$_1$ and tangent$_2$ resp. 
+% t: tangent
+\begin{eqnarray*}
+  y_{tangent,l} &=& \alpha \rm{rc}_l x\\
+  y_{tangent,r} &=& \alpha \rm{rc}_r + c_{3,x}.
+\end{eqnarray*}
+
+Beautiful slurs have rather strong curvature at the extreme
+control points.  That's why we'll have $\alpha > 1$.
+Satisfactory resulsts have been obtained with
+$$
+  \alpha \approx 2.4.
+$$
+
+The positions of control points $c_2$ and $c_3$ are obtained
+by solving with the height-line
+\begin{eqnarray*}
+  y_h &=& \rm{rc}_h + c_h.
+\end{eqnarray*}
 
+The top-line runs through the points disturb$_{left}$ and
+disturb$_{right}$.  In the case that 
+$$
+z_{disturb,l} = z_{disturb,r},
+$$
+we'll have 
+$$
+  \angle(y_{tangent,l},y_h) = \angle(y_{tangent,r},y_h).
+$$
+
+
+
+\section{Sizes}
 
 Traditional engraving uses a set of 9 standardised sizes for Staffs
 (running from 0 to 8).