]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/staff-symbol.cc
Doc-fr: NR-2.9 Ancient notation
[lilypond.git] / lily / staff-symbol.cc
index abfbe0ef0dc25848c265af1ce4f0c350f4b7098f..ed15db7d739c09930ea59b762766ae54f11a778e 100644 (file)
@@ -22,6 +22,7 @@
 #include "lookup.hh"
 #include "dimensions.hh"
 #include "output-def.hh"
+#include "paper-column.hh"
 #include "warn.hh"
 #include "item.hh"
 #include "staff-symbol-referencer.hh"
@@ -66,10 +67,10 @@ Staff_symbol::print (SCM smob)
         {
           Item *x = sp->get_bound (d);
 
-          span_points[d] = x->relative_coordinate (common, X_AXIS);
-          if (!x->break_status_dir ()
-              && !x->extent (x, X_AXIS).is_empty ())
-            span_points[d] += x->extent (x, X_AXIS)[d];
+          span_points[d] = ((!x->break_status_dir ()
+                             && !x->extent (x, X_AXIS).is_empty ())
+                            ? Paper_column::break_align_width (x, ly_symbol2scm ("break-alignment"))[d]
+                            : x->relative_coordinate (common, X_AXIS));
         }
 
       span_points[d] -= d * t / 2;
@@ -156,6 +157,7 @@ Staff_symbol::ledger_positions (Grob *me, int pos)
   Direction dir = (Direction)sign (pos - nearest_line);
 
   if (scm_is_pair (ledger_positions))
+    // custom ledger line positions
     {
       Real min_pos = HUGE_VAL;
       Real max_pos = -HUGE_VAL;
@@ -181,9 +183,11 @@ Staff_symbol::ledger_positions (Grob *me, int pos)
       ledger_fill.add_point (pos + 0.5 * dir + ledger_extra * dir);
 
       // fill the Interval ledger_fill with ledger lines
-      int n = floor ((ledger_fill[DOWN] - min_pos) / cycle);
+      int n = (int) floor ((ledger_fill[DOWN] - min_pos) / cycle);
       Real current;
       SCM s = scm_cdr (ledger_positions);
+      if (!scm_is_pair (s) || cycle < 0.1)
+        return values;
       do
         {
           s2 = scm_car (s);
@@ -225,8 +229,9 @@ Staff_symbol::ledger_positions (Grob *me, int pos)
       while (current <= ledger_fill[UP]);
     }
   else
+    // normal ledger lines
     {
-      int ledger_count = floor ((abs (nearest_line - pos) + ledger_extra) / 2);
+      int ledger_count = (int) floor ((abs (nearest_line - pos) + ledger_extra) / 2);
       values.resize (ledger_count);
       for (int i = 0; i < ledger_count; i++)
         {