From 5070f327ed9315b057686618facd2a967ca0125c Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 3 Oct 2005 11:30:41 +0000 Subject: [PATCH] * input/regression/alignment-vertical-spacing.ly: new file. * python/convertrules.py (conv): add rule. * ly/music-functions-init.ly: rename outputProperty to overrideProperty * lily/align-interface.cc (stretch_after_break): new function. Read fixed-alignment-extra-space property. (align_elements_to_extents): read alignment-extra-space property. * scm/page-layout.scm (page-headfoot): annotate headsep and footsep. (annotate-space-left): new function. Annotate space left on page. (annotate-y-interval): new function. (paper-system-annotate-last): new function. Annotate bottom-space. --- ChangeLog | 12 +++++ Documentation/topdocs/NEWS.tely | 26 +++++----- VERSION | 2 +- .../regression/alignment-vertical-spacing.ly | 51 +++++++++++++++++++ lily/align-interface.cc | 36 +++++++------ ly/engraver-init.ly | 2 + ly/music-functions-init.ly | 2 +- python/convertrules.py | 7 +++ scm/page-layout.scm | 19 ++++--- 9 files changed, 118 insertions(+), 39 deletions(-) create mode 100644 input/regression/alignment-vertical-spacing.ly diff --git a/ChangeLog b/ChangeLog index 58ab82e285..2b47d146bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2005-10-03 Han-Wen Nienhuys + * input/regression/alignment-vertical-spacing.ly: new file. + + * python/convertrules.py (conv): add rule. + + * ly/music-functions-init.ly: rename outputProperty to overrideProperty + + * lily/align-interface.cc (stretch_after_break): new + function. Read fixed-alignment-extra-space property. + (align_elements_to_extents): read alignment-extra-space property. + + * lily/lily-guile.cc (robust_scm2dir): new function. + * scm/page-layout.scm (page-headfoot): annotate headsep and footsep. (annotate-space-left): new function. Annotate space left on page. (annotate-y-interval): new function. diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely index 3e60fadbec..4d50e397da 100644 --- a/Documentation/topdocs/NEWS.tely +++ b/Documentation/topdocs/NEWS.tely @@ -45,6 +45,10 @@ This document is also available in @uref{NEWS.pdf,PDF}. @itemize @bullet +@item +Vertical alignments of staves may be tuned for individual systems +easily. + @item Vertical spacing for page layout can now be tuned for each system @@ -58,7 +62,7 @@ individually. The dimensions that can be tuned can be visualized. } @end lilypond -This feature was sponsored by Trevor Baca and Nicolas Sceaux. +This feature was sponsored by Trevor Bača and Nicolas Sceaux. @item The slope of a stem-tremolo may be set manually @@ -114,7 +118,7 @@ specify tie formatting @end lilypond This improvement has been sponsored by Bertalan Fodor, Jay Hamilton, -Kieren MacMillan, Steve Doonan, Trevor Baca, and Vicente Solsona +Kieren MacMillan, Steve Doonan, Trevor Bača, and Vicente Solsona Dell¡. @item @@ -130,7 +134,7 @@ staff lines, flags and dots, without compromising their shape. @end lilypond This improvement has been sponsored by Bertalan Fodor, Jay Hamilton, -Kieren MacMillan, Steve Doonan, Trevor Baca, and Vicente Solsona +Kieren MacMillan, Steve Doonan, Trevor Bača, and Vicente Solsona Dell¡. @@ -176,7 +180,7 @@ Tuplets can be made to reach the next non-tuplet note by setting the } @end lilypond -This feature was sponsored by Trevor Baca. +This feature was sponsored by Trevor Bača. @item When @code{strict-note-spacing} is set, notes are spaced without regard @@ -187,7 +191,7 @@ for clefs, bar lines, and grace notes. For example, \new Staff { c8[ c \clef alto c \grace { c16[ c] } c8 c c] c32[ c32] } @end lilypond -This feature was sponsored by Trevor Baca. +This feature was sponsored by Trevor Bača. @item Beams support the @code{break-overshoot} property, for example @@ -198,7 +202,7 @@ Beams support the @code{break-overshoot} property, for example c2.. c8[ \break c] @end lilypond -This feature was sponsored by Trevor Baca. +This feature was sponsored by Trevor Bača. @item Proportional notation is supported. Notes can be spaced proportional @@ -213,7 +217,7 @@ to their time-difference by assigning a duration to >> @end lilypond -This feature was sponsored by Trevor Baca. +This feature was sponsored by Trevor Bača. @item Symbol sizes (e.g. accidentals) are disregarded for spacing if @@ -231,7 +235,7 @@ Symbol sizes (e.g. accidentals) are disregarded for spacing if >> @end lilypond -This feature was sponsored by Trevor Baca. +This feature was sponsored by Trevor Bača. @item Endings of broken tuplet brackets can be tuned. For example, you can @@ -247,7 +251,7 @@ add arrows to the brackets, } @end lilypond -This feature was sponsored by Trevor Baca. +This feature was sponsored by Trevor Bača. @item @textanchor{arrow-glyph} @@ -262,7 +266,7 @@ Arrow heads were added to the Feta font. } @end lilypond -These glyphs have been sponsored by Trevor Baca. +These glyphs have been sponsored by Trevor Bača. @item @@ -276,8 +280,6 @@ Nested tuplets are automatically positioned, } @end lilypond -@c This feature was sponsored by Trevor Baca. -@c where does this fail? This feature was sponsored by Trevor Bača. @item diff --git a/VERSION b/VERSION index d5ecc913e8..59cd04e448 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=7 -PATCH_LEVEL=11 +PATCH_LEVEL=12 MY_PATCH_LEVEL= diff --git a/input/regression/alignment-vertical-spacing.ly b/input/regression/alignment-vertical-spacing.ly new file mode 100644 index 0000000000..2fd0c0bd4f --- /dev/null +++ b/input/regression/alignment-vertical-spacing.ly @@ -0,0 +1,51 @@ + +\header { + + texidoc = "By setting properties in @code{NonMusicalPaperColumn}, vertical +spacing of alignments can be adjusted per system. + +By setting @code{alignment-extra-space} or +@code{fixed-alignment-extra-space} an individual system may be +stretched vertically. + +For technical reasons, @code{overrideProperty} has to be used for +setting properties on individual object. @code{\override} in a +@code{\context} block may still be used for global overrides. + +" + +} + +\version "2.7.10" + +#(set-global-staff-size 13) + +\relative c'' +\new StaffGroup << + \new Staff { + c1\break + c\break c\break + } + \new Staff { c1 c c } + \new PianoStaff << + \new Voice { + \set PianoStaff.instrument = #"piano" + \set PianoStaff.instr = #"pn" + c1_"normal" + + \overrideProperty + #"Score.NonMusicalPaperColumn" + #'line-break-system-details + #'((fixed-alignment-extra-space . 15)) + c_"fixed-aligment-extra-space" + + \overrideProperty + #"Score.NonMusicalPaperColumn" + #'line-break-system-details + #'((alignment-extra-space . 15)) + c_"aligment-extra-space" + } + { c1 c c } + >> +>> + diff --git a/lily/align-interface.cc b/lily/align-interface.cc index ce3e9b8731..5394a0dacb 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -7,7 +7,6 @@ */ #include "align-interface.hh" - #include "spanner.hh" #include "item.hh" #include "axis-group-interface.hh" @@ -15,6 +14,13 @@ #include "hara-kiri-group-spanner.hh" #include "grob-array.hh" +/* + TODO: for vertical spacing, should also include a rod & spring + scheme of sorts into this: the alignment should default to a certain + distance between element refpoints, unless bbox force a bigger + distance. + */ + MAKE_SCHEME_CALLBACK (Align_interface, alignment_callback, 2); SCM Align_interface::alignment_callback (SCM element_smob, SCM axis) @@ -68,8 +74,7 @@ Align_interface::stretch_after_break (SCM grob) Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"), DOWN); - - Real delta = extra_space / elems.size(); + Real delta = extra_space / elems.size() * stacking_dir; for (int i = 0; i < elems.size (); i++) elems[i]->translate_axis (i * delta, Y_AXIS); } @@ -85,11 +90,8 @@ Align_interface::align_to_fixed_distance (Grob *me, Axis a) { me->set_property ("positioning-done", SCM_BOOL_T); - SCM d = me->get_property ("stacking-dir"); - - Direction stacking_dir = scm_is_number (d) ? to_dir (d) : CENTER; - if (!stacking_dir) - stacking_dir = DOWN; + Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"), + DOWN); Real dy = robust_scm2double (me->get_property ("forced-distance"), 0.0); @@ -172,11 +174,8 @@ Align_interface::align_elements_to_extents (Grob *me, Axis a) me->set_property ("positioning-done", SCM_BOOL_T); - SCM d = me->get_property ("stacking-dir"); - - Direction stacking_dir = scm_is_number (d) ? to_dir (d) : CENTER; - if (!stacking_dir) - stacking_dir = DOWN; + Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"), + DOWN); Interval threshold = robust_scm2interval (me->get_property ("threshold"), Interval (0, Interval::infinity ())); @@ -308,9 +307,16 @@ find_fixed_alignment_parent (Grob *g) return 0; } -ADD_INTERFACE (Align_interface, "align-interface", +ADD_INTERFACE (Align_interface, + "align-interface", + "Order grobs from top to bottom, left to right, right to left or bottom " - "to top.", + "to top. " + "For vertical alignments of staves, the @code{break-system-details} of " + "the left @internalsref{NonMusicalPaperColumn} may be set to tune vertical spacing " + "Set @code{alignment-extra-space} to add extra space for staves. Set " + "@code{fixed-alignment-extra-space} to force staves in PianoStaves further apart." + , /* properties diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 246670fd68..5e1560cb24 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -281,6 +281,8 @@ contained staves are not connected vertically." verticalAlignmentChildCallback = #Align_interface::fixed_distance_alignment_callback \override VerticalAlignment #'forced-distance = #12 \override VerticalAlignment #'self-alignment-Y = #0 + \override VerticalAlignment #'after-line-breaking-callback + = #Align_interface::stretch_after_break \consists "Vertical_align_engraver" \consists "Instrument_name_engraver" diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index d14bc4a8b5..61c033c6bb 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -64,7 +64,7 @@ applyOutput = 'origin location 'procedure proc)) -outputProperty = +overrideProperty = #(def-music-function (parser location name property value) (string? symbol? scheme?) diff --git a/python/convertrules.py b/python/convertrules.py index 1816a96e66..7bd695dd5f 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -2575,3 +2575,10 @@ def conv (str): conversions.append (((2, 7, 11), conv, '''\"tabloid\" -> \"11x17\"''')) + +def conv (str): + str = re.sub(r'outputProperty' , 'overrideProperty', str) + return str + +conversions.append (((2, 7, 12), conv, + '''outputProperty -> overrideProperty''')) diff --git a/scm/page-layout.scm b/scm/page-layout.scm index 1ddf108b10..64259c0263 100644 --- a/scm/page-layout.scm +++ b/scm/page-layout.scm @@ -98,7 +98,6 @@ #t) #f))) - (display (list y-extent bottomspace)) (if arrow (set! stencil (ly:stencil-add stencil arrow))) @@ -373,15 +372,15 @@ create offsets. (map add-system (zip lines offsets)) - - (set! - page-stencil - (annotate-space-left page-stencil layout - (- bottom-edge - (if (ly:stencil? foot) - (interval-length (ly:stencil-extent foot Y)) - 0)))) - + (if (annotate? layout) + (set! + page-stencil + (annotate-space-left page-stencil layout + (- bottom-edge + (if (ly:stencil? foot) + (interval-length (ly:stencil-extent foot Y)) + 0))) + )) (if (and (ly:stencil? foot) -- 2.39.5