]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-noteheads.mf
Lilypond-book: don't crash in linewidth detection in latex mode when latex cannot...
[lilypond.git] / mf / feta-noteheads.mf
index e3323c16d1e7916f799d99712c78a6217a0d8686..a58e4bc89a7a6c607a3da1dea2478ecce9b8ba0f 100644 (file)
@@ -1,7 +1,7 @@
 % Feta (not the Font-En-Tja) music font -- implement noteheads
 % This file is part of LilyPond, the GNU music typesetter.
 %
-% Copyright (C) 1997--2010 Jan Nieuwenhuizen <janneke@gnu.org>
+% Copyright (C) 1997--2011 Jan Nieuwenhuizen <janneke@gnu.org>
 % & Han-Wen Nienhuys <hanwen@xs4all.nl>
 % & Juergen Reuter <reuter@ipd.uka.de>
 %
@@ -36,94 +36,20 @@ picture remember_pic;
 % NOTE HEAD VARIABLES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-save black_notehead_width, noteheight;
-save half_notehead_width, whole_notehead_width, slash_thick;
-save slash_slope, overdone_heads, solfa_noteheight;
+save half_notehead_width, whole_notehead_width;
+save solfa_noteheight;
 
-numeric noteheight;
-numeric slash_thick;
-numeric black_notehead_width;
 numeric whole_notehead_width;
 numeric half_notehead_width;
 
-
 fet_begingroup ("noteheads");
 
 
-% Slope of slash.  From scm/grob-description.scm.  How to auto-copy?
-slash_slope := 1.7;
-
-% Thickness of slash lines.  Quarter notes get 1.5slt width.
-slash_thick# := 2/3 * 0.48 staff_space#;
-
-
-%
-% Hand-engraved music often has balls extending above and below
-% the lines.  If you like that, modify overdone heads (unit:
-% stafflinethickness).
-%
-overdone_heads = 0.0;
-noteheight# := staff_space# + (1 + overdone_heads) * stafflinethickness#;
-
-
 %
 % solfa heads should not overlap on chords.
 %
 solfa_noteheight# := staff_space# - stafflinethickness#;
 
-define_pixels (slash_thick);
-define_whole_vertical_pixels (noteheight);
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% SLANT moves both extrema on the long axis (by SLANT * ELLIPTICITY,
-% so SLANT = -1, puts the extreme on the long axis next to the short
-% axis one).
-%
-
-def draw_outside_ellipse (expr ellipticity, tilt, superness, slant) =
-       save attachment_y;
-       save pat;
-       path pat;
-
-       pat := superellipse ((ellipticity, 0), (-slant * ellipticity, 1.0),
-                            (-ellipticity, 0), (slant * ellipticity, -1.0),
-                            superness);
-       pat := pat rotated tilt;
-
-       save top_point, right_point;
-       pair top_point, right_point;
-
-       top_point := directionpoint left of pat;
-       right_point := directionpoint up of pat;
-
-       save scaling, width;
-
-       scaling# = noteheight# / (2 ypart (top_point));
-       width# := 2 xpart (right_point) * scaling#;
-       define_pixels (scaling, width);
-
-       set_char_box (0, width#, noteheight# / 2, noteheight# / 2);
-
-       d := d - feta_space_shift;
-
-       % attachment Y
-       charwy := ypart (right_point) * scaling#;
-       charwx := width#;
-
-       pat := pat scaled scaling shifted (w / 2, .5 (h - d));
-
-       width := hround width;
-
-       if test_outlines = 1:
-               draw pat;
-       else:
-               fill pat;
-       fi;
-enddef;
-
-
 def undraw_inside_ellipse (expr ellipticity, tilt, superness, clearance) =
 begingroup
        save pat;
@@ -231,24 +157,40 @@ if test > 0:
 fi;
 
 
-%
-% dimensions aren't entirely right.
-%
-def draw_brevis (expr linecount) =
+def draw_brevis (expr linecount, line_thickness_multiplier) =
        save stemthick, fudge;
 
-       stemthick# = 2 stafflinethickness#;
+       stemthick# = line_thickness_multiplier * 2 * stafflinethickness#;
        define_whole_blacker_pixels (stemthick);
 
-       fudge = hround (blot_diameter / 2);
+       % Breves of smaller design sizes should have their lines
+       % farther apart (the overlap should be smaller).
+       fudge = hround (blot_diameter
+                       * min (max (-0.15,
+                                   (0.8
+                                    - (20 / (design_size + 4))
+                                    + .1 linecount)),
+                              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;
 
-       bot y1 = -d;
-       top y2 = h;
+       % Breves 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;
+
+       bot y1 = -quanted_line_length * staff_space;
+       top y2 = quanted_line_length * staff_space;
        rt x1 - fudge = 0;
        x1 = x2;
 
@@ -257,17 +199,22 @@ def draw_brevis (expr linecount) =
        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 - (1.5 * i * stemthick, 0),
-                              z2 - (1.5 * i * stemthick, 0), stemthick);
-               draw_gridline (z3 + (1.5 * i * stemthick, 0),
-                              z4 + (1.5 * i * stemthick, 0), stemthick);
+               draw_gridline (z1 - (i * line_distance, 0),
+                              z2 - (i * line_distance, 0),
+                              stemthick);
+               draw_gridline (z3 + (i * line_distance, 0),
+                              z4 + (i * line_distance, 0),
+                              stemthick);
        endfor;
 enddef;
 
 
 fet_beginchar ("Brevis notehead", "sM1");
-       draw_brevis (1);
+       draw_brevis (1, 1);
 
        draw_staff (-2, 2, 0);
 fet_endchar;
@@ -275,7 +222,7 @@ fet_endchar;
 
 if test > 0:
        fet_beginchar ("Brevis notehead", "sM1");
-               draw_brevis(1);
+               draw_brevis(1, 1);
 
                draw_staff (-2, 2, 0.5);
        fet_endchar;
@@ -283,7 +230,7 @@ fi;
 
 
 fet_beginchar ("Double-lined brevis notehead", "sM1double");
-       draw_brevis (2);
+       draw_brevis (2, 0.8);
 
        draw_staff (-2, 2, 0);
 fet_endchar;
@@ -291,7 +238,7 @@ fet_endchar;
 
 if test > 0:
        fet_beginchar ("Double-lined brevis notehead", "sM1double");
-               draw_brevis (2);
+               draw_brevis (2, 0.8);
 
                draw_staff (-2, 2, 0.5);
        fet_endchar;
@@ -344,10 +291,7 @@ fi;
 
 
 fet_beginchar ("Quarter notehead", "s2");
-       % used to have 32. With 31, they are slightly bolder.
-       draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
-       black_notehead_width# := charwd;
-
+       draw_quarter_path;
        draw_staff (-2, 2, 0);
 fet_endchar;