2 % feta-params.mf -- global parameters for both feta and parmesan fonts
4 % source file of the GNU LilyPond music typesetter
6 % (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 % The design size of a staff should really be the
12 % staff_space, but we use staffsize for historical reasons.
15 staff_space# := staffsize# / (stafflines - 1);
16 staff_space_rounded# := staff_space#;
20 % Measuring on pocket scores turns out: stafflinethickness is
21 % largely independent on staff size, and generally about 0.5 pt.
23 % By request of WL, we tune down the blackness a little
24 % for increased contrast with beams.
27 %% !! synchronize with paper.scm
29 save fixed_line_thickness, variable_line_factor;
30 fixed_line_thickness + variable_line_factor * 5 pt# = 0.50 pt#;
31 fixed_line_thickness + variable_line_factor * 4.125 pt# = 0.47 pt#;
33 stafflinethickness# := fixed_line_thickness
34 + variable_line_factor * staff_space#;
35 stafflinethickness_rounded# := stafflinethickness#;
38 % The following tunes the general blackness of the glyphs.
41 linethickness# := stafflinethickness#; %% 0.5 pt#;
42 linethickness_rounded# := linethickness#;
45 % bigger puff_up_factor, relatively thicker stafflines.
47 % 20 pt = puff_up_factor 0
48 % 10 pt = puff_up_factor 1
51 puff_up_factor = (linethickness# - 0.1 staff_space#) / (0.1 staff_space#);
54 stemthickness# := 1.3 stafflinethickness#;
55 stemthickness_rounded# := stemthickness#;
56 ledgerlinethickness# := 2 stafflinethickness#;
57 ledgerlinethickness_rounded# := ledgerlinethickness#;
59 define_pixels (staff_space, stemthickness, stafflinethickness,
60 ledgerlinethickness, linethickness);
61 define_whole_pixels (staff_space_rounded);
62 define_whole_blacker_pixels (stemthickness_rounded);
63 define_whole_vertical_blacker_pixels (stafflinethickness_rounded,
64 ledgerlinethickness_rounded,
65 linethickness_rounded);
67 if ledgerlinethickness_rounded > 2 stafflinethickness_rounded:
68 ledgerlinethickness_rounded := 2 stafflinethickness_rounded;
72 % Because of the engraving/stamping process, no traditional
73 % characters have sharp edges and corners.
74 % The following variable controls the amount of `roundness'.
76 % This is not a meta variable: it is related to absolute sizes.
78 % FIXME: According to [Wanske], only outside corners should be round
79 % I don't think we do this anywhere -- jcn
82 blot_diameter# = .40 pt#;
83 if (blot_diameter# * hppp) < 1:
84 blot_diameter# := 1 / hppp;
86 if (blot_diameter# * vppp) < 1:
87 blot_diameter# := 1 / vppp;
90 define_pixels (blot_diameter);
97 % Some glyphs have to be positioned exactly between stafflines (clefs,
98 % note heads). This needs some care at lower resolutions.
100 % Most glyphs use the staffline thickness and the space between two
101 % staff lines as the fundamental parameters. The latter is the distance
102 % between the middle of one staff line to the middle of the next. To
103 % say it differently, the value `staff_space' is the sum of one staff line
104 % thickness and the whitespace between two adjacent staff lines.
106 % Normally, feta's vertical origin for glyphs is either the middle
107 % between two staff lines or the middle of a staff line. For example, the
108 % lower edge of the central staff line is at the vertical position
109 % `-<staffline thickness> / 2', and the upper edge at
110 % `<staffline thickness> / 2'. Here we need a value rounded to an integer
111 % (the feta code uses `stafflinethickness_rounded' for that purpose).
113 % If we have an odd number of pixels as the staffline thickness, Metafont
114 % rounds `-stafflinethickness_rounded / 2' towards zero and
115 % `stafflinethickness_rounded / 2' towards infinity. Example: `round -1.5'
116 % yields -1, `round 1.5' yields 2. The whitespace between staff lines is
117 % handled similarly. If we assume that stafflinethickness_rounded is odd,
118 % we have the following cases:
120 % o The glyph is centered between three stafflines or five stafflines
121 % (clef, `c' meter). We have this:
130 % ...... ___________ 1 .................. x axis
139 % As can be seen, we get symmetry if we split staff lines into two
140 % equal parts `a' and a pixel line with thickness 1. Consequently, we
141 % use the following algorithm:
143 % . Decrease the height `h' by 1 temporarily.
145 % . Compute the path for the upper half of the glyph.
147 % . Mirror the path at the x axis.
149 % . Shift the upper half one pixel up and connect it with the lower path.
151 % . Restore height and decrease `d' by 1.
153 % o The glyph is centered between two or four staff lines, and the origin is
154 % the middle of the whitespace. Assuming that the the whitespace consists
155 % of an odd number of pixels, we have this:
163 % .................. 1 ................. x axis
171 % For symmetrical glyphs, this leads to a similar algorithm as above.
172 % Glyphs which can't be constructed from an upper and lower part need
173 % to be handled differently, namely to shift up the vertical center by
180 % .................. 0.5 ................ x axis
188 feta_space_shift := 0;
190 % Use this for paths with a slant of 45 degrees to assure that
191 % the middle point of a penpos gets covered.
193 feta_offset := (0, 0);
200 if odd stafflinethickness_rounded:
204 if odd (staff_space_rounded - stafflinethickness_rounded):
205 feta_space_shift := 1;
208 feta_offset := (0.5, 0.5);
210 pickup pencircle scaled 1;
213 feta_fillpen := savepen;