lilypond-user
[Top][All Lists]
Advanced

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

Re: Tweaking end-of-line time signature?


From: Carl D. Sorensen
Subject: Re: Tweaking end-of-line time signature?
Date: Wed, 27 May 2009 07:53:56 -0600



On 5/26/09 4:03 PM, "Trevor Bača" <address@hidden> wrote:
<Snip some good comments about this code>

> %%% BEGIN #3 PROPORTIONAL SPACING WITHOUT STRICT NOTE SPACING AND WITH  EOL
> ADJUSTMENT %%%
> 
> adjustEOLMeterBarlineExtraOffset = #(define-music-function (parser location)
> ()
>    #{
>       #(define (foo grob)
>          (if (<= (ly:item-break-dir grob) 0)
>             (ly:grob-set-property! grob 'extra-offset (cons 2.8 0)) '() ))
>       #(define (bar grob)
>          (if (<= (ly:item-break-dir grob) 0)
>             (ly:grob-set-property! grob 'extra-offset (cons 2.8 0)) '() ))
>       \once \override Score.TimeSignature #'after-line-breaking = #foo
>       \once \override Staff.BarLine #'after-line-breaking = #bar
>    #})

As a stylistic matter, I don't like this definition , because foo and bar
are redefined globally every time adjustEOLMeterBarlineExtraOffset is
called.

I prefer to have foo and bar defined locally:

adjustEOLMeterBarlineExtraOffset =
#(define-music-function (parser location) ()
   (define (foo grob)
     (if (<= (ly:item-break-dir grob) 0)
     (ly:grob-set-property! grob 'extra-offset (cons 2.8 0)) '() ))
   (define (bar grob)
     (if (<= (ly:item-break-dir grob) 0)
     (ly:grob-set-property! grob 'extra-offset (cons 2.8 0)) '() ))
#{
   \once \override Score.TimeSignature #'after-line-breaking = $foo
   \once \override Staff.BarLine #'after-line-breaking = $bar
#})

Note that in this implementation, we use $foo and $bar inside the #{ #}
construct to refer to a local scheme variable.

Furthermore, it seems to me that writing a function like this that has
embedded constants is less than desirable, because if some different offset
were desired, a new function would need to be written.  I think it would be
better to have

adjustEOLMeterBarlineExtraOffset =
#(define-music-function (parser location offset) (pair?)
   (define (foo grob)
     (if (<= (ly:item-break-dir grob) 0)
     (ly:grob-set-property! grob 'extra-offset offset) '() ))
   (define (bar grob)
     (if (<= (ly:item-break-dir grob) 0)
     (ly:grob-set-property! grob 'extra-offset offset) '() ))
#{
   \once \override Score.TimeSignature #'after-line-breaking = $foo
   \once \override Staff.BarLine #'after-line-breaking = $bar
#})

and call it with

\adjustEOLMeterBarlineExtraOffset #'(2.8 . 0)

HTH,

Carl





reply via email to

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