]> git.donarmstrong.com Git - lilypond.git/commitdiff
Do not generate negative dash pattern entries for small dash-periods.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 29 Jul 2007 17:21:49 +0000 (10:21 -0700)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 29 Jul 2007 17:21:49 +0000 (10:21 -0700)
input/regression/line-dash-small-period.ly [new file with mode: 0644]
lily/line-interface.cc
lily/ottava-bracket.cc
ps/music-drawing-routines.ps

diff --git a/input/regression/line-dash-small-period.ly b/input/regression/line-dash-small-period.ly
new file mode 100644 (file)
index 0000000..8bbb1cb
--- /dev/null
@@ -0,0 +1,16 @@
+\header {
+
+  texidoc = "Generate valid postscript even if dash-period is small
+  compared to line thickness."
+
+}
+
+\version "2.11.29"
+\relative {
+  \override Staff.OttavaBracket #'dash-period = #0.1
+  \override Score.OttavaBracket #'dash-fraction = #1
+
+  #(set-octavation 1)
+  c4 c
+}
+
index 8720bba596f14eb5085318c184057353c45107f9..f936b0498f26d2abd1cd5e61d27938a36bf79e37 100644 (file)
@@ -127,7 +127,7 @@ Line_interface::make_dashed_line (Real thick, Offset from, Offset to,
 {
   dash_fraction = min (max (dash_fraction, 0.0), 1.0);
   Real on = dash_fraction * dash_period + thick;
-  Real off = dash_period - on;
+  Real off = max (0.0, dash_period - on);
 
   SCM at = scm_list_n (ly_symbol2scm ("dashed-line"),
                       scm_from_double (thick),
@@ -231,6 +231,7 @@ Line_interface::line (Grob *me, Offset from, Offset to)
       Real len = (to-from).length ();
       
       int n = (int) rint ((len - period * fraction) / period);
+      n = max (0, n);
       if (n > 0)
        {
          /*
index cfd1d5d0363a294aa05617b71653fa6922a61efe..2f23261eb901cbe682d673aec3b1f66159d8bdef 100644 (file)
@@ -69,7 +69,8 @@ Ottava_bracket::print (SCM smob)
   SCM markup = me->get_property ("text");
   Stencil text;
   if (Text_interface::is_markup (markup))
-    text = *unsmob_stencil (Text_interface::interpret_markup (layout->self_scm (), properties, markup));
+    text = *unsmob_stencil (Text_interface::interpret_markup (layout->self_scm (),
+                                                             properties, markup));
 
   Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pair"),
                                                  Interval (0, 0));
index 2df5913accf0d072761995820353bc41245e4eca..e263d3d29e0a5908591f199a3eaa3e515afe0dd1 100644 (file)
@@ -197,7 +197,7 @@ bind def
        stroke
 } bind def
 
-/draw_dashed_line % dx dy thickness dashpattern draw_dashed_line
+/draw_dashed_line % dx dy thickness dashpattern offset draw_dashed_line
 {
        1 setlinecap
        1 setlinejoin