5 % The design size of a staff should really be the
6 % staff_space, but we use staffsize for historical reasons.
9 staff_space# := staffsize# / (stafflines - 1);
10 staff_space_rounded# := staff_space#;
14 % Measuring on pocket scores turns out: stafflinethickness is
15 % largely independent on staff size, and generally about 0.5 pt.
17 % By request of WL, we tune down the blackness a little
18 % for increased contrast with beams.
21 %% !! synchronize with paper.scm
23 save fixed_line_thickness, variable_line_factor;
24 fixed_line_thickness + variable_line_factor * 5 pt# = 0.50 pt#;
25 fixed_line_thickness + variable_line_factor * 4.125 pt# = 0.47 pt#;
27 stafflinethickness# := fixed_line_thickness
28 + variable_line_factor * staff_space#;
29 stafflinethickness_rounded# := stafflinethickness#;
32 % The following tunes the general blackness of the glyphs.
35 linethickness# := stafflinethickness#; %% 0.5 pt#;
36 linethickness_rounded# := linethickness#;
39 % bigger puff_up_factor, relatively thicker stafflines.
41 % 20 pt = puff_up_factor 0
42 % 10 pt = puff_up_factor 1
45 puff_up_factor = (linethickness# - 0.1 staff_space#) / (0.1 staff_space#);
48 stemthickness# := 1.3 stafflinethickness#;
49 stemthickness_rounded# := stemthickness#;
50 ledgerlinethickness# := 2 stafflinethickness#;
51 ledgerlinethickness_rounded# := ledgerlinethickness#;
53 define_pixels (staff_space, stemthickness, stafflinethickness,
54 ledgerlinethickness, linethickness);
55 define_whole_pixels (staff_space_rounded);
56 define_whole_blacker_pixels (stemthickness_rounded);
57 define_whole_vertical_blacker_pixels (stafflinethickness_rounded,
58 ledgerlinethickness_rounded,
59 linethickness_rounded);
61 if ledgerlinethickness_rounded > 2 stafflinethickness_rounded:
62 ledgerlinethickness_rounded := 2 stafflinethickness_rounded;
66 % Because of the engraving/stamping process, no traditional
67 % characters have sharp edges and corners.
68 % The following variable controls the amount of `roundness'.
70 % This is not a meta variable: it is related to absolute sizes.
72 % FIXME: According to [Wanske], only outside corners should be round
73 % I don't think we do this anywhere -- jcn
76 blot_diameter# = .40 pt#;
77 if (blot_diameter# * hppp) < 1:
78 blot_diameter# := 1 / hppp;
80 if (blot_diameter# * vppp) < 1:
81 blot_diameter# := 1 / vppp;
84 define_pixels (blot_diameter);
91 % Some glyphs have to be positioned exactly between stafflines (clefs,
92 % note heads). This needs some care at lower resolutions.
94 % Most glyphs use the staffline thickness and the space between two
95 % staff lines as the fundamental parameters. The latter is the distance
96 % between the middle of one staff line to the middle of the next. To
97 % say it differently, the value `staff_space' is the sum of one staff line
98 % thickness and the whitespace between two adjacent staff lines.
100 % Normally, feta's vertical origin for glyphs is either the middle
101 % between two staff lines or the middle of a staff line. For example, the
102 % lower edge of the central staff line is at the vertical position
103 % `-<staffline thickness> / 2', and the upper edge at
104 % `<staffline thickness> / 2'. Here we need a value rounded to an integer
105 % (the feta code uses `stafflinethickness_rounded' for that purpose).
107 % If we have an odd number of pixels as the staffline thickness, Metafont
108 % rounds `-stafflinethickness_rounded / 2' towards zero and
109 % `stafflinethickness_rounded / 2' towards infinity. Example: `round -1.5'
110 % yields -1, `round 1.5' yields 2. The whitespace between staff lines is
111 % handled similarly. If we assume that stafflinethickness_rounded is odd,
112 % we have the following cases:
114 % o The glyph is centered between three stafflines or five stafflines
115 % (clef, `c' meter). We have this:
124 % ...... ___________ 1 .................. x axis
133 % As can be seen, we get symmetry if we split staff lines into two
134 % equal parts `a' and a pixel line with thickness 1. Consequently, we
135 % use the following algorithm:
137 % . Decrease the height `h' by 1 temporarily.
139 % . Compute the path for the upper half of the glyph.
141 % . Mirror the path at the x axis.
143 % . Shift the upper half one pixel up and connect it with the lower path.
145 % . Restore height and decrease `d' by 1.
147 % o The glyph is centered between two or four staff lines, and the origin is
148 % the middle of the whitespace. Assuming that the the whitespace consists
149 % of an odd number of pixels, we have this:
157 % .................. 1 ................. x axis
165 % For symmetrical glyphs, this leads to a similar algorithm as above.
166 % Glyphs which can't be constructed from an upper and lower part need
167 % to be handled differently, namely to shift up the vertical center by
174 % .................. 0.5 ................ x axis
182 feta_space_shift := 0;
184 % Use this for paths with a slant of 45 degrees to assure that
185 % the middle point of a penpos gets covered.
187 feta_offset := (0, 0);
194 if odd stafflinethickness_rounded:
198 if odd (staff_space_rounded - stafflinethickness_rounded):
199 feta_space_shift := 1;
202 feta_offset := (0.5, 0.5);
204 pickup pencircle scaled 1;
207 feta_fillpen := savepen;