]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.1.55
authorfred <fred>
Mon, 17 May 1999 09:22:21 +0000 (09:22 +0000)
committerfred <fred>
Mon, 17 May 1999 09:22:21 +0000 (09:22 +0000)
Documentation/metadoc/fonts.doc [new file with mode: 0644]

diff --git a/Documentation/metadoc/fonts.doc b/Documentation/metadoc/fonts.doc
new file mode 100644 (file)
index 0000000..287dde4
--- /dev/null
@@ -0,0 +1,330 @@
+
+                                % -*-LaTeX-*-
+
+\documentclass{article}
+\def\kdots{,\ldots,}
+\title{Not the Font-En-Tja font}
+\author{HWN \& JCN} 
+\def\preMudelaExample{}
+\def\postMudelaExample{}
+\begin{document}
+\maketitle
+
+
+\section{Introduction}
+
+This document are some design notes of the Feta font, and other
+symbols related to LilyPond.  Feta (not an abbreviation of
+Font-En-Tja) is a font of music symbols.  All MetaFont sources are
+original.  The symbols are modelled after various editions of music,
+notably \begin{itemize} \item B\"arenreiter \item Hofmeister \item
+Breitkopf \item Durand \& C'ie \end{itemize}
+
+The best references on Music engraving are Wanske\cite{wanske} and
+Ross\cite{ross} some of their insights were used.  Although it is a
+matter of taste, I'd say that B\"arenreiter has the finest typography
+of all.
+
+
+\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:
+
+\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
+the following equations for the control points $c_1\kdots c_4$.
+
+\begin{eqnarray*}
+c_1&=& (0,0)\\
+c_2&=& (i, h)\\
+c_3&=& (b-i, h)\\
+c_4&=& (b, 0)
+\end{eqnarray*}
+
+The quantity $b$ is given, it is the width of the slur.  The
+conditions on the shape of the slur for small and large $b$ transform
+to
+\begin{eqnarray*}
+ h \to h_{\infty} , &&\quad b \to \infty\\
+ h \approx r_{0} b, &&\quad b \to 0.
+\end{eqnarray*}
+To tackle  this, we  will  assume that $h   = F(b)$, for  some kind of
+$F(\cdot)$.  One function that satisfies the above conditions is
+$$
+F(b) = h_{\infty} \frac{2}{\pi} \arctan \left( \frac{\pi r_0}{2
+h_{\infty}} b \right).
+$$
+
+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$.
+
+The formula can be generalised to allow for corrections in the shape, 
+\begin{eqnarray*}
+c_1&=& (0,0)\\
+c_2&=& (i', h')\\
+c_3&=& (b-i', h')\\
+c_4&=& (b, 0)
+\end{eqnarray*}
+Where
+$$
+i' = h(b) (1 + i_{corr}), \quad h' = h(b) (1 + h_{corr}).
+$$
+
+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. 
+
+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.
+
+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 empiric 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).  
+
+We have tried to measure these (helped by a magnifying glass), and
+found the staffsizes in  table~\ref{fonts:staff-size}.  One should note that
+these are estimates, so I think there could be a measuring error of ~
+.5 pt.  Moreover [Ross] states that not all engravers use exactly
+those sizes.
+
+\begin{table}[h]
+  \begin{center}
+    \begin{tabular}{lll}
+Staffsize       &Numbers                &Name\\
+\hline\\
+26.2pt  &No. 0\\
+22.6pt  &No. 1          &Giant/English\\
+21.3pt  &No. 2          &Giant/English\\
+19.9pt  &No. 3          &Regular, Ordinary, Common\\
+19.1pt  &No. 4          &Peter\\
+17.1pt  &No. 5          &Large middle\\
+15.9pt  &No. 6          &Small middle\\
+13.7pt  &No. 7          &Cadenza\\
+11.1pt  &No. 8          &Pearl\\
+    \end{tabular}
+    \caption{Foo}
+    \label{fonts:staff-size}
+  \end{center}
+\end{table}
+
+
+
+
+\section{Beams}
+
+\subsection{Slope}
+
+Traditionally, beam slopes are computed by following a large and hairy
+set of rules.  Some of these are talked-about in Wanske, a more
+recipy-like description can be found in Ross.
+
+There are some problems when trying to follow these rules:
+\begin{itemize}
+
+\item the set is not complete
+
+\item they are not formulated as a general rule with exceptions, but
+rather as a huge case of individual rules\cite{ross}
+
+\item in some cases, the result is wrong or ugly (or both)
+
+\item they try to solve a couple of problems at a time (e.g. Ross
+handles ideal slope and slope-quantisation as a paired problem)
+\end{itemize}
+Reading Ross it is clear that the rules presented there are certainly
+not the ultimate idea of what beam(slope)s should look like, but
+rather a (very much) simplified hands-on recipy for a human engraver.
+
+There are good reasons not to follow those rules:
+
+\begin{itemize}
+\item One cannot expect a human engraver to solve least-squares
+problems for every beam
+  
+\item A human engravers will allways trust themselves in judging the
+outcome of the applied recipy.  If, in a complicated case, the result
+"doesn't look good", they will ignore the rules and draw their own
+beams, based on experience.
+
+\item The exact rules probably don't "really exist" but in the minds
+  of good engravers, in the form of experience
+\end{itemize}
+
+We'll propose to do a least-squares solve.  This seems to be the best
+way to calculate the slope for a computerised engraver such as Lily.
+
+It would be nice to have some rules to catch and handle "ugly" cases,
+though.  In general, the slope of the beam should mirror the pitches
+of the notes.  If this can't be done because there simply is no
+uniform trend, it would probably be best to set the slope to zero.
+
+
+\subsection{Quantising}
+
+The beams should be prevented to conflict with the stafflines,
+especially at small slopes.  Traditionally, poor printing techniques
+imposed rather strict rules for quantisation.  In modern (post 1955)
+music printing we see that quality has improved substantially and
+obsoleted the technical justification for following some of these
+strict rules, notably the avoiding of so-called wedges.
+
+
+\subsection{Thickness and spacing}
+
+The spacing of double and triple beams (sixteenth and thirtysecond beams)
+is the same, quadruple and quintuple (thirtyfourth and hundredtwentyeighth
+beams) is wider.
+All beams are equally thick.  Using the layout of triple beams and the 
+beam-thickness $bt$ we can calculate the inter-beam spacing $ib$.
+
+Three beams span two interlines, including stafflines:
+\begin{eqnarray*}
+ 2 ib + bt &=& 2 il\\
+ ib &=& (2 il - bt) / 2
+\end{eqnarray*}
+
+We choose
+\begin{eqnarray*}
+  bt &=& 0.48(il - st)
+\end{eqnarray*}
+
+\subsubsection{Quadruple beams}
+
+If we have more than three beams they must open-up
+in order to not collide with staff lines.  The only valid
+position that remains is for the upper beam to hang.
+
+\begin{eqnarray*}
+ 3 ib_{4+} + bt &=& 3 il\\
+ ib_{4+} &=& (3 il - bt) / 3
+\end{eqnarray*}
+
+
+\section{Layout of the source files}
+
+The main font (with the fixed size music glyphs) uses a the \TeX\
+logfile as a communication device.  Use the specialised macros to
+create and export glyphs.
+
+\bibliographystyle{plain}
+\bibliography{engraving}
+
+
+
+\end{document}
+
+\begin{verbatim}
+Paul Terry <paul@musonix.demon.co.uk> writes:
+
+Ross states that the dies (the stamps to make the symbols) come in
+12 different sizes.
+
+>Can you tell me how big rastrals are?
+
+According to the Score manual:
+
+   Rastral Size     Height in millimetres
+
+   0                9   mm
+   1                8   mm
+   2                7.5 mm
+   3                7   mm
+   4                6.5 mm
+   5                6   mm
+   6                5.5 mm
+
+I must say, despite having been a music setter for many years, I had to
+look these up - none of the publishers I work for deal in Rastral sizes
+these days (they all use millimetres).