summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--input/regression/ledger-extra.ly28
-rw-r--r--lily/staff-symbol.cc15
2 files changed, 42 insertions, 1 deletions
diff --git a/input/regression/ledger-extra.ly b/input/regression/ledger-extra.ly
new file mode 100644
index 0000000000..55ad653ef6
--- /dev/null
+++ b/input/regression/ledger-extra.ly
@@ -0,0 +1,28 @@
+\version "2.19.36"
+
+\header {
+ texidoc = "The ledger-extra grob property increases
+the number of ledger lines drawn, but they are not
+drawn on top of staff lines."
+}
+
+notes = \relative {
+ \time 6/8
+ a4. b | c d | e f |
+ g4. a | b c | d e |
+ f4. g | a b |
+}
+
+\new Staff {
+ \notes
+}
+
+\new Staff {
+ \override Staff.StaffSymbol.ledger-extra = 1
+ \notes
+}
+
+\new Staff {
+ \override Staff.StaffSymbol.ledger-extra = 2
+ \notes
+}
diff --git a/lily/staff-symbol.cc b/lily/staff-symbol.cc
index de88102d14..256a9bdd0d 100644
--- a/lily/staff-symbol.cc
+++ b/lily/staff-symbol.cc
@@ -247,7 +247,20 @@ Staff_symbol::ledger_positions (Grob *me, int pos)
values[i] = nearest_line + dir * (ledger_count - i) * 2;
}
}
- return values;
+ // remove any ledger lines that would fall on staff lines,
+ // which can happen when ledger-extra > 0
+ vector<Real> final_values;
+ for (vector<Real>::const_iterator i = values.begin (),
+ e = values.end ();
+ i != e;
+ ++i)
+ {
+ if (find (line_positions.begin (), line_positions.end (), *i) == line_positions.end ())
+ {
+ final_values.push_back (*i);
+ }
+ }
+ return final_values;
}
int