% 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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;
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;
+ 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
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.
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;
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,
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;
-
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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;
-
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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;
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;
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;
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;
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;
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#;
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;
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
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;
% 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");
% 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;
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;
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;
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;
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;
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;
% 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");