
Scaffolding a font
---------------

Use scaffold lines to ensure that vertical and horizontal lines look OK

Use skeleton lines on arcs or diagonal lines, especially if thin, to ensure
that the character remains connected.

Use L- and R-tangent lines to ensure that arcs don't have pips - position
the 'outside' of the arc in line with the tangent line, and link both the
inside and outside points of the arc to the tangent line.  Note that any
skeleton line within the arc should be linked to the same tangent line, so
that it remains inside the arc after the scaffolding is applied.

Think about where the 'stretchable' segments will occur (ie. where the two
endpoints are connected to different scaffold lines).  It is best if
horizontal lines stretch horizontally, and vertical lines stretch
vertically.

As an example, consider the problem of scaffolding a circle:

   1.  The circle should be made up of 4 bezier curves, with the endpoints
        on the 45-degree diagonals.

   2.  4 tangent lines should be used, touching the edges of the circle.
        The left and lower lines should be L-tangent lines, and the right and
        upper lines should be R-tangents.

   3.  The top two endpoints should be linked to the upper tangent line, the
        lower two to the lower lines, the left two to the left line, and the
        right two to the right line.

Note that the horizontally-stretchable segments occur at the top and bottom
(ie. the most horizontal lines) and the vertically-stretchable segments
occur at the left and right (ie. the most vertical lines).

When the scaffolding is applied, each control point is moved by the same
distance as its nearest endpoint, so it helps if the stretchable line is as
long as possible.  If the two control points are close together, it is even
possible for the curve to turn into a loop!  Reducing the number of curves
in a character also helps to save memory - each curve occupies 10 bytes in
the font file.

Consistency
----------

It is important that the characters in a font are modified in a consistent
way by the scaffolding procedure - nothing looks worse than a piece of text
where adjacent characters are all different heights!

To achieve this, it is important that all the upper case letters share at
least two lines (one for the baseline and one for the X-height), and the
lower case letters share three lines (one for the baseline, one for the
x-height and one for the d-height).

However, you may have noticed a problem here - some of the characters have
serifs on the bottom (eg. A,F,H,I,K,M,N,P,R,T,X,Y) while others have a curve
(eg. C,G,O,Q,S,U).  Still others have a line which is not the same thickness
as the serif (eg. B,D,E,L) and others have a V-shape (eg. V,W).

Typically the bottom of the curved characters is slightly lower than the
bottom of the serifed characters, which looks more even than having the
tangent at the bottom of the curves level with the bottom of the serifs.

However, when the characters are only a few pixels height, it is important
that the baselines of all the characters should line up, since a difference
of 1 pixel would be much larger than that intended.

To get round this problem the editor "allows" scaffold lines to be 'linked'
to a parent line, such that the linked line is first moved by the amount the
parent moved, and then has its own scaffolding applied as well.

In the above example, there would be two scaffold lines shared by all the
characters - one for the serif baseline position, and an L-tangent line for
the curve positions, which would be slightly lower.  The L-tangent line
would then be linked to the serif scaffold line, encouraging consistency
between the two (ie. if the serif line moves up, then the L-tangent line
will be moved up by the same amount before moving to the nearest point which
is 1/8th of a pixel up from a pixel boundary).

Similarly, there would be a pair of lines for the tops of the upper-case
characters, and a pair for the tops of the lower-case characters.

Note that one might also link the scaffold line connecting the tops of the
lower-case characters (like 'd') to the one connecting the tops of the
upper-case characters, so that when the font size is a small number of
pixels, the top of the lower case characters coincides with the top of the
upper-case ones.

