]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #174.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 26 Jan 2007 01:59:07 +0000 (02:59 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 26 Jan 2007 01:59:07 +0000 (02:59 +0100)
Tune dash-period to end on a full dash.

input/regression/line-dashed-period.ly [new file with mode: 0644]
lily/line-interface.cc

diff --git a/input/regression/line-dashed-period.ly b/input/regression/line-dashed-period.ly
new file mode 100644 (file)
index 0000000..dd0b55e
--- /dev/null
@@ -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\!
+  }
+>>
index 8c54fa7ed1d35a31aa9ca34405fd2a3e64bf7ec7..ebaceec65c4ba2486bd147a6c18f0602d0efd34f 100644 (file)
@@ -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