[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: relative offset of systems [WAS: Center-align a score]
From: |
Thomas Morley |
Subject: |
Re: relative offset of systems [WAS: Center-align a score] |
Date: |
Thu, 27 Apr 2017 22:57:45 +0200 |
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' ...
>> (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,
Harm
atest-56.png
Description: PNG image