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: Thomas Morley
Subject: Re: Is there a way to patch the lyrics tie character?
Date: Sat, 15 Aug 2020 20:49:14 +0200

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



reply via email to

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