]> git.donarmstrong.com Git - lilypond.git/blob - mf/README
* mf/README: Document process for proper mf2pt1 conversion.
[lilypond.git] / mf / README
1
2 This is a font of music symbols.  All MF sources are original.  Most
3 of the documentation is in comments in the MF code.
4
5 Currently, outline fonts are created by using `autotrace', but we are
6 already in the process to convert the MF code directly to PostScript code
7 with a tool called `mf2pt1', which in turn calls `FontForge' to postprocess
8 the output (mainly to remove outline overlaps and to add hints).
9
10 The recommended calling sequence of mf2pt1 is
11
12   mf2pt1 --rounding=0.001 <font>
13
14 You need mf2pt1 version 2.1 or newer.
15
16 Here some guidelines to assure a clean conversion.
17
18 . Never use `---'.  Replace it with `--' together with explicit path
19   directions (if necessary).
20
21 . Don't use self-intersecting outlines in general since it can confuse
22   mf2pt1's algorithm to get the orientation of a closed path.  Note that
23   MetaPost's implementation of the `turningnumber' primitive (which would
24   immediately give the orientation of a path) is severely broken and not
25   fixed yet at the time of writing (November 2005), thus some hand-made code
26   in mf2pt1.mp is used to work around this bug.
27
28 . If outlines intersect, avoid grazing intersections.  In case two outlines
29   intersect in an explicitly defined point, include this point into both
30   intersecting paths to avoid problems due to rounding errors.
31
32 . Don't use `draw' with a polygonal pen but for straight lines (consisting
33   of exactly two points).  In most cases it is quite easy to emulate `draw'
34   with an explicit definition of the outline or with `penstroke'.
35
36 . Don't apply transformations after calling `fill' -- for example, don't
37   mirror `currentpicture'.  Instead, transform the path and call `fill'
38   afterwards.  This insures that mf2pt1 gets the correct outline directions
39   which is a necessary prerequisite for FontForge's algorithm to remove
40   overlaps.
41
42
43 Some design rules:
44
45 . Always use smooth curve transitions.  Since this is difficult to see in
46   MetaFont proof sheets (which don't show the tangents) I recommend to call
47   mf2pt1 like this
48
49     FONTFORGE=foo mf2pt1 ...
50
51   (`foo' should be a non-existent program; this avoids the default
52   postprocessing).  Then call FontForge to inspect the outlines.
53
54 . Use rounded corners.
55
56
57 Finally, some rules to assure that rasterization at low resolutions give
58 good results.  Today, this is a minor issue, but in some cases it might show
59 design flaws.
60
61 . Use `define_whole_pixels' and friends where appropriate.
62
63 . Use `hround' and `vround' consistently.  A lot of auxiliary macros are
64   defined in feta-macros.mf.
65
66 . If a path element is duplicated or shifted, use an integer value for the
67   offset.
68
69 . Add `eps' for mirrored paths to assure correct MetaFont rasterization.
70   See the comment and the variables at the end of `feta-params.mf' for
71   details how vertical symmetry should be achieved.