From: Han-Wen Nienhuys <hanwen@xs4all.nl> Date: Fri, 26 Jan 2007 01:59:07 +0000 (+0100) Subject: Fix #174. X-Git-Tag: release/2.10.14-1~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=954667c556cfa0b7c01f456e6e9cee0a1c1f1af8;p=lilypond.git Fix #174. Tune dash-period to end on a full dash. --- diff --git a/input/regression/line-dashed-period.ly b/input/regression/line-dashed-period.ly new file mode 100644 index 0000000000..dd0b55e898 --- /dev/null +++ b/input/regression/line-dashed-period.ly @@ -0,0 +1,27 @@ +\header { + + texidoc = "The period of a dashed line is adjusted such that it +starts and ends on a full dash. " + +} + +\version "2.11.13" + +\layout { + indent = 0.0\mm + ragged-right = ##T +} + +\relative << + \new Staff { + \override DynamicTextSpanner #'dash-fraction = ##f + \setTextCresc + c1_\< c c1\! + } + \new Staff { + \override DynamicTextSpanner #'dash-period = #3 + \override DynamicTextSpanner #'dash-fraction = #0.3 + \setTextCresc + c1^\< c c1\! + } +>> diff --git a/lily/line-interface.cc b/lily/line-interface.cc index ff7fae5783..3f66437f3f 100644 --- a/lily/line-interface.cc +++ b/lily/line-interface.cc @@ -128,9 +128,14 @@ Line_interface::line (Grob *me, Offset from, Offset to) Real period = Staff_symbol_referencer::staff_space (me) * robust_scm2double (me->get_property ("dash-period"), 1.0); - if (period < 0) + if (period <= 0) return Stencil (); + Real len = (to-from).length(); + + int n = (int) rint ((len - period * fraction) / period); + period = ((to-from).length() - period * fraction) / n; + stil = make_dashed_line (thick, from, to, period, fraction); } else