Wilbert,

On Sat, Mar 23, 2013 at 9:26 AM, Wilbert Berendsen <i...@wilbertberendsen.nl
> wrote:

> Op 16-03-13 17:35, Arno Rog schreef:
>
>  L.S.
>>
>> I'm trying to figure out a way to place the last bar line exactly at the
>> end of
>> the staff in the score of the Dutch anthem at
>> http://lsr.dsi.unimi.it/LSR/**Snippet<http://lsr.dsi.unimi.it/LSR/Snippet>
>> ?
>> id=648
>>
>> Now it's done manually: \override Staff.BarLine #'extra-offset = #'(23 .
>> 0)
>> \bar "|."
>> Can this be automatically (and correctly)?
>>
>> Arno Rog
>>
>>
>>  I used to use alignGrob for this. (See the LSR). But later I wrote this
> based on that:
>
> endbar = {
>   \overrideProperty #"Staff.BarLine" #'after-line-breaking
>   #(lambda (grob)
>      (let* ((sys (ly:grob-system grob))
>
>             (staff (ly:grob-object grob 'staff-symbol))
>             (half-thickness (/ (ly:staff-symbol-line-**thickness staff)
> 2))
>             (cur-x (cdr (ly:grob-extent grob sys X)))
>             (new-x (cdr (ly:grob-extent staff sys X)))
>             (xoff (+ half-thickness (- new-x cur-x))))
>          (ly:grob-set-property! grob 'extra-offset (cons xoff 0))))
> }


Aha--I see.  Instead of 'blot-diameter, I should have incorporated the
thickness of the staff lines.

Just for the record, with that substitution, I'd get:

   \override Staff.BarLine #'extra-offset = #(lambda (grob)
    (let* ((refp (ly:grob-system grob))
           (staff (ly:grob-object grob 'staff-symbol))
           (staff-extent-X (ly:grob-extent staff refp X))
           (bar-extent-X (ly:grob-extent grob refp X))
           (half-thickness (/ (ly:staff-symbol-line-thickness staff) 2)))
      (cons (- (cdr staff-extent-X) (cdr bar-extent-X) (- half-thickness))
            0)))


...which is basically the same as your function

-David
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to