Le 04/01/2023 à 22:42, Flaming Hakama by Elaine a écrit :
Hi,

I was hoping someone could help me figure out how to fix this font issue.

For quite some number of years,
I've been using this function that prints custom text for volta ending labels.

But now it is producing strange results.

The image from the below MWE is attached, it shows that some of the letters are being rendered in a much smaller and different font than the rest.  This includes letters f, s, r, n, m



The font you are seeing is LilyPond's standard music font, the Feta
font, and these are the letters used for dynamics.

The volta text is normally a number, and Feta has its own numbers
for that (which are similar to fingerings), therefore the text
under a volta bracket is typeset using a music font. If that
font doesn't contain any glyph for a particular letter, you
get a fallback text font. This is controlled through the font-encoding
property: fetaText → music font, latin1 → text font. Try


\version "2.24.0"

voltaDoubleCustom = #(define-music-function (repMusicCommon repEndingA repMusicA repEndingB repMusicB) (ly:music? markup? ly:music? markup? ly:music?) #{
  \set Score.repeatCommands = #'(start-repeat)
  $repMusicCommon

  \set Score.repeatCommands =
    #(list (list 'volta
                 #{ \markup \override #'(font-encoding . latin1) #repEndingA #}))
  $repMusicA

  \set Score.repeatCommands =
    #(list (list 'volta #f)
           'end-repeat
           (list 'volta
                 #{ \markup \override #'(font-encoding . latin1) #repEndingB #}))
  $repMusicB

  \set Score.repeatCommands = #'((volta #f))
#})

{
    \voltaDoubleCustom
        { c''8 8 8 8  8 8 8 8 }
        \markup "first"
        { c''8 8 8 8  8 8 8 8 }
        \markup "second"
        { c''8 8 8 8  8 8 8 8 }
}



There is a much simpler way, though:

\version "2.24.0"

{
  \repeat volta 2 {
    c''8 8 8 8  8 8 8 8
    \alternative {
      \volta 1 {
        \once \override Score.VoltaBracket.font-encoding = #'latin1
        \once \override Score.VoltaBracket.text = "first"
        c''8 8 8 8  8 8 8 8
      }
      \volta 2 {
        \once \override Score.VoltaBracket.font-encoding = #'latin1
        \once \override Score.VoltaBracket.text = "second"
        c''8 8 8 8  8 8 8 8
      }
    }
  }
}


Best,
Jean

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to