lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

relative offset of systems [WAS: Center-align a score]


From: David Nalesnik
Subject: relative offset of systems [WAS: Center-align a score]
Date: Thu, 27 Apr 2017 12:22:35 -0500

On Thu, Apr 27, 2017 at 8:43 AM, Kieren MacMillan
<address@hidden> wrote:
> David,
>
> Perhaps there’s a way your new-found [?] knowledge/skill in this area can 
> help with a long-time feature request I’ve had: an \offset-like way to nudge 
> systems — especially the explicit Y-offset property, but also the 
> alignment-distances if possible. Avoiding trial-and-error there would be a 
> huge savings.
>
> Thanks,
> Kieren.
>

A little experiment leaves me hopeful.

(So far) it looks like it's a relatively simple matter to add another
line-break-system-detail: "extra-Y-offset" which will move a system
from its calculated position (whether left to the default, or
positioned with 'Y-offset).

Just like an explicit setting of Y-offset, it will act without regard
to vertical collisions.

To try this out, you will (unfortunately) either need to (1) apply the
attached patch or (2) make changes to your scm/page.scm by hand.  (I'd
suggest commenting out the original make-page-stencil with #!  [...]
!# and adding a copy with the changes, so it's easy to revert if need
be.)

I'll just quote the relevant changes with some context.

Within the function make-page-stencil:

[...]

 (add-to-page (lambda (stencil x y extra-y)
                    (set! page-stencil
                          (ly:stencil-add page-stencil
                            (ly:stencil-translate stencil
                              (cons
                               (+
                                system-xoffset x)
                               (-
                                0 y extra-y (prop 'top-margin))) ; NB

                              )))))
     (add-system
      (lambda (system)
        (let* ((stencil (paper-system-stencil system))
               (y (ly:prob-property system 'Y-offset 0))
               (extra-y (ly:prob-property system 'extra-Y-offset 0)) ; NB
               (is-title (paper-system-title?
                          system)))
          (add-to-page stencil
            (ly:prob-property system 'X-offset 0.0)
            y
            extra-y) ; NB

[...]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Try it out with this:

%%%%%%%%%%%%%%%%%%
top = \repeat unfold 5 { c''4 d'' e'' f'' }

bottom = {
  \clef bass
  \repeat unfold 5 { c,1 }
  \break
}

\new PianoStaff <<
  \new Staff {
    \top
    \top
    \top
  }
  \new Staff {
    \bottom
    \overrideProperty
    Score.NonMusicalPaperColumn.line-break-system-details
    #'((extra-Y-offset . -2))
    \bottom
    \overrideProperty
    Score.NonMusicalPaperColumn.line-break-system-details
    #'((extra-Y-offset . 12))
    \bottom
  }
>>
%%%%%%%%%%%%%%%%%%%%%%%

Sorry for the awkwardness, but I hope this is useful to you!

-David

Attachment: 0001-Allow-extrs-y-offset-for-systems.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]