From 831d5ee5d07ec00f00eb0cf0f87bf8ad82388d5f Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Sun, 17 Aug 2008 21:38:25 -0700 Subject: [PATCH] Fix spacing when there is an empty barline. --- input/regression/spacing-to-empty-barline.ly | 42 ++++++++++++++++++++ lily/note-spacing.cc | 8 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 input/regression/spacing-to-empty-barline.ly diff --git a/input/regression/spacing-to-empty-barline.ly b/input/regression/spacing-to-empty-barline.ly new file mode 100644 index 0000000000..ac8bced723 --- /dev/null +++ b/input/regression/spacing-to-empty-barline.ly @@ -0,0 +1,42 @@ +\version "2.11.50" + +\header { + texidoc = "An empty barline does not confuse the spacing engine too much. +The two scores should look approximately the same." +} + +\layout { + \context { + \Score + \accepts "Top" + } + + \context { + \name "Top" + \alias "Staff" + \type "Engraver_group" + \consists "Output_property_engraver" + \consists "Bar_engraver" + \consists "Skip_event_swallow_translator" + \consists "Axis_group_engraver" + + \override VerticalAxisGroup #'Y-extent = ##f + \override VerticalAxisGroup #'minimum-Y-extent = ##f + \override BarLine #'transparent = ##t + } +} + +\paper { + ragged-right = ##t +} + +\score { + << + \new Top { s1 } + \new Staff { c''2 c''4 c''4 } + >> +} + +\score { + { c''2 c''4 c''4 } +} diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 90db07a7e8..730a3fe7d7 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -23,6 +23,12 @@ #include "output-def.hh" #include "pointer-group-interface.hh" +static bool +non_empty_barline (Grob *me) +{ + return Bar_line::has_interface (me) && !me->extent (me, X_AXIS).is_empty (); +} + /* TODO: detect hshifts due to collisions, and account for them in spacing? @@ -80,7 +86,7 @@ Note_spacing::get_spacing (Grob *me, Item *right_col, { Grob *bar = Pointer_group_interface::find_grob (right_col, ly_symbol2scm ("elements"), - Bar_line::has_interface); + non_empty_barline); if (bar) { -- 2.39.2