From: Paul Morris Date: Wed, 6 Jan 2016 21:29:46 +0000 (-0500) Subject: Do not draw ledger lines on top of staff lines X-Git-Tag: release/2.19.36-1~23 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8dfb8cb1d1c7cdb47635ec49b7103194a447e2f9;p=lilypond.git Do not draw ledger lines on top of staff lines when StaffSymbol.ledger-extra > 0 --- 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 final_values; + for (vector::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