lilypond-user
[Top][All Lists]
Advanced

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

Re: Getting width of markup in a music function


From: Carl Sorensen
Subject: Re: Getting width of markup in a music function
Date: Tue, 11 May 2010 06:21:23 -0600

On 5/11/10 1:17 AM, "Nathan Reed" <address@hidden> wrote:
> 
> Here's my code as it stands.  It produces a narration measure as shown in the
> image linked in my previous message.
> 
> narration =
> #(define-music-function (parser location rest text1 text2)
>                         (ly:music? string? string?)
>     (let (
>             (fermata-event
>                 (make-music
>                     'ArticulationEvent
>                     'tweaks (list '(outside-staff-priority . 0))    ; Force
> fermata to be under the markup text
>                     'articulation-type "fermata"))
>             (text-event
>                 (make-music
>                     'TextScriptEvent
>                     'direction 1
>                     'tweaks (list '(baseline-skip . 2))                ; Fix
> line spacing for text
>                     'text (markup #:center-align #:teeny #:column (text1
> text2))))
>             (result (ly:music-deep-copy rest)))
>         (set! (ly:music-property result 'elements)
>             (append
>                 (ly:music-property rest 'elements)
>                 (list fermata-event text-event)))
>         #{ \textLengthOn $result \textLengthOff #} ))
> 
> I call it like:
> 
> \narration r1 #"On the branch..." #"...chirped the bird gaily."
> 
> I'd like to expand the measure to be slightly wider than the text, so it
> doesn't collide with rehearsal marks.

What if you changed text-event to

             (text-event
                 (make-music
                     'TextScriptEvent
                     'direction 1
                     'tweaks (list '(baseline-skip . 2))    ;Fix line
spacing for text
                     'text (markup :line
                             (markup :hspace 3)
                             (markup #:center-align #:teeny #:column (text1
 text2)))))

with the ("markup :hspace 3) being what is necessary for avoiding the
rehearsal mark (rehearsal marks shouldn't change much in width).?

I haven't tested the code.


HTH,

Carl



> 
> Thanks,
> Nathan Reed
> 




reply via email to

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