3 % The stems of the natural are brushed (at least, in Barenreiter SCS)
7 save full_width, full_height;
8 save stem_thickness, stem_end_thickness_multiplier;
9 save beam_thickness, beam_slant, hole_highest_point;
11 full_height# := 3 staff_space#;
12 full_width# := 2/3 staff_space#;
13 stem_thickness# := 0.09 staff_space# + 0.5 stafflinethickness#;
14 stem_end_thickness_multiplier := 10/7;
15 beam_slant := 1.266 stafflinethickness;
16 beam_thickness := 0.485 staff_space - stafflinethickness;
17 hole_highest_point := 0.5 (staff_space - stafflinethickness);
20 def draw_natural (expr arrowup, arrowdown) =
21 save upstem_factor, downstem_factor;
22 save upstem_end_thickness, downstem_end_thickness;
23 save half_height, half_box_height;
24 save beam_direction, r_stem_top_path, l_stem_bottom_path;
26 path r_stem_top_path, l_stem_bottom_path;
28 upstem_factor = downstem_factor = stem_end_thickness_multiplier;
30 half_height# := 0.5 full_height#;
31 define_pixels (half_height);
32 define_pixels (full_width);
34 set_char_box (0, full_width#, half_height#, half_height#);
35 d := d - feta_space_shift;
38 b := b + 3 stafflinethickness;
39 h := h + 1.2 staff_space;
40 % to look nice, arrowed stems must be less brushed
41 upstem_factor := 0.5 (1 + upstem_factor);
44 w := w + 3 stafflinethickness;
45 d := d + 1.2 staff_space;
46 % to look nice, arrowed stems must be less brushed
47 downstem_factor := 0.5 (1 + downstem_factor);
50 upstem_end_thickness# = upstem_factor * stem_thickness#;
51 downstem_end_thickness# = downstem_factor * stem_thickness#;
52 define_whole_blacker_pixels (upstem_end_thickness, downstem_end_thickness);
53 define_whole_blacker_pixels (stem_thickness);
55 half_box_height := hole_highest_point + beam_thickness
56 %% correction for the fact that x11 != x12.
57 %% ideally y2 should be calculated from y11
58 %% and beam_thickness, but the brushed stems
59 %% would cause a cyclic dependency:
60 %% y2 -> x11 -> y14 -> y13 -> y12 -> y2
61 + 0.5 stem_thickness * beam_slant / full_width;
65 pickup pencircle scaled stem_thickness;
67 penpos1 (upstem_end_thickness, 0);
68 penpos3 (downstem_end_thickness, 0);
69 penpos2 (stem_thickness, 0);
70 penpos4 (stem_thickness, 0);
79 top y2 = vround (half_box_height);
80 y4 = -y2 + feta_space_shift;
82 l_stem_bottom_path := z4r{z4r - z1r}
86 r_stem_top_path := z2r{z2r - z3r}
90 fill simple_serif (z1l, z1r, -30)
94 fill simple_serif (z3l, z3r, 30)
100 beam_direction = (full_width, beam_slant);
102 z11 = z3l + whatever * (z2l - z3l);
103 y11 = vround (hole_highest_point);
104 z12 = directionpoint -beam_direction of r_stem_top_path;
105 z13 = z12 + whatever * beam_direction;
107 z14 = z11 + whatever * beam_direction;
110 z21 = z4r + whatever * (z1r - z4r);
111 y21 = -y11 + feta_space_shift;
112 z22 = directionpoint -beam_direction of l_stem_bottom_path;
113 z23 = z22 + whatever * beam_direction;
115 z24 = z21 + whatever * beam_direction;
131 draw_arrow (z1, upstem_end_thickness,
132 z1l - z4l, stafflinethickness / 2, false);
135 draw_arrow (z3, downstem_end_thickness,
136 z2r - z3r, stafflinethickness / 2, true);
140 penlabels (1, 2, 3, 4);
141 labels (11, 12, 13, 14, 21, 22, 23, 24);
142 draw_staff_if_debugging (-2, 2);
146 fet_beginchar ("Natural", "natural");
147 draw_natural (false, false);
151 fet_beginchar ("Arrowed Natural (arrow up)", "natural.arrowup");
152 draw_natural (true, false);
156 fet_beginchar ("Arrowed Natural (arrow down)", "natural.arrowdown");
157 draw_natural (false, true);
161 fet_beginchar ("Arrowed Natural (arrows up and down)", "natural.arrowboth");
162 draw_natural (true, true);