lilypond-user
[Top][All Lists]
Advanced

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

Re: Is there a way to patch the lyrics tie character?


From: Fernando Gil
Subject: Re: Is there a way to patch the lyrics tie character?
Date: Sat, 15 Aug 2020 23:12:12 -0500

Hello Harm!
Thank you so much it works neat!

I've integrated that code to my .ily file that is attached here (without some of the tweaks from the original .ily included in the font distribution to avoid copyright issues with the font developer) so you can see how's my font implementation then I simply call it in my score using \include "[...].ily"

You'll notice I tweaked a bit the size of the tie character triying to match lilypond's default output.

It seems odd to me you've mentioned a little x instead of the lyrics.tie.default character when using \char ##xe196 you'll see in the other attachment I obtain my desired output using that code. (Cuerpo‿y)

I'm going to adventure myself further away from my original question but here I go: sometimes even in default output (using emmentaler and lyrics default font) lyrics.tie.default character seems to colide (for example in that same "Cuerpo~y" attached ) so looking at your code and documentation seems to exist lyrics.tie.short I guess to avoid this, but I can't figure it out on how to use it, perharps you or someone other reading can enlight me with this.

Thanks again!



El sáb., 15 ago. 2020 a las 13:49, Thomas Morley (<thomasmorley65@gmail.com>) escribió:
Am Fr., 14. Aug. 2020 um 16:10 Uhr schrieb Fernando Gil <fernandogb5@gmail.com>:
>
> Hello to everyone, I'm struggled with the lyrics tie character when using an alternate font from Music Type Foundry.
>
> Since lilypond uses character from the music font, when using an alternate font with the character missing, it doesn't show.
>
> I have a workaround that goes like this:
>
> Cuer -- \markup {po\hspace #-0.3  \override #'(font-name . "emmentaler-20") \char ##xe196 \hspace #-0.3 y}
>
> But when transcribing 8 stanzas there's certainly much better to use the simplicity of "~" (i.e. Cuer -- po~y) rather than my workaround.
>
> I imagine there's a chance to achieve what I'm looking with a cleaner way but have no clue where to start. Hope you can help me. Thanks in advance.

Hi Fernando,

I can't reproduce your problem, because you didn't tell us how you
used music-fonts in which way etc.
Trying to make any sense of your example I come to
\new Lyrics \lyricmode {
    Cuer -- \markup { po\hspace #-0.3  \override #'(font-name .
"emmentaler-20") \char ##xe196 \hspace #-0.3 y
    }
}

Which always returns a small "x" instead of the tie.

Ofcourse this small "x" can be done automatically:

#(define-markup-command (my-tied-lyric layout props str)
  (string?)
  #:category music
  #:properties ((word-space))
  "
@cindex simple text string, with tie characters

Like simple-markup, but use tie characters for @q{~} tilde symbols.

@lilypond[verbatim,quote]
\\markup \\column {
  \\tied-lyric #\"Siam navi~all'onde~algenti Lasciate~in abbandono\"
  \\tied-lyric #\"Impetuosi venti I nostri~affetti sono\"
  \\tied-lyric #\"Ogni diletto~e scoglio Tutta la vita~e~un mar.\"
}
@end lilypond"
  (define (replace-ties tie str)
    (if (string-contains str "~")
        (let*
            ((half-space (/ word-space 2))
             (parts (string-split str #\~))
             (tie-str (make-line-markup
                       (list
                        (make-hspace-markup half-space)
                        tie
                        (make-hspace-markup half-space))))
             (joined  (list-join parts tie-str)))
          (make-concat-markup joined))
        str))

  (define short-tie-regexp (make-regexp "~[^.]~"))
  (define (match-short str) (regexp-exec short-tie-regexp str))

  (define (replace-short str mkp)
    (let ((match (match-short str))
          (my-tie
            #{
               \markup {
                     \override #'(font-name . "emmentaler-20")
                     \char ##xe196
               }
            #}))
      (if (not match)
          (make-concat-markup (list
                               mkp
                               (replace-ties
                                 my-tie ;"ties.lyric.default"
                                 str)))
          (let ((new-str (match:suffix match))
                (new-mkp (make-concat-markup (list
                                              mkp
                                              (replace-ties
                                                my-tie ;"ties.lyric.default"
                                                (match:prefix match))
                                              (replace-ties
                                                my-tie ;"ties.lyric.short"
                                                (match:substring match))))))
            (replace-short new-str new-mkp)))))

  (interpret-markup layout
                    props
                    (replace-short str (markup))))

#(define-public (my-lyric-text::print grob)
  "Allow interpretation of tildes as lyric tieing marks."

  (let ((text (ly:grob-property grob 'text)))

    (grob-interpret-markup grob (if (string? text)
                                    (make-my-tied-lyric-markup text)
                                    text))))

\new Lyrics \lyricmode {
  \override LyricText.stencil = #my-lyric-text::print
  Cuer -- po~y
}

Alas, I've no idea if it's close to your wishes at all...


Cheers,
  Harm

Attachment: CustomLyricTies.ily
Description: Binary data

Attachment: Nice_Output.png
Description: PNG image

Attachment: Collision_B.png
Description: PNG image

Attachment: Collision_A.png
Description: PNG image


reply via email to

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