]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/line-interface.cc
MusicXML: Improvements / Fixes for articulations
[lilypond.git] / lily / line-interface.cc
index b9155a07ab53b4c0a28638282392e23218deb6e7..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),
@@ -228,16 +228,17 @@ Line_interface::line (Grob *me, Offset from, Offset to)
       if (period <= 0)
        return Stencil ();
 
-      Real len = (to-from).length();
+      Real len = (to-from).length ();
       
       int n = (int) rint ((len - period * fraction) / period);
+      n = max (0, n);
       if (n > 0)
        {
          /*
            TODO: figure out something intelligent for really short
            sections.
           */
-         period = ((to-from).length() - period * fraction) / n;
+         period = ((to-from).length () - period * fraction) / n;
        }
       stil = make_dashed_line (thick, from, to, period, fraction);
     }