]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-params.mf
Add '-dcrop' option to ps and svg backends
[lilypond.git] / mf / feta-params.mf
index 544251932cf67952c19ac1f6a65170e6a43b7cd0..81325dc46e0a23a1cd0dd4bec93747666bded4e9 100644 (file)
@@ -1,16 +1,27 @@
+% Feta (not the Font-En-Tja) music font -- global parameters for both feta and parmesan fonts
+% This file is part of LilyPond, the GNU music typesetter.
 %
-% feta-params.mf -- global parameters for both feta and parmesan fonts
+% Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 %
-% source file of the GNU LilyPond music typesetter
+% 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, or under the SIL Open Font License.
 %
-% (c) 1997--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
+% LilyPond is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
 stafflines := 5;
 
 %
-% The design size of a staff should really be the 
+% The design size of a staff should really be the
 % staff_space, but we use staffsize for historical reasons.
-% 
+%
 
 staff_space# := staffsize# / (stafflines - 1);
 staff_space_rounded# := staff_space#;
@@ -31,11 +42,11 @@ fixed_line_thickness + variable_line_factor * 5 pt# = 0.50 pt#;
 fixed_line_thickness + variable_line_factor * 4.125 pt# = 0.47 pt#;
 
 stafflinethickness# := fixed_line_thickness
-                      + variable_line_factor * staff_space#; 
+                      + variable_line_factor * staff_space#;
 stafflinethickness_rounded# := stafflinethickness#;
 
 %
-% The following tunes the general blackness of the glyphs. 
+% The following tunes the general blackness of the glyphs.
 %
 
 linethickness# := stafflinethickness#;         %% 0.5 pt#;
@@ -68,7 +79,7 @@ if ledgerlinethickness_rounded > 2 stafflinethickness_rounded:
        ledgerlinethickness_rounded := 2 stafflinethickness_rounded;
 fi;
 
-% 
+%
 % Because of the engraving/stamping process, no traditional
 % characters have sharp edges and corners.
 % The following variable controls the amount of `roundness'.
@@ -151,8 +162,8 @@ define_pixels (blot_diameter);
 %   . Restore height and decrease `d' by 1.
 %
 % o The glyph is centered between two or four staff lines, and the origin is
-%   the middle of the whitespace.  Assuming that the the whitespace consists
-%   of an odd number of pixels, we have this:
+%   the middle of the whitespace.  Assuming that the whitespace consists of
+%   an odd number of pixels, we have this:
 %
 %          -----------
 %                       b
@@ -211,3 +222,101 @@ else:
 fi;
 
 feta_fillpen := savepen;
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Notehead width and height are defined here.
+%
+%
+% 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).
+%
+
+%% FIXME
+% There is a problem with noteheads slightly extending beyond the staff
+% lines.  This is due to the fact that staff_space + stafflinethickness
+% is sometimes an odd number, so the nothead height and depth are not
+% integers.  Then, when the font is converted to an outline font, the
+% system rounds up the 0.5 left over from dividing the notehead height
+% in two, and the notehead extends slightly beyond the staff line.
+% In order to resolve this problem, we use overdone_heads to slightly
+% reduce the notehead height.  Empirically, we have determined that 
+% reducing by 10% of stafflinethickness solves the problem.
+
+overdone_heads = -0.1;
+noteheight# := staff_space# + (1 + overdone_heads) * stafflinethickness#;
+
+define_pixels (slash_thick);
+define_whole_vertical_pixels (noteheight);
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This is used to draw all elliptical notes; it also sets
+% black_notehead_width, so it should be called in any file that
+% needs the value of black_notehead_width.
+%
+% 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 draw_quarter_path =
+        draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
+enddef;
+
+test_outlines := 0;
+draw_quarter_path;
+black_notehead_width# := charwd;
+
+define_pixels (slash_thick);
+define_whole_vertical_pixels (noteheight);
+
+