]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-noteheads.mf
Add '-dcrop' option to ps and svg backends
[lilypond.git] / mf / feta-noteheads.mf
index 98a19825ec1a6c134acf7b4aaf2ae9f45437b190..8f4cad6e3422ac85c5582bbf38fb14280f27174f 100644 (file)
@@ -1,15 +1,14 @@
 % Feta (not the Font-En-Tja) music font -- implement noteheads
 % This file is part of LilyPond, the GNU music typesetter.
 %
-% Copyright (C) 1997--2011 Jan Nieuwenhuizen <janneke@gnu.org>
+% Copyright (C) 1997--2015 Jan Nieuwenhuizen <janneke@gnu.org>
 % & Han-Wen Nienhuys <hanwen@xs4all.nl>
 % & Juergen Reuter <reuter@ipd.uka.de>
 %
-%
-% LilyPond is free software: you can redistribute it and/or modify
+% The LilyPond font is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
 % the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
+% (at your option) any later version, or under the SIL Open Font License.
 %
 % LilyPond is distributed in the hope that it will be useful,
 % but WITHOUT ANY WARRANTY; without even the implied warranty of
 test_outlines := 0;
 
 
-save remember_pic;
-picture remember_pic;
-
-
 % Most beautiful noteheads are pronounced, not circular,
 % and not even symmetric.
 % These examples are inspired by [Wanske]; see literature list.
 
 
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % NOTE HEAD VARIABLES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -99,11 +93,6 @@ def draw_longa (expr up) =
        draw_outside_ellipse (1.80, 0, 0.707, 0);
        undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
 
-       set_char_box (stemthick#,
-                     width# + stemthick#,
-                     noteheight# / 2,
-                     noteheight# / 2);
-
        pickup pencircle scaled stemthick;
 
        % Longas of smaller design sizes should have their lines longer.
@@ -118,8 +107,12 @@ def draw_longa (expr up) =
                quanted_line_length := max (0.77, line_length);
        fi;
 
+
        final_line_length := quanted_line_length * staff_space;
 
+       save boxtop, boxbot;
+       define_pixels (boxtop, boxbot);
+
        if up:
                bot y1 = -final_line_length;
                top y2 = final_line_length;
@@ -130,6 +123,8 @@ def draw_longa (expr up) =
                x4 = x3;
                top y4 = h + 3.0 staff_space;
                y3 = y1;
+               boxtop# := staff_space# * (quanted_line_length + 3.0) - stemthick# ;
+               boxbot# := staff_space# * quanted_line_length;
        else:
                bot y1 = -d - 3.0 staff_space;
                top y2 = final_line_length;
@@ -140,11 +135,18 @@ def draw_longa (expr up) =
                x4 = x3;
                y4 = y2;
                bot y3 = -final_line_length;
+               boxtop# := staff_space# * quanted_line_length;
+               boxbot# := staff_space# * (quanted_line_length + 3.0) - stemthick# ;
        fi;
 
        draw_gridline (z1, z2, stemthick);
        draw_gridline (z3, z4, stemthick);
 
+       set_char_box (stemthick#,
+                     width# + stemthick#,
+                     boxbot#,
+                     boxtop#);
+
        labels (1, 2, 3, 4);
 enddef;
 
@@ -152,33 +154,17 @@ enddef;
 fet_beginchar ("Longa notehead", "uM2");
        draw_longa (true);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
 fet_beginchar ("Longa notehead", "dM2");
        draw_longa (false);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Longa notehead", "uM2");
-               draw_longa (true);
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-
-
-       fet_beginchar ("Longa notehead", "dM2");
-               draw_longa (false);
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 def draw_brevis (expr linecount, line_thickness_multiplier) =
        save stemthick, fudge, gap;
 
@@ -201,11 +187,6 @@ def draw_brevis (expr linecount, line_thickness_multiplier) =
        draw_outside_ellipse (1.80, 0, 0.707, 0);
        undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
 
-       set_char_box (stemthick# * linecount + gap# * (linecount - 1),
-                     width# + stemthick# * linecount + gap# * (linecount - 1),
-                     noteheight# / 2,
-                     noteheight# / 2);
-
        define_pixels (gap);
        pickup pencircle scaled stemthick;
 
@@ -221,6 +202,11 @@ def draw_brevis (expr linecount, line_thickness_multiplier) =
                quanted_line_length := max (0.77, line_length);
        fi;
 
+       set_char_box (stemthick# * linecount + gap# * (linecount - 1),
+                     width# + stemthick# * linecount + gap# * (linecount - 1),
+                     staff_space# * quanted_line_length,
+                     staff_space# * quanted_line_length);
+
        bot y1 = -quanted_line_length * staff_space;
        top y2 = quanted_line_length * staff_space;
        rt x1 - fudge = 0;
@@ -246,35 +232,17 @@ enddef;
 fet_beginchar ("Brevis notehead", "sM1");
        draw_brevis (1, 1);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Brevis notehead", "sM1");
-               draw_brevis(1, 1);
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 fet_beginchar ("Double-lined brevis notehead", "sM1double");
        draw_brevis (2, 0.8);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Double-lined brevis notehead", "sM1double");
-               draw_brevis (2, 0.8);
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 fet_beginchar ("Whole notehead", "s0");
        draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0);
        undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
@@ -282,60 +250,26 @@ fet_beginchar ("Whole notehead", "s0");
 
        whole_notehead_width# := charwd;
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Whole notehead", "s0");
-               draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0,
-                                     0.707, 0);
-               undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
-                                      0.68, 2 stafflinethickness#);
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 fet_beginchar ("Half notehead", "s1");
        draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
        undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
 
        half_notehead_width# := charwd;
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Half notehead", "s1");
-               draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34,
-                                     0.66, 0.17);
-               undraw_inside_ellipse (3.25, 33, 0.81,
-                                      2.5 stafflinethickness#);
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 fet_beginchar ("Quarter notehead", "s2");
        draw_quarter_path;
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Quarter notehead", "s2");
-               draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31,
-                                     0.707, 0);
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
@@ -344,58 +278,26 @@ fet_beginchar ("Whole diamondhead", "s0diamond");
        undraw_inside_ellipse (1.30, 125, 0.6,
                               .4 staff_space# + stafflinethickness#);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Whole diamondhead", "s0diamond");
-               draw_outside_ellipse (1.80, 0, 0.495, 0);
-               undraw_inside_ellipse (1.30, 125, 0.6,
-                                      .4 staff_space# + stafflinethickness#);
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 fet_beginchar ("Half diamondhead", "s1diamond");
        draw_outside_ellipse (1.50, 34, 0.49, 0.17);
        undraw_inside_ellipse (3.5, 33, 0.80,
                               .3 staff_space# + 1.5 stafflinethickness#);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Half diamondhead", "s1diamond");
-               draw_outside_ellipse (1.50, 34, 0.49, 0.17);
-               undraw_inside_ellipse (3.5, 33, 0.80,
-                                      .3 staff_space#
-                                      + 1.5 stafflinethickness#);
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 fet_beginchar ("Quarter diamondhead", "s2diamond");
        draw_outside_ellipse (1.80, 35, 0.495, -0.25);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Quarter diamondhead", "s2diamond");
-               draw_outside_ellipse (1.80, 35, 0.495, -0.25);
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
@@ -554,19 +456,10 @@ enddef;
 fet_beginchar ("Whole trianglehead", "s0triangle");
        draw_whole_triangle_head;
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Whole trianglehead", "s0triangle");
-               draw_whole_triangle_head;
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 def draw_small_triangle_head (expr dir) =
        save hei, xs;
        save llap;
@@ -588,14 +481,14 @@ enddef;
 fet_beginchar ("Half trianglehead (downstem)", "d1triangle");
        draw_small_triangle_head (-1);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
 fet_beginchar ("Half trianglehead (upstem)", "u1triangle");
        draw_small_triangle_head (1);
 
-       draw_staff (-2, 2, 0.5);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
@@ -616,14 +509,14 @@ enddef;
 fet_beginchar ("Quarter trianglehead (upstem)", "u2triangle");
        draw_closed_triangle_head (1);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
 fet_beginchar ("Quarter trianglehead (downstem)", "d2triangle");
        draw_closed_triangle_head (-1);
 
-       draw_staff (-2, 2, 0.5);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
@@ -700,21 +593,21 @@ enddef;
 fet_beginchar ("Whole slashhead", "s0slash");
        draw_slash (4 slash_thick# + 0.5 staff_space#);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
 fet_beginchar ("Half slashhead", "s1slash");
        draw_slash (3.0 slash_thick# + 0.15 staff_space#);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
 fet_beginchar ("Quarter slashhead", "s2slash");
        draw_slash (1.5 slash_thick#);
 
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
@@ -828,28 +721,10 @@ fet_beginchar ("Whole Crossed notehead", "s0cross");
 
        draw_cross (3.75);
 
-       remember_pic := currentpicture;
-
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Whole Crossed notehead", "s0cross");
-               save wid, hei;
-
-               wid# := black_notehead_width# + 4 stafflinethickness#;
-               hei# := noteheight# + stafflinethickness#;
-
-               set_char_box (0, wid#, hei# / 2, hei# / 2);
-
-               currentpicture := remember_pic;
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 fet_beginchar ("Half Crossed notehead", "s1cross");
        save wid, hei;
 
@@ -860,28 +735,10 @@ fet_beginchar ("Half Crossed notehead", "s1cross");
 
        draw_cross (3.0);
 
-       remember_pic := currentpicture;
-
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Half Crossed notehead", "s1cross");
-               save wid, hei;
-
-               wid# := black_notehead_width# + 2 stafflinethickness#;
-               hei# := noteheight# + stafflinethickness# / 2;
-
-               set_char_box (0, wid#, hei# / 2, hei# / 2);
-
-               currentpicture := remember_pic;
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 fet_beginchar ("Crossed notehead", "s2cross");
        wid# := black_notehead_width#;
        hei# := noteheight#;
@@ -889,25 +746,10 @@ fet_beginchar ("Crossed notehead", "s2cross");
 
        draw_cross (1.0);
 
-       remember_pic := currentpicture;
-
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("Crossed notehead", "s2cross");
-               wid# := black_notehead_width#;
-               hei# := noteheight#;
-               set_char_box (0, wid#, hei# / 2, hei# / 2);
-
-               currentpicture := remember_pic;
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 fet_beginchar ("X-Circled notehead", "s2xcircle");
        save wid, hei;
        save cthick, cxd, cyd, dy;
@@ -953,29 +795,10 @@ fet_beginchar ("X-Circled notehead", "s2xcircle");
        z12 = (charwx * hppp, charwy * vppp);
        labels (12);
 
-       remember_pic := currentpicture;
-
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 fet_endchar;
 
 
-if test > 0:
-       fet_beginchar ("X-Circled notehead", "s2xcircle");
-               save wid, hei;
-               save cthick, cxr, cyr;
-
-               wid# := black_notehead_width# * sqrt (sqrt2);
-               hei# := noteheight# * sqrt (sqrt2);
-
-               set_char_box (0, wid#, hei# / 2, hei# / 2);
-
-               currentpicture := remember_pic;
-
-               draw_staff (-2, 2, 0.5);
-       fet_endchar;
-fi;
-
-
 %%%%%%%%
 %
 % SOLFA SHAPED NOTES
@@ -1399,66 +1222,65 @@ def draw_mi_head (expr width_factor, thickness_factor, mirror) =
 enddef;
 
 
-save mi_weight, mi_width;
+save mi_weight;
 mi_weight := 2;
-mi_width := 1.2;
 
 fet_beginchar ("Whole mihead", "s0mi");
-       draw_mi_head (mi_width * solfa_whole_width, mi_weight, false);
+       draw_mi_head (solfa_whole_width, mi_weight, false);
        fill path_out;
        unfill path_in;
 fet_endchar;
 
 
 fet_beginchar ("Half mihead", "s1mi");
-       draw_mi_head (mi_width * solfa_quarter_width, mi_weight, false);
+       draw_mi_head (solfa_quarter_width, mi_weight, false);
        fill path_out;
        unfill path_in;
 fet_endchar;
 
 
 fet_beginchar ("Quarter mihead", "s2mi");
-       draw_mi_head (mi_width * solfa_quarter_width, mi_weight, false);
+       draw_mi_head (solfa_quarter_width, mi_weight, false);
        fill path_out;
 fet_endchar;
 
 
 fet_beginchar ("Whole mirror mihead", "s0miMirror");
-       draw_mi_head (mi_width * solfa_whole_width, mi_weight, true);
+       draw_mi_head (solfa_whole_width, mi_weight, true);
        fill path_out;
        unfill path_in;
 fet_endchar;
 
 
 fet_beginchar ("Half  mirror mihead", "s1miMirror");
-       draw_mi_head (mi_width * solfa_quarter_width, mi_weight, true);
+       draw_mi_head (solfa_quarter_width, mi_weight, true);
        fill path_out;
        unfill path_in;
 fet_endchar;
 
 
 fet_beginchar ("Quarter mirror mihead", "s2miMirror");
-       draw_mi_head (mi_width * solfa_quarter_width, mi_weight, true);
+       draw_mi_head (solfa_quarter_width, mi_weight, true);
        fill path_out;
 fet_endchar;
 
 
 fet_beginchar ("Whole thin mihead", "s0miThin");
-       draw_mi_head (mi_width * solfa_whole_width, 1, false);
+       draw_mi_head (solfa_whole_width, 1, false);
        fill path_out;
        unfill path_in;
 fet_endchar;
 
 
 fet_beginchar ("Half thin mihead", "s1miThin");
-       draw_mi_head (mi_width * solfa_quarter_width, 1, false);
+       draw_mi_head (solfa_quarter_width, 1, false);
        fill path_out;
        unfill path_in;
 fet_endchar;
 
 
 fet_beginchar ("Quarter thin mihead", "s2miThin");
-       draw_mi_head (mi_width * solfa_quarter_width, 1, false);
+       draw_mi_head (solfa_quarter_width, 1, false);
        fill path_out;
 fet_endchar;
 
@@ -1623,11 +1445,12 @@ fet_endchar;
 %       so we can't just use the standard note font.
 %
 def draw_sol_head (expr filled) =
-       draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
+       draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
        if not filled:
-         undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
+         undraw_inside_ellipse (2.5 - puff_up_factor / 3.0, 31, 0.707,
+                                 3.5 stafflinethickness#);
        fi
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 enddef;
 
 fet_beginchar ("Whole solhead", "s0sol");
@@ -2143,12 +1966,11 @@ fet_endchar;
 %       Diamond shape
 %       Has up and down shapes for all hollow notes
 %
-save funk_mi_width, funk_mi_weight;
-funk_mi_width := 1.2;
+save funk_mi_weight;
 funk_mi_weight := 1.9;
 
 fet_beginchar ("Whole up Funk mihead", "u0miFunk");
-       draw_mi_head (funk_mi_width * funk_notehead_width,
+       draw_mi_head (funk_notehead_width,
                      funk_mi_weight, false);
        fill path_out;
        unfill path_in;
@@ -2156,7 +1978,7 @@ fet_endchar;
 
 
 fet_beginchar ("Whole down Funk mihead", "d0miFunk");
-       draw_mi_head (funk_mi_width * funk_notehead_width,
+       draw_mi_head (funk_notehead_width,
                      funk_mi_weight, true);
        fill path_out;
        unfill path_in;
@@ -2164,7 +1986,7 @@ fet_endchar;
 
 
 fet_beginchar ("Half up Funk mihead", "u1miFunk");
-       draw_mi_head (funk_mi_width * funk_notehead_width,
+       draw_mi_head (funk_notehead_width,
                      funk_mi_weight, false);
        fill path_out;
        unfill path_in;
@@ -2172,7 +1994,7 @@ fet_endchar;
 
 
 fet_beginchar ("Half down Funk mihead", "d1miFunk");
-       draw_mi_head (funk_mi_width * funk_notehead_width,
+       draw_mi_head (funk_notehead_width,
                      funk_mi_weight, true);
        fill path_out;
        unfill path_in;
@@ -2180,7 +2002,7 @@ fet_endchar;
 
 
 fet_beginchar ("Quarter Funk mihead", "s2miFunk");
-       draw_mi_head (funk_mi_width * funk_notehead_width,
+       draw_mi_head (funk_notehead_width,
                      funk_mi_weight, false);
        fill path_out;
 fet_endchar;
@@ -2246,7 +2068,7 @@ begingroup
        if not filled:
          undraw_inside_ellipse (1.9, 33, 0.74, 5.5 stafflinethickness#);
        fi
-       draw_staff (-2, 2, 0);
+       draw_staff_if_debugging (-2, 2);
 endgroup
 enddef;
 
@@ -2688,7 +2510,7 @@ fet_endchar;
 %       Symmetric for all hollow notes
 %
 save walker_mi_width, walker_mi_weight;
-walker_mi_width := 1.2;
+walker_mi_width := 1;
 walker_mi_weight := 1.5;
 
 fet_beginchar ("Whole Walker mihead", "s0miWalker");