]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/line-interface.cc
Merge branch 'master' into lilypond/translation
[lilypond.git] / lily / line-interface.cc
index 8c54fa7ed1d35a31aa9ca34405fd2a3e64bf7ec7..f936b0498f26d2abd1cd5e61d27938a36bf79e37 100644 (file)
@@ -48,7 +48,7 @@ Line_interface::make_trill_line (Grob *me,
                                           alist_chain));
 
   Stencil elt = fm->find_by_name ("scripts.trill_element");
-
+  elt.align_to (Y_AXIS, CENTER);
   Real elt_len = elt.extent (X_AXIS).length ();
   if (elt_len <= 0.0)
     {
@@ -65,7 +65,7 @@ Line_interface::make_trill_line (Grob *me,
     }
   while (len + elt_len < dz.length ());
 
-  line.rotate (dz.arg (), Offset (0,0));
+  line.rotate (dz.arg (), Offset (LEFT, CENTER));
   line.translate (from);
 
   return line; 
@@ -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),
@@ -225,9 +225,21 @@ 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);
+      n = max (0, n);
+      if (n > 0)
+       {
+         /*
+           TODO: figure out something intelligent for really short
+           sections.
+          */
+         period = ((to-from).length () - period * fraction) / n;
+       }
       stil = make_dashed_line (thick, from, to, period, fraction);
     }
   else