lilypond-user
[Top][All Lists]
Advanced

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

Re: attaching markup to time signature


From: David Kastrup
Subject: Re: attaching markup to time signature
Date: Fri, 01 Jun 2018 18:05:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Kieren MacMillan <address@hidden> writes:

> Hi David,
>
>> Is it possible to get the markup to attach to the clef or time signature 
>> only in the bass staff? I am getting the text to show, but it is attaching 
>> to both staves.
>
> You’ve put the Balloon_engraver in the Score context, so all staves will 
> display balloons. Use \with on the one Staff context instead (see below). If 
> you need it on more than one, but not all, staves, you might consider 
> creating a custom StaffWithBalloons context.
>
> Hope that helps!
> Kieren.
>
> %%%  SNIPPET BEGINS
> \version "2.19.80"
>
> melody = \relative c' {
>   c4 c c c
> }
>
> stuff = {
>   \balloonGrobText #'TimeSignature #'(0 . -1) \markup "test1"
>   \balloonGrobText #'Clef #'(0 . -1) \markup "test2"
>   \time 2/4
>   c2 c
> }
>
> \score {
>   \new StaffGroup
>   <<
>     \new Staff { \clef "treble" \melody }
>     \new Staff \with {
>       \consists "Balloon_engraver"
>       \override BalloonTextItem.annotation-balloon = ##f
>       \override BalloonTextItem.annotation-line = ##f
>       \override BalloonTextItem.font-size = #-2
>       \override BalloonTextItem.font-series = #'bold
>     }
>     { \clef "bass" \stuff }
>   >>
> }
> %%%  SNIPPET ENDS

I wanted to add a learned treatise of how to do this properly.  But then
I looked at the code rather than the documentation (as is my wont)

balloonGrobText =
#(define-music-function (grob-name offset text)
   (symbol? number-pair? markup?)
   (_i "Attach @var{text} to @var{grob-name} at offset @var{offset}
 (use like @code{\\once})")
   (make-event-chord
    (list
     (make-music 'AnnotateOutputEvent
                 'symbol grob-name
                 'X-offset (car offset)
                 'Y-offset (cdr offset)
                 'text text))))

balloonText =
#(define-event-function (offset text) (number-pair? markup?)
   (_i "Attach @var{text} at @var{offset} (use like @code{\\tweak})")
   (make-music 'AnnotateOutputEvent
               'X-offset (car offset)
               'Y-offset (cdr offset)
               'text text))

and at the current point of time, there would not appear to be a more
proper way.

This is bullsh*t, including the completely absurd documentation strings.
We should likely change the semantics and commands to match those of
\footnote .

-- 
David Kastrup



reply via email to

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