lilypond-user
[Top][All Lists]
Advanced

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

Re: CueVoice Font


From: Aaron Hill
Subject: Re: CueVoice Font
Date: Wed, 20 Feb 2019 18:21:52 -0800
User-agent: Roundcube Webmail/1.3.8

On 2019-02-20 5:52 pm, Ben wrote:
I didn't know that about ligatures, thanks! Now it makes more sense.

Do you know if it's possible to make a 'global' CueVoice font change
via \context, or do I need to continue doing it manually / setup a
variable, but still outside a \context?

i.e. \markup *{ \override #'(font-name . "Minion Pro")*

Yes, but it is a little trickier than you would imagine.  Consider:

%%%%
\version "2.19.82"
\layout { \context { \CueVoice \override TextScript.font-name = #"Roboto" } }
\new Staff {
  \new Voice { a'4^"a" b'^\markup \bold "b" }
  \new CueVoice { c''4^"c" d''^\markup \bold "d" }
}
%%%%

This changes the font-name for TextScripts that appear in a CueVoice. Notice that the TextScripts in the Voice are unaffected. But also note that the \bold markup command did not work for "d". This is because font-name takes precedence over font-family. Please review a post [1] I made a month back.

[1]: https://lists.gnu.org/archive/html/lilypond-user/2019-01/msg00723.html

We can do better by overriding font-family, not font-name.  Consider:

%%%%
\version "2.19.82"
\paper { #(define fonts (set-global-fonts #:sans "Roboto")) }
\layout { \context { \CueVoice \override TextScript.font-family = #'sans } }
\new Staff {
  \new Voice { a'4^"a" b'^\markup \bold "b" }
  \new CueVoice { c''4^"c" d''^\markup \bold "d" }
}
%%%%

Here we have redefined the "sans" font-family to be "Roboto" and then instructed all TextScripts within CueVoices to use that family. This affects the change we want and still allows \bold and \italic to work. And again, the TextScripts in the Voice are not changed.

It should be noted that defining fonts within the \paper block is generally the right way to set fonts in a score, so you should consider that option first. But for one-off font changes, a simple font-name override should be fine.

The post I mentioned above [1] also includes an example of defining your own custom font-family, which can be helpful if you need more than one "roman" or "sans" font. It should be easy enough to define a "romanII", for instance.


-- Aaron Hill



reply via email to

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