- Real y = (- (c - 1.0) / 2 + 0.5 + i) * staff_space;
- Stencil d (dot);
-
- d.translate_axis (y, Y_AXIS);
- m.add_stencil (d);
+ Interval staff_extent = staff->extent (staff, Y_AXIS);
+
+ /*
+ assume staff lines are disposed equally at unit space;
+ put a dot into each space within extent (may extend staff_extent).
+
+ staff_extent is an interval of two integers or two half-integers;
+ in the former case dots are to be placed at half-integers,
+ in the latter at integers.
+
+ these integers are not exact due to staff line thickness.
+ */
+ int const pos = int (rint (staff_extent.at (UP) * 2));
+ Real const correction = pos & 1 ? 0.0 : 0.5;
+
+ for (int i = int (rint (extent.at (DOWN) + (0.5 - correction))),
+ e = int (rint (extent.at (UP) + (0.5 - correction)));
+ i < e;
+ ++i)
+ {
+ Stencil d (dot);
+
+ d.translate_axis (i + correction, Y_AXIS);
+ m.add_stencil (d);
+ }