]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-noteheads.mf
omit filename extension as in the rest of the file
[lilypond.git] / mf / feta-noteheads.mf
index a58e4bc89a7a6c607a3da1dea2478ecce9b8ba0f..82abf14e54bf3fb3ede1de6caab4cb6609a0f1cc 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--2012 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
@@ -82,47 +81,77 @@ endgroup;
 enddef;
 
 
-%
-% dimensions aren't entirely right.
-%
 def draw_longa (expr up) =
        save stemthick, fudge;
 
        stemthick# = 2 stafflinethickness#;
        define_whole_blacker_pixels (stemthick);
 
-       fudge = hround (blot_diameter / 2);
+       % Longas of smaller design sizes should have their lines farther
+       % apart (the overlap with notehead ellipsoid should be smaller).
+       fudge = hround (blot_diameter
+                       * min (max (-0.15,
+                                   (0.9
+                                    - (20 / (design_size + 4)))),
+                              0.3));
 
        draw_outside_ellipse (1.80, 0, 0.707, 0);
        undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
 
        pickup pencircle scaled stemthick;
 
+       % Longas of smaller design sizes should have their lines longer.
+       line_length := min (max (0.7, (64/60 - (design_size / 60))), 0.85);
+
+       % Line lengths between 0.72 and 0.77 are not nice
+       % because they are neither separate nor connected
+       % when there is an interval of fourth.
+       if line_length < 0.75:
+               quanted_line_length := min (0.72, line_length);
+       else:
+               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 = -d;
-               top y2 = h;
+               bot y1 = -final_line_length;
+               top y2 = final_line_length;
                rt x1 - fudge = 0;
                x1 = x2;
 
-               fudge + lft x3 = w;
+               fudge + lft x3 = width;
                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 = h;
+               top y2 = final_line_length;
                rt x1 - fudge = 0;
                x1 = x2;
 
-               fudge + lft x3 = w;
+               fudge + lft x3 = width;
                x4 = x3;
                y4 = y2;
-               bot y3 = -d;
+               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;
 
@@ -158,13 +187,17 @@ fi;
 
 
 def draw_brevis (expr linecount, line_thickness_multiplier) =
-       save stemthick, fudge;
+       save stemthick, fudge, gap;
 
        stemthick# = line_thickness_multiplier * 2 * stafflinethickness#;
        define_whole_blacker_pixels (stemthick);
 
-       % Breves of smaller design sizes should have their lines
-       % farther apart (the overlap should be smaller).
+       % double-lined breves of smaller design sizes should have
+       % bigger gap between the lines.
+       gap# := (0.95 - 0.008 * design_size) * stemthick#;
+
+       % Breves of smaller design sizes should have their lines farther
+       % apart (the overlap with notehead ellipsoid should be smaller).
        fudge = hround (blot_diameter
                        * min (max (-0.15,
                                    (0.8
@@ -175,6 +208,7 @@ 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#);
 
+       define_pixels (gap);
        pickup pencircle scaled stemthick;
 
        % Breves of smaller design sizes should have their lines longer.
@@ -189,25 +223,28 @@ 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;
        x1 = x2;
 
-       fudge + lft x3 = w;
+       fudge + lft x3 = width;
        x4 = x3;
        y4 = y2;
        y3 = y1;
 
-       % Breves of smaller design sizes should have their lines
-       % farther apart.
-       line_distance := (1.95 - 0.008 * design_size) * stemthick;
        for i := 0 step 1 until linecount - 1:
-               draw_gridline (z1 - (i * line_distance, 0),
-                              z2 - (i * line_distance, 0),
+               line_distance := i * (gap + stemthick);
+               draw_gridline (z1 - (line_distance, 0),
+                              z2 - (line_distance, 0),
                               stemthick);
-               draw_gridline (z3 + (i * line_distance, 0),
-                              z4 + (i * line_distance, 0),
+               draw_gridline (z3 + (line_distance, 0),
+                              z4 + (line_distance, 0),
                               stemthick);
        endfor;
 enddef;