]> git.donarmstrong.com Git - lilypond.git/commitdiff
Adapting parmesan-accidentals.mf to mf2pt1.
authorWerner Lemberg <wl@gnu.org>
Sun, 29 Apr 2007 12:00:02 +0000 (14:00 +0200)
committerWerner Lemberg <wl@gnu.org>
Sun, 29 Apr 2007 12:00:02 +0000 (14:00 +0200)
Notable changes:

  . `Ed. Med. Flat' and `Ed. Vat. Flat' have improved shapes without cusps.

  . Elliptical strokes have been approximated.

mf/parmesan-accidentals.mf

index c09ae5ae5f6c31b6ff235f2f0ee37baa075334a9..57f94a96fcec26b89a187841b85484235385eb3f 100644 (file)
@@ -6,7 +6,7 @@
 % (c) 2001--2006 Juergen Reuter <reuter@ipd.uka.de>
 % 
 
-fet_begingroup ("accidentals")
+fet_begingroup ("accidentals");
 
 
 %%%%%%%%
@@ -17,36 +17,67 @@ fet_begingroup ("accidentals")
 %
 %
 %
-fet_beginchar("Ed. Med. Flat" , "medicaea-1");
-       set_char_box(0.1 staff_space#, 0.6 staff_space#,
-                    0.6 staff_space#, 1.0 staff_space#);
+fet_beginchar ("Ed. Med. Flat" , "medicaea-1");
+       set_char_box (0.1 staff_space#, 0.6 staff_space#,
+                     0.6 staff_space#, 1.0 staff_space#);
 
-       pickup pencircle
-               xscaled 0.50 linethickness
-               yscaled 0.22 staff_space;
+       save ellipse, pat, outline;
+       path ellipse, pat, outline;
 
-       save za, zb;
-       pair za, zb;
+       pickup pencircle xscaled 0.50 linethickness
+                        yscaled 0.22 staff_space;
 
-       za = (0.00 staff_space, +0.90 staff_space);
-       zb = (0.00 staff_space, -0.50 staff_space);
-       draw za -- zb;
+       ellipse := fullcircle xscaled 0.5 linethickness
+                                     yscaled 0.22 staff_space;
 
-       pickup pencircle
-               xscaled 0.50 linethickness
-               yscaled 0.22 staff_space
-               rotated -63;
+       x1 = x2 = 0;
+       top y1 = h;
+       bot y2 = -d;
 
-       save zc, zd, ze;
-       pair zc, zd, ze;
+       fill get_subpath (ellipse, up, down, z1)
+            -- get_subpath (ellipse, down, up, z2)
+            -- cycle;
 
-       zc = (0.10 staff_space, -0.50 staff_space);
-       zd = (0.40 staff_space, +0.40 staff_space);
-       ze = (0.10 staff_space, +0.40 staff_space);
+       pickup pencircle xscaled 0.50 linethickness
+                        yscaled 0.22 staff_space
+                        rotated -63;
 
-       draw zc{(1,2)} .. zd .. ze{(-1,-1)};
+       ellipse := fullcircle xscaled 0.50 linethickness
+                             yscaled 0.22 staff_space
+                             rotated -63;
+
+       z3 = (0.10 staff_space, -0.50 staff_space);
+       z4 = (0.40 staff_space, +0.40 staff_space);
+       z5 = (0.10 staff_space, +0.40 staff_space);
+
+       pat := z3{(1, 2)}
+              .. z4
+              .. z5{(-1, -1)};
+
+       % the original envelope curve created with `draw' contains
+       % cusps which we avoid
+       outline := get_subpath (ellipse, -direction 0 of pat,
+                               direction 0 of pat, z3)
+                  .. get_subpoint (ellipse, direction 1 of pat, z4)
+                  .. get_subpath (ellipse, direction 2 of pat,
+                                  -direction 1.8 of pat, z5)
+                  .. get_subpoint (ellipse, -direction 1 of pat, z4)
+                       {-direction 1 of pat}
+                  .. cycle;
+
+       save shift;
+       pair shift;
+
+       % make the outline touch the bounding box
+       shift = find_tangent_shift (((w, -d) -- (w, h)), outline,
+                                   (b, 0), (-b, 0));
+       outline := outline shifted shift;
+
+       fill outline;
+
+       labels (1, 2, 3, 4, 5);
+fet_endchar;
 
-       fet_endchar;
 
 %%%%%%%%
 %
@@ -56,52 +87,97 @@ fet_beginchar("Ed. Med. Flat" , "medicaea-1");
 %
 %
 %
-fet_beginchar("Ed. Vat. Flat" , "vaticana-1");
-        save za, zb, zc, zd, ze, zf, zg;
-        pair za, zb, zc, zd, ze, zf, zg;
-        za = (0.00 staff_space, +0.80 staff_space);
-        zb = (0.00 staff_space, -0.03 staff_space);
-        zc = (0.25 staff_space, -0.23 staff_space);
-        zd = (0.50 staff_space, -0.23 staff_space);
-        ze = (0.50 staff_space, +0.00 staff_space);
-        zf = (0.25 staff_space, +0.20 staff_space);
-        zg = (0.15 staff_space, +0.26 staff_space);
-
-        pickup pencircle
-                xscaled 0.50 linethickness
-                yscaled 0.22 staff_space;
-        draw za{down} .. {down}zb .. zc .. zd{up} .. {up}ze .. zf .. zg;
-
-        set_char_box(0.00 staff_space# + 0.25 linethickness#,
-                    0.50 staff_space# + 0.25 linethickness#,
-                    0.23 staff_space# + 0.11 staff_space#,
-                    0.80 staff_space# + 0.11 staff_space#);
-        fet_endchar;
-
-fet_beginchar("Ed. Vat. Natural" , "vaticana0");
-       save za, zb, zc, zd;
-       pair za, zb, zc, zd;
-       pickup pencircle
-               xscaled 0.80 linethickness
-               yscaled 0.22 staff_space;
-       za = (0.00 staff_space, +0.65 staff_space);
-       zb = (0.00 staff_space, -0.35 staff_space);
-       zc = (0.00 staff_space, -0.30 staff_space);
-       zd = (0.40 staff_space, -0.08 staff_space);
-       draw za -- zb;
-       draw zc -- zd;
+fet_beginchar ("Ed. Vat. Flat" , "vaticana-1");
+       z1 = (0.00 staff_space, +0.80 staff_space);
+       z2 = (0.00 staff_space, -0.08 staff_space);
+       z3 = (0.25 staff_space, -0.23 staff_space);
+       z4 = (0.50 staff_space, -0.24 staff_space);
+       z5 = (0.50 staff_space, +0.03 staff_space);
+       z6 = (0.25 staff_space, +0.20 staff_space);
+       z7 = (0.15 staff_space, +0.26 staff_space);
+
+       save pat, ellipse;
+       path pat, ellipse;
+
+       pickup pencircle xscaled 0.50 linethickness
+                        yscaled 0.22 staff_space;
+
+       ellipse := fullcircle xscaled 0.50 linethickness
+                             yscaled 0.22 staff_space;
+
+       pat := z1
+              -- z2{down}
+              ... z3
+              ... {up}z4
+              -- z5{up}
+              .. z6
+              .. z7;
+
+       % the original envelope curve created with `draw' contains
+       % cusps which we avoid
+       fill get_subpath (ellipse, up, down, z1)
+            -- get_subpath (ellipse, down, direction 1.1 of pat, z2)
+            ... bot z3
+            ... get_subpath (ellipse, direction 2.9 of pat, up, z4)
+            -- get_subpath (ellipse, up, direction 4.1 of pat, z5)
+            .. top z6
+            .. get_subpath (ellipse,
+                            direction 6 of pat, -direction 6 of pat, z7)
+            .. bot z6
+            .. {down}bot lft z5
+            -- top lft z4{down}
+            ... top z3
+            ... top rt z2{up}
+            -- cycle;
+
+       set_char_box (0.00 staff_space# + 0.25 linethickness#,
+                     0.50 staff_space# + 0.25 linethickness#,
+                     0.23 staff_space# + 0.11 staff_space#,
+                     0.80 staff_space# + 0.11 staff_space#);
+
+       labels (1, 2, 3, 4, 5, 6, 7);
+fet_endchar;
+
+
+fet_beginchar ("Ed. Vat. Natural" , "vaticana0");
+       save ellipse;
+       path ellipse;
+
+       pickup pencircle xscaled 0.80 linethickness
+                        yscaled 0.22 staff_space;
+
+       ellipse := fullcircle xscaled 0.8 linethickness
+                             yscaled 0.22 staff_space;
+
+       z1 = (0.00 staff_space, +0.65 staff_space);
+       z2 = (0.00 staff_space, -0.35 staff_space);
+
+       fill get_subpath (ellipse, up, down, z1)
+            -- get_subpath (ellipse, down, up, z2)
+            -- cycle;
+
+       pickup penrazor scaled 0.22 staff_space
+                       rotated 90;
+
+       z3 = (0.00 staff_space, -0.30 staff_space);
+       z4 = (0.40 staff_space, -0.08 staff_space);
+
+       draw z3
+            -- z4;
 
        addto currentpicture also currentpicture
-               xscaled -1
-               yscaled -1
-               shifted (0.40 staff_space, 0.0 staff_space);
+         xscaled -1
+         yscaled -1
+         shifted (0.40 staff_space, 0.0 staff_space);
+
+       set_char_box (0.00 staff_space# + 0.40 linethickness#,
+                     0.40 staff_space# + 0.40 linethickness#,
+                     0.65 staff_space# + 0.11 staff_space#,
+                     0.65 staff_space# + 0.11 staff_space#);
 
-       set_char_box(0.00 staff_space# + 0.40 linethickness#,
-                    0.40 staff_space# + 0.40 linethickness#,
-                    0.65 staff_space# + 0.11 staff_space#,
-                    0.65 staff_space# + 0.11 staff_space#);
+       labels (1, 2, 3, 4);
+fet_endchar;
 
-       fet_endchar;
 
 %%%%%%%%
 %
@@ -111,79 +187,202 @@ fet_beginchar("Ed. Vat. Natural" , "vaticana0");
 %
 %
 %
-fet_beginchar("Mensural Sharp" , "mensural1");
+fet_beginchar ("Mensural Sharp" , "mensural1");
        save stemthick;
+
        define_pixels (stemthick);
+
        stemthick# = linethickness#;
 
-       save za, zb;
-       pair za, zb;
+       save circle, pat;
+       path circle, pat;
+
        pickup pencircle scaled 0.8 stemthick;
-       za = 0.4 * staff_space * (0.8, 1);
-       za = -zb;
-       draw za .. zb;
 
-       addto currentpicture also currentpicture xscaled -1;
-       addto currentpicture also currentpicture shifted (0.20 staff_space, 0);
+       circle := fullcircle scaled 0.8 stemthick;
 
-       set_char_box(0.8 * 0.4 staff_space# + 0.4 stemthick#,
-                    (0.8 * 0.4 + 0.2) * staff_space# + 0.4 stemthick#,
-                    0.4 staff_space# + 0.4 stemthick#, 
-                    0.4 staff_space# + 0.4 stemthick#);
+       z1 = 0.4 staff_space * (0.8, 1);
+       z1 = -z2;
 
-       fet_endchar;
+       pat := get_subpath (circle, z1 - z2, z2 - z1, z1)
+              -- get_subpath (circle, z2 - z1, z1 - z2, z2)
+              -- cycle;
 
-fet_beginchar("Mensural Flat" , "mensural-1");
-       save stemthick;
-       define_pixels (stemthick);
-       stemthick# = linethickness#;
+       fill pat;
+       fill pat xscaled -1;
+       fill pat shifted (0.20 staff_space, 0);
+       fill pat xscaled -1 shifted (0.20 staff_space, 0);
+
+       set_char_box (0.8 * 0.4 staff_space# + 0.4 stemthick#,
+                     (0.8 * 0.4 + 0.2) * staff_space# + 0.4 stemthick#,
+                     0.4 staff_space# + 0.4 stemthick#, 
+                     0.4 staff_space# + 0.4 stemthick#);
+
+       labels (1, 2);
+fet_endchar;
 
-       save za, zb, zc, zd, ze;
-       pair za, zb, zc, zd, ze;
-       pickup pencircle
-               xscaled 1.4 stemthick
-               yscaled 0.6 stemthick
-               rotated 45;
 
-       za = (0.00 staff_space, +1.80 staff_space);
-       zb = (0.00 staff_space, -0.25 staff_space);
-       zc = (0.35 staff_space, -0.25 staff_space);
-       zd = (0.35 staff_space, +0.25 staff_space);
-       ze = (0.00 staff_space, +0.25 staff_space);
-       draw za -- zb .. zc .. zd .. ze;
+fet_beginchar ("Mensural Flat" , "mensural-1");
+       save stemthick;
 
-       set_char_box(0.00 staff_space# + 0.75 stemthick#,
-                    0.40 staff_space# + 0.75 stemthick#,
-                    0.25 staff_space# + 0.75 stemthick#,
-                    1.80 staff_space# + 0.75 stemthick#);
+       define_pixels (stemthick);
 
-       fet_endchar;
+       stemthick# = linethickness#;
 
-fet_beginchar("Hufnagel Flat" , "hufnagel-1");
+       save ellipse, pat, outline;
+       path ellipse, pat, outline;
+
+       pickup pencircle xscaled 1.4 stemthick
+                        yscaled 0.6 stemthick
+                        rotated 45;
+
+       ellipse := fullcircle xscaled 1.4 stemthick
+                             yscaled 0.6 stemthick
+                             rotated 45;
+
+       z1 = (0.00 staff_space, +1.80 staff_space);
+       z2 = (0.00 staff_space, -0.25 staff_space);
+       z3 = (0.35 staff_space, -0.25 staff_space);
+       z4 = (0.35 staff_space, +0.25 staff_space);
+       z5 = (0.00 staff_space, +0.25 staff_space);
+
+       pat := z2
+              .. z3
+              .. z4
+              .. z5;
+
+       save dirs, s;
+       pair dirs[];
+
+       s := 1/4;
+
+       % we approximate `draw pat'
+       for i = 2 step s until (length pat + 2):
+               dirs[i] := direction (i - 2) of pat;
+       endfor;
+
+       outline := get_subpath (ellipse, up, down, z1)
+                  -- get_subpath (ellipse, down, dirs2, z2)
+                  for i = (2 + s) step s until (length pat + 2 - s):
+                          .. get_subpoint (ellipse, dirs[i],
+                                             point (i - 2) of pat)
+                  endfor
+                  .. top z5
+                  -- bot z5
+                  for i = (length pat + 2 - s) step -s until 2:
+                          .. get_subpoint (ellipse, -dirs[i],
+                                           point (i - 2) of pat)
+                  endfor
+                  -- get_subpoint (ellipse, up, z2)
+                  -- cycle;
+
+       fill outline;
+
+       set_char_box (0.00 staff_space# + 0.75 stemthick#,
+                     0.40 staff_space# + 0.75 stemthick#,
+                     0.25 staff_space# + 0.75 stemthick#,
+                     1.80 staff_space# + 0.75 stemthick#);
+
+       labels (1, 2, 3, 4, 5);
+fet_endchar;
+
+
+fet_beginchar ("Hufnagel Flat" , "hufnagel-1");
        save stemthick;
+
        define_pixels (stemthick);
+
        stemthick# = linethickness#;
 
-       save za, zb, zc, zd, ze, zf;
-       pair za, zb, zc, zd, ze, zf;
-       pickup pencircle
-               xscaled 2.4 stemthick
-               yscaled 0.4 stemthick
-               rotated 45;
-
-       za = (0.00 staff_space, +1.80 staff_space);
-       zb = (0.00 staff_space, -0.15 staff_space);
-       zc = (0.25 staff_space, -0.30 staff_space);
-       zd = (0.50 staff_space, +0.00 staff_space);
-       ze = (0.30 staff_space, +0.30 staff_space);
-       zf = (0.00 staff_space, +0.15 staff_space);
-       draw za -- zb -- zc .. zd .. ze -- zf;
-
-       set_char_box(0.00 staff_space# + 1.0 stemthick#,
-                    0.50 staff_space# + 1.0 stemthick#,
-                    0.30 staff_space# + 0.5 stemthick#, 
-                    1.80 staff_space# + 0.5 stemthick#);
-
-       fet_endchar;
-
-fet_endgroup ("accidentals")
+       save ellipse, pat;
+       path ellipse, pat;
+
+       pickup pencircle xscaled 2.4 stemthick
+                        yscaled 0.4 stemthick
+                        rotated 45;
+
+       ellipse := fullcircle xscaled 2.4 stemthick
+                             yscaled 0.4 stemthick
+                             rotated 45;
+
+       z1 = (0.00 staff_space, +1.80 staff_space);
+       z2 = (0.00 staff_space, -0.15 staff_space);
+       z3 = (0.25 staff_space, -0.30 staff_space);
+       z4 = (0.50 staff_space, +0.00 staff_space);
+       z5 = (0.30 staff_space, +0.30 staff_space);
+       z6 = (0.00 staff_space, +0.15 staff_space);
+
+       pat := z3
+              .. z4
+              .. z5;
+
+       save t;
+       numeric t[];
+
+       % we have to find the envelope intersections (if any)
+       t1 = find_envelope_cusp (reverse ellipse, pat, 1/256) + 3;
+       if t1 < 3:
+               t1 := 3;
+       fi;
+       t2 = find_envelope_cusp (ellipse, reverse pat, 1/256);
+       if t2 < 0:
+               t2 := 3;
+       else:
+               t2 := length pat - t2 + 3;
+       fi;
+
+       save dirs, s;
+       pair dirs[];
+
+       s := 1/8;
+
+       % we approximate `draw pat'
+       for i = 3 step s until 5:
+               dirs[i] := direction (i - 3) of pat;
+       endfor;
+
+       fill get_subpath (ellipse, up, down, z1)
+            -- get_subpath (ellipse, down, z3 - z2, z2)
+            -- get_subpoint (ellipse, z3 - z2, z3)
+            for i = 3 step s until 5:
+                    .. get_subpoint (ellipse, dirs[i],
+                                     point (i - 3) of pat)
+            endfor
+            .. get_subpoint (ellipse, z6 - z5, z5)
+            -- get_subpoint (ellipse, z6 - z5, z6)
+            -- get_subpoint (ellipse, z5 - z6, z6)
+            -- get_subpoint (ellipse, z5 - z6, z5)
+            -- get_subpoint (ellipse, -dirs[5], z5)
+            for i = (5 - s) step -s until t2:
+                    .. get_subpoint (ellipse, -dirs[i],
+                                     point (i - 3) of pat)
+            endfor
+            .. get_subpoint (ellipse, -direction (t2 - 3) of pat,
+                             point (t2 - 3) of pat)
+            -- get_subpoint (ellipse, -direction (t1 - 3) of pat,
+                             point (t1 - 3) of pat)
+            for i = (floor ((t1 - 3) / s) * s + 3) step -s until (3 + s):
+                    .. get_subpoint (ellipse, -dirs[i],
+                                     point (i - 3) of pat)
+            endfor
+            .. get_subpoint (ellipse, -dirs[3], z3)
+            -- get_subpoint (ellipse, z2 - z3, z3)
+            -- get_subpoint (ellipse, z2 - z3, z2)
+            -- get_subpoint (ellipse, up, z2)
+            -- cycle;
+
+%      draw z1
+%           -- z2
+%           -- pat
+%           -- z6;
+
+       set_char_box (0.00 staff_space# + 1.0 stemthick#,
+                     0.50 staff_space# + 1.0 stemthick#,
+                     0.30 staff_space# + 0.5 stemthick#, 
+                     1.80 staff_space# + 0.5 stemthick#);
+
+       labels (1, 2, 3, 4, 5, 6);
+fet_endchar;
+
+
+fet_endgroup ("accidentals");