[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: relative offset of systems [WAS: Center-align a score]
From: |
David Nalesnik |
Subject: |
Re: relative offset of systems [WAS: Center-align a score] |
Date: |
Thu, 27 Apr 2017 16:07:57 -0500 |
Hi Harm,
On Thu, Apr 27, 2017 at 3:57 PM, Thomas Morley <address@hidden> wrote:
> Hi David,
>
> nice stuff!
>
> Some comments, though:
>
> 2017-04-27 19:27 GMT+02:00 David Nalesnik <address@hidden>:
>> On Thu, Apr 27, 2017 at 12:22 PM, David Nalesnik
>> <address@hidden> wrote:
>>
>>>
>>> I'll just quote the relevant changes with some context.
>>>
>>> Within the function make-page-stencil:
>>>
>>> [...]
>>>
>
> I see no advantage to add 'extra-y' to the arguments.
> Why not do the calculation in 'add-system' ...
Good point. Actually, I already incorporated this suggestion in a
patch I'm currently testing. (Middle of make doc.) I decided to use
an "extra-offset" property which allows for displacements along both
axes.
>
>>> (add-to-page (lambda (stencil x y extra-y)
>>
>> Oh, "nota bene" the above line too!
>>
>>> (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
>
>
> It will fail if system-separator-markup is used.
>
> Here my attempt (for comparison I added greyed stencils)
>
> (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)))
>
> ;;;; For comparison: print the greyed system-stencil without extra-y
> (add-to-page (stencil-with-color stencil '(0.8 0.8 0.8))
> (ly:prob-property system 'X-offset 0.0)
> y)
> ;;;; The moved system-stencil
> (add-to-page stencil
> (ly:prob-property system 'X-offset 0.0)
> (+ y extra-y)) ;; NB
>
> (if (and (ly:stencil? system-separator-stencil)
> last-system
> (not (paper-system-title? system))
> (not (paper-system-title? last-system)))
> (begin
> ;;;; For comparison: print the greyed system-separator-stencil without
> 'extra-y
> (add-to-page
> (stencil-with-color system-separator-stencil '(0.8 0.8
> 0.8))
> 0
>
> (average (- last-y
> (car (paper-system-staff-extents last-system)))
> (- y
> (cdr (paper-system-staff-extents system)))))
>
> ;;;; The moved system-separator-stencil
> (add-to-page
> system-separator-stencil
> 0
>
> (+
> (average (- last-y
> (car (paper-system-staff-extents
> last-system)))
> (- y
> (cdr (paper-system-staff-extents system))))
> (/ extra-y 2))))) ;; NB
> (set! last-system system)
> ;;;; set last-y, taking extra-y into account
> (set! last-y (+ y extra-y))))) ;; NB
>
> As an example I used:
>
> \paper {
> system-separator-markup = \slashSeparator
> ragged-last-bottom = ##t
> }
> 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 . 5))
> \bottom
> }
>>>
>
> png attached
>
Thanks so much for pointing this out. I didn't notice that the
variable "y" was used elsewhere. As soon as the patch testing has run
its course, I'll add this in.
Wish I could use the greyed background in the regtest, but that's not possible.
Best,
David