diff options
author | Han-Wen Nienhuys <hanwen@xs4all.nl> | 2007-01-26 02:59:07 +0100 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@xs4all.nl> | 2007-01-26 02:59:07 +0100 |
commit | d640581d823b26d988046148b995e1a70f6ad735 (patch) | |
tree | 8a57f820ea0a8551f8a904b04d48a3441a499744 | |
parent | ade39b0e10fdf852db6254afac36473a1c66a4d3 (diff) |
Fix #174.
Tune dash-period to end on a full dash.
-rw-r--r-- | input/regression/line-dashed-period.ly | 27 | ||||
-rw-r--r-- | lily/line-interface.cc | 7 |
2 files changed, 33 insertions, 1 deletions
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 8c54fa7ed1..ebaceec65c 100644 --- a/lily/line-interface.cc +++ b/lily/line-interface.cc @@ -225,9 +225,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 |