From ee2ee302635c308051ed97fa42e803b00bff1a0f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 16 Jun 2003 07:53:59 +0000 Subject: [PATCH] * lily/note-spacing.cc (get_spacing): include left part of right object in fixed space. This fixes stretched space before accidentals. * input/regression/spacing-accidental-stretch.ly: new file. --- ChangeLog | 8 +++++ Documentation/user/refman.itely | 2 +- .../regression/spacing-accidental-stretch.ly | 15 +++++++++ lily/note-spacing.cc | 31 +++++++++---------- 4 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 input/regression/spacing-accidental-stretch.ly diff --git a/ChangeLog b/ChangeLog index 65d2dbd40b..349994c73a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-06-16 Han-Wen Nienhuys + + * lily/note-spacing.cc (get_spacing): include left part of right + object in fixed space. This fixes stretched space before + accidentals. + + * input/regression/spacing-accidental-stretch.ly: new file. + 2003-06-16 Rune Zedeler * input/mutopia/R.Schumann/romanze-op28-2.ly: Minor fixes. diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 2f87bb7dfa..aaf0cd488d 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -1640,7 +1640,7 @@ See also @internalsref{PhrasingSlur}, @refbugs Phrasing slurs have the same limitations in their formatting as normal -slurs. +slurs. Putting phrasing slurs over rests leads to spurious warnings. @node Breath marks @subsection Breath marks diff --git a/input/regression/spacing-accidental-stretch.ly b/input/regression/spacing-accidental-stretch.ly new file mode 100644 index 0000000000..00af523149 --- /dev/null +++ b/input/regression/spacing-accidental-stretch.ly @@ -0,0 +1,15 @@ +\version "1.7.21" + +\header { + texidoc = "Accidentals don't influence the amount of stretchable space. " +} + +\score { + \notes \relative c'' \context GrandStaff { + \pianoCautionaries + d16 d d d d d cis d + + } + \paper { linewidth = 14.\cm + } +} diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 9aa593f669..e37f4ff68c 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -104,11 +104,20 @@ Note_spacing::get_spacing (Grob *me, Item* right_col, What is sticking out of the note head (eg. a flag), doesn't get the full amount of space. + + FIXED also includes the left part of the right object. */ - *fixed = left_head_wid.empty_b () ? increment : left_head_wid[RIGHT]; - *space = (base_space - increment) + *fixed + - (extents[LEFT][RIGHT] - - (left_head_wid.empty_b () ? 0.0 : left_head_wid[RIGHT]))/ 2; + *fixed = + (left_head_wid.empty_b () ? increment : left_head_wid[RIGHT]) + + (extents[RIGHT].empty_b() ? 0.0 : - extents[RIGHT][LEFT] / 2); + + /* + We don't do complicated stuff: (base_space - increment) is the + normal amount of white, which also determines the amount of + stretch. Upon (extreme) stretching, notes with accidentals should + stretch as much as notes without accidentals. + */ + *space = (base_space - increment) + *fixed ; if (Item::breakable_b (right_col) || right_col->original_) @@ -122,19 +131,7 @@ Note_spacing::get_spacing (Grob *me, Item* right_col, *space += -extents[RIGHT][LEFT]; *fixed += -extents[RIGHT][LEFT]; } - else if (*space - *fixed < 2 * ((- extents[RIGHT][LEFT]) >? 0)) - { - /* - - What's sticking out at the left of the right side has less - influence. We only take it into account if there is not enough - space. - - this sucks: this criterion is discontinuous; FIXME. - */ - *space += 0.5 * (( -extents[RIGHT][LEFT]) >? 0); - } - + stem_dir_correction (me, right_col, increment, space, fixed); } -- 2.39.2