From 5532fc797fa8370cf6d4ca242ffb5751c897bbec Mon Sep 17 00:00:00 2001 From: Keith OHara Date: Thu, 20 Jan 2011 19:07:24 -0800 Subject: [PATCH] Fix note spacing with melismata Recede the extra-spacing-height of LyricText and similar items. Create property skyline-vertical-padding for vertical padding of left- and right-skylines used in note spacing. --- input/regression/lyrics-melisma-beam.ly | 9 +++++---- lily/separation-item.cc | 8 +++++--- scm/define-grob-properties.scm | 5 +++++ scm/define-grobs.scm | 13 +++++++++---- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/input/regression/lyrics-melisma-beam.ly b/input/regression/lyrics-melisma-beam.ly index 008bb69e7b..811acc80ca 100644 --- a/input/regression/lyrics-melisma-beam.ly +++ b/input/regression/lyrics-melisma-beam.ly @@ -1,7 +1,8 @@ \version "2.12.0" \header { - texidoc = "Melismata are triggered by manual beams." + texidoc = "Melismata are triggered by manual beams. Notes in a + melisma take their natural spacing over a long syllable." } \layout { ragged-right = ##t } @@ -13,9 +14,9 @@ \new Staff \relative c'' { \set Staff.autoBeaming = ##f - c8 c8[ c8 c8] c8 } - - \lyricsto "" \new Lyrics \lyricmode { bla bla bla } + g4 d8[ b8 d8 g8] g4 + } + \lyricsto "" \new Lyrics \lyricmode { bla blaa -- bla } >> diff --git a/lily/separation-item.cc b/lily/separation-item.cc index 5df19544eb..013e457034 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -80,7 +80,8 @@ Skyline Separation_item::conditional_skyline (Grob *me, Grob *left) { vector bs = boxes (me, left); - return Skyline (bs, 0.0, Y_AXIS, LEFT); + Real horizon_padding = robust_scm2double (me->get_property ("skyline-vertical-padding"), 0.0); + return Skyline (bs, horizon_padding, Y_AXIS, LEFT); } @@ -90,8 +91,8 @@ Separation_item::calc_skylines (SCM smob) { Item *me = unsmob_item (smob); vector bs = boxes (me, 0); - /* todo: the horizon_padding is somewhat arbitrary */ - return Skyline_pair (bs, 0.0, Y_AXIS).smobbed_copy (); + Real horizon_padding = robust_scm2double (me->get_property ("skyline-vertical-padding"), 0.0); + return Skyline_pair (bs, horizon_padding, Y_AXIS).smobbed_copy (); } /* if left is non-NULL, get the boxes corresponding to the @@ -189,4 +190,5 @@ ADD_INTERFACE (Separation_item, "elements " "padding " "horizontal-skylines " + "skyline-vertical-padding " ); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 9f36ecb89b..e92bf9ce34 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -721,6 +721,11 @@ vertical distance between two staves, it is possible to have a configuration which would result in a tight interleaving of grobs from the top staff and the bottom staff. The larger this parameter is, the farther apart the staves are placed in such a configuration.") + (skyline-vertical-padding ,number? "The amount by which the left +and right skylines of a column are padded vertically, beyond the +@code{Y-extent}s and @code{extra-spacing-height}s of the constituent +grobs in the column. Increase this to prevent interleaving of grobs +from adjacent columns.") (slash-negative-kern ,number? "The space to remove between slashes in percent repeat glyphs. Larger values bring the two elements closer together.") diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 14e7212a0b..59f756e8a0 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -492,6 +492,7 @@ (font-family . sans) (font-size . 1.5) (stencil . ,ly:text-interface::print) + (extra-spacing-height . (0.2 . -0.2)) (word-space . 0.0) (meta . ((class . Item) (interfaces . (chord-name-interface @@ -516,7 +517,6 @@ (next-note . (extra-space . 0.5)) (right-edge . (extra-space . 0.5)))) (stencil . ,ly:clef::print) - (extra-spacing-height . (-0.5 . 0.5)) (Y-offset . ,ly:staff-symbol-referencer::callback) (meta . ((class . Item) (interfaces . (break-aligned-interface @@ -583,7 +583,6 @@ (next-note . (extra-space . 0.5)) (right-edge . (extra-space . 0.5)))) (stencil . ,ly:clef::print) - (extra-spacing-height . (-0.5 . 0.5)) (Y-offset . ,ly:staff-symbol-referencer::callback) (meta . ((class . Item) (interfaces . (break-aligned-interface @@ -611,7 +610,6 @@ (next-note . (extra-space . 0.5)) (right-edge . (extra-space . 0.5)))) (stencil . ,ly:clef::print) - (extra-spacing-height . (-0.5 . 0.5)) (Y-offset . ,ly:staff-symbol-referencer::callback) (meta . ((class . Item) (interfaces . (break-aligned-interface @@ -855,6 +853,7 @@ (after-line-breaking . ,ly:chord-name::after-line-breaking) (fret-diagram-details . ((finger-code . below-string))) (stencil . ,fret-board::calc-stencil) + (extra-spacing-height . (0.2 . -0.2)) (meta . ((class . Item) (interfaces . (chord-name-interface font-interface @@ -1078,6 +1077,7 @@ (break-align-symbol . left-edge) (break-visibility . ,center-invisible) (non-musical . #t) + (extra-spacing-height . (+inf.0 . -inf.0)) (space-alist . ( (ambitus . (extra-space . 2.0)) (breathing-sign . (minimum-space . 0.0)) @@ -1157,6 +1157,9 @@ (LyricText . ( (extra-spacing-width . (0.0 . 0.0)) + ;; Recede in height for purposes of note spacing, + ;; so notes in melismata can be freely spaced above lyrics + (extra-spacing-height . (0.2 . -0.2)) (font-series . medium) (font-size . 1.0) (self-alignment-X . ,CENTER) @@ -1302,6 +1305,7 @@ (before-line-breaking . ,ly:paper-column::before-line-breaking) (full-measure-extra-space . 1.0) (horizontal-skylines . ,ly:separation-item::calc-skylines) + (skyline-vertical-padding . 0.15) ;; (stencil . ,ly:paper-column::print) (line-break-permission . allow) @@ -1338,6 +1342,7 @@ . ( (axes . (,X ,Y)) (horizontal-skylines . ,ly:separation-item::calc-skylines) + (skyline-vertical-padding . 0.15) (X-extent . ,ly:axis-group-interface::width) (Y-extent . ,ly:axis-group-interface::height) (meta . ((class . Item) @@ -1353,7 +1358,7 @@ (duration-log . ,note-head::calc-duration-log) (extra-spacing-height . ,ly:note-head::include-ledger-line-height) (glyph-name . ,note-head::calc-glyph-name) - (ligature-flexa . #f) + (ligature-flexa . #f) (stem-attachment . ,ly:note-head::calc-stem-attachment) (stencil . ,ly:note-head::print) (X-offset . ,ly:note-head::stem-x-shift) -- 2.39.2