- If there is no staff-symbol, we get -1 from the next
- calculation. That's a nonsense value, which would collapse the
- barline so we return 0.0 in the next alternative.
- */
- Real ysize = (Staff_symbol_referencer::line_count (me) -1);
- ysize = ysize * ss + Staff_symbol_referencer::line_thickness (me);
- return scm_from_double (ysize);
+ We have to scale the dashing so it starts and ends with half a
+ dash exactly.
+ */
+ int dashes = int (rint (h / ss));
+ Real total_dash_size = h / dashes;
+ Real factor = (dash_size - thick) / ss;
+
+ SCM at = scm_list_n (ly_symbol2scm ("dashed-line"),
+ scm_from_double (thick),
+ scm_from_double (factor * total_dash_size),
+ scm_from_double ((1-factor) * total_dash_size),
+ scm_from_double (0),
+ scm_from_double (h),
+ scm_from_double (factor * total_dash_size * 0.5),
+ SCM_UNDEFINED);
+
+ Box box;
+ box.add_point (Offset (0, 0));
+ box.add_point (Offset (0, h));
+
+ Stencil s (box, at);
+ s.translate (Offset (thick/2, -h/2));
+ return s;