From 341abefdd6d296f35839a57101266dfb150d1ec0 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Sat, 19 Jul 2008 18:42:31 +1000 Subject: [PATCH] Fix 647. Add the extra-spacing-height property and use it to prevent anything from coming too close to a time signature. --- Documentation/topdocs/NEWS.tely | 1 + lily/item.cc | 2 +- lily/separation-item.cc | 15 +++++++++------ ly/property-init.ly | 10 +++++----- python/convertrules.py | 6 ++++++ scm/define-grob-properties.scm | 10 ++++++---- scm/define-grobs.scm | 1 + 7 files changed, 29 insertions(+), 16 deletions(-) diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely index 44009abed2..5e6ff487e2 100644 --- a/Documentation/topdocs/NEWS.tely +++ b/Documentation/topdocs/NEWS.tely @@ -88,6 +88,7 @@ fret diagram properties moved to fret-diagram-details. \dimHairpin, \sustainUp -> \sustainOff, \sustainDown -> \sustainOn \sostenutoDown -> \sostenutoOn, \sostenutoUp -> \sostenutoOff +2.11.53: infinite-spacing-height -> extra-spacing-height @end example @item diff --git a/lily/item.cc b/lily/item.cc index 3915ea6108..e47143e682 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -288,7 +288,7 @@ ADD_INTERFACE (Item, /* properties */ "break-visibility " + "extra-spacing-height " "extra-spacing-width " - "infinite-spacing-height " "non-musical " ); diff --git a/lily/separation-item.cc b/lily/separation-item.cc index 2e46c59771..617c6fd4eb 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -135,12 +135,15 @@ Separation_item::boxes (Grob *me, Grob *left) Interval y (il->pure_height (ycommon, 0, very_large)); Interval x (il->extent (pc, X_AXIS)); - Interval extra = robust_scm2interval (elts[i]->get_property ("extra-spacing-width"), - Interval (-0.1, 0.1)); - x[LEFT] += extra[LEFT]; - x[RIGHT] += extra[RIGHT]; - if (to_boolean (elts[i]->get_property ("infinite-spacing-height"))) - y = Interval (-infinity_f, infinity_f); + Interval extra_width = robust_scm2interval (elts[i]->get_property ("extra-spacing-width"), + Interval (-0.1, 0.1)); + Interval extra_height = robust_scm2interval (elts[i]->get_property ("extra-spacing-height"), + Interval (-0.1, 0.1)); + + x[LEFT] += extra_width[LEFT]; + x[RIGHT] += extra_width[RIGHT]; + y[DOWN] += extra_height[DOWN]; + y[UP] += extra_height[UP]; if (!x.is_empty () && !y.is_empty ()) out.push_back (Box (x, y)); diff --git a/ly/property-init.ly b/ly/property-init.ly index 4b385cc4ec..9098d313cf 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -1,6 +1,6 @@ % property-init.ly -\version "2.11.52" +\version "2.11.53" stemUp = \override Stem #'direction = #UP stemDown = \override Stem #'direction = #DOWN @@ -188,22 +188,22 @@ autoBeamOn = \set autoBeaming = ##t textLengthOn = { \override TextScript #'extra-spacing-width = #'(0 . 0) - \override TextScript #'infinite-spacing-height = ##t + \override TextScript #'extra-spacing-height = #'(-inf.0 . +inf.0) } textLengthOff = { \override TextScript #'extra-spacing-width = #'(+inf.0 . -inf.0) - \override TextScript #'infinite-spacing-height = ##f + \override TextScript #'extra-spacing-height = #'(0 . 0) } balloonLengthOn = { \override BalloonTextItem #'extra-spacing-width = #'(0 . 0) - \override BalloonTextItem #'infinite-spacing-height = ##t + \override BalloonTextItem #'extra-spacing-height = #'(-inf.0 . +inf.0) } balloonLengthOff = { \override BalloonTextItem #'extra-spacing-width = #'(+inf.0 . -inf.0) - \override BalloonTextItem #'infinite-spacing-height = ##f + \override BalloonTextItem #'extra-spacing-height = #'(0 . 0) } diff --git a/python/convertrules.py b/python/convertrules.py index 852bf15ba5..12a3b6c5b6 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -2785,6 +2785,12 @@ def conv (str): str = str.replace ("setHairpinDim", "dimHairpin") return str +@rule ((2, 11, 53), "infinite-spacing-height -> extra-spacing-height") +def conv (str): + str = re.sub (r"infinite-spacing-height\s+=\s+##t", r"extra-spacing-height = #'(-inf.0 . +inf.0)", str) + str = re.sub (r"infinite-spacing-height\s+=\s+##f", r"extra-spacing-height = #'(0 . 0)", str) + return str + # Guidelines to write rules (please keep this at the end of this file) # # - keep at most one rule per version; if several conversions should be done, diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index a46a01f010..7e57b5e8a7 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -189,6 +189,12 @@ Y@tie{}dimension by this much.") offset is added just before outputting the symbol, so the typesetting engine is completely oblivious to it. The values are measured in @code{staff-space} units of the staff's @code{StaffSymbol}.") + (extra-spacing-height ,number-pair? "In the horizontal spacing +problem, we increase the height of each item by this amount (by adding +the @q{car} to the bottom of the item and adding the @q{cdr} to the top +of the item. In order to make a grob infinitely high (to prevent the +horizontal spacing problem from placing any other grobs above or below +this grob), set this to @code{(-inf.0 . +inf.0)}.") (extra-spacing-width ,number-pair? "In the horizontal spacing problem, we pad each item by this amount (by adding the @q{car} on the left side of the item and adding the @q{cdr} on the right side of the @@ -315,10 +321,6 @@ left and one to the right of this grob.") (ignore-collision ,boolean? "If set, don't do note collision resolution on this @code{NoteColumn}.") (implicit ,boolean? "Is this an implicit bass figure?") - (infinite-spacing-height ,boolean? "If true, then for the -purposes of horizontal spacing, treat this item as though it were -infinitely tall. That is, no object from another column is allowed to -stick above or below this item.") (inspect-index ,integer? "If debugging is set, set beam and slur configuration to this index, and print the respective scores.") (inspect-quants ,number-pair? "If debugging is set, diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 07a2244830..23154db7a1 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1940,6 +1940,7 @@ . ,ly:break-aligned-interface::calc-extent-aligned-anchor) (break-visibility . ,all-visible) (avoid-slur . inside) + (extra-spacing-height . (-1.0 . 1.0)) (space-alist . ( (first-note . (fixed-space . 2.0)) (right-edge . (extra-space . 0.5)) -- 2.39.5