Hi David, This is very cool, on a number of different levels.
First, I hadn't previously explored after-line-breaking. So I went to IR
3.2.37 on the grob-interface and found out that after-line-breaking triggers
an eponymous callback. The callback can be any Scheme function and so the
definition of meterBrk in your solution makes sense to me.
I next figured out that 3 units of horizontal displacement to the right is
pretty much what I'm looking for. So I mucked around some figuring out how
to follow your suggestion of hardcoding the value of that displacement. I
discovered that this involves changing a function in one argument to a
function in no arguments. NR 6.1.6 "Functions without arguments" is both
useful (because it explains how to do this) and lovely (because it reminds
me of Mendelssohn :) So the no-argument version of your solution becomes
something like this:
%%% BEGIN %%
meterNudgeFixed = #(define-music-function (parser location) ()
#{
#(define (meterBrk grob)
(if (<= (ly:item-break-dir grob) 0)
(ly:grob-set-property! grob 'extra-offset (cons 3 0)) '() ))
\once \override Score.TimeSignature #'after-line-breaking =
#meterBrk
#})
%%% END %%%
Next I thought "hm, I sure wish I could move the end-of-line barline over by
the same distance, just like I'm already doing with the end-of-line time
signature." And it turns out that a very literal-minded extension of your
solution works great:
%%% BEGIN %%%
meterAndBarlineNudge = #(define-music-function (parser location) ()
#{
#(define (meterBrk grob)
(if (<= (ly:item-break-dir grob) 0)
(ly:grob-set-property! grob 'extra-offset (cons 3 0)) '() ))
#(define (barlineBrk grob)
(if (<= (ly:item-break-dir grob) 0)
(ly:grob-set-property! grob 'extra-offset (cons 3 0)) '()
))
\once \override Score.TimeSignature #'after-line-breaking =
#meterBr
k
\once \override Staff.BarLine #'after-line-breaking =
#barlineBrk
#})
%%% END %%%
This is very cool. This bit of input ...
\layout {ragged-right = ##t }
\new Staff {
\time 4/4
c'1
\meterAndBarlineNudge
\break
\time 7/8
c'2..
}
... produces the output shown in meter-and-barline-nudge.png, attached.
Neat! Both the end-of-line barline and time signature have been moved out of
the staff and into the whitespace beyond, freeing up the entire horizontal
compass of the measure. This is precisely what I was trying to do.
But now I've run into a challenge that I haven't been able to solve. How can
I set *two* properties on one grob in a single function?
In other words, if I want to modify the first of these functions to, say,
move an end-of-line time signature over to the right AND color the time
signature red, what's the appropriate syntax?
The closest I got was something like this ...
%%% BEGIN BAD %%%
meterNudgeAndColor = #(define-music-function (parser location) ()
#{
#(define (meterBrk grob)
(if
(<= (ly:item-break-dir grob) 0)
(
(ly:grob-set-property! grob 'color red)
(ly:grob-set-property! grob 'extra-offset (cons 3 0))
)
'()
)
)
\once \override Score.TimeSignature #'after-line-breaking =
#meterBrk
#})
%%% END BAD %%%
... which causes Lily to complain:
Drawing systems...<string>:2:67: In expression ((ly:grob-set-property! grob
# ...) (ly:grob-set-property! grob # ...)):
<string>:2:67: Wrong type to apply: #<unspecified>
Is there a way to set two grob properties at once (in a function with no
arguments)?
Thanks for everything so far! Very powerful ...
Trevor.
On Mon, May 25, 2009 at 7:10 PM, madMuze <[email protected]> wrote:
>
> Trevor,
>
> I've sometimes needed to adjust the location of clefs without affecting the
> next line, and this seems to work (function found on
>
> http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Scheme-functions#Scheme-functions
> ):
>
> meterNuj = #(define-music-function (parser location muvIt) (number?)
> #{
> #(define (meterBrk grob)
> (if (<= (ly:item-break-dir grob) 0)
> (ly:grob-set-property! grob 'extra-offset
> (cons $muvIt 0)) '() ))
> \once \override Score.TimeSignature #'after-line-breaking =
> #meterBrk
> #})
>
> usage:
> \time 4/4 s1 \meterNuj #2.5 \break
> \time 2/2 s1
>
> or:
> \time 4/4 s1\break
> \meterNuj #2.5 \time 2/2 s1
>
> Or course, if you settle on a number you like, you can hard-code it and get
> rid of the variable. Also, if you want to ensure the subroutine only
> affects
> meters at ends of lines and not in the middle (e.g. if the \breaks are not
> explicit), change the "<=" to "<".
>
> I welcome any refinements!
> David
>
>
> Hi,
>
> Is there a way to tweak the visual appearance and position of an
> end-of-line
> time signature *without* affecting the following beginning-of-line time
> signature?
> --
> View this message in context:
> http://www.nabble.com/Tweaking-end-of-line-time-signature--tp23712497p23714996.html
> Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.
>
>
>
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/lilypond-user
>
--
Trevor Bača
[email protected]
<<attachment: meter-and-barline-nudge.png>>
_______________________________________________ lilypond-user mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-user
