lilypond-user
[Top][All Lists]
Advanced

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

Re: Feedback Request for Music Fonts


From: Abraham Lee
Subject: Re: Feedback Request for Music Fonts
Date: Tue, 14 Oct 2014 04:59:56 -0006

Joram,

On Mon, Oct 13, 2014 at 4:14 PM, Noeck <address@hidden> wrote:
Is it possible to switch the music font for a staff or even a measure with your approach? Or does it only work in the \paper environment. It would be cool for comparisons of fonts in the same file like here (using oll): \version "2.18.0" \include "custom-music-fonts/smufl/definitions.ily" music = \relative c' { \clef alto \time 3/4 c4-.(\f\< d4-. es4-.) | \time 4/4 fis8.---\trill\sfz\> e!16\downbow d16->\! r16 r8 c2-\prall | \time 2/2 \clef treble r2-\fermata c8( eeh8)-^ \tuplet 3/2 { eeh8( gisih8 b')-! } | } << \new Staff \with { instrumentName = "Feta" } \music \new Staff \with { \bravuraOn instrumentName = "Bravura" } \music
Just changing the font name of all objects does not seem to work. Cheers, Joram

YES!, this can be done quite easily. As I explained on my personal website (the link is found near the bottom of fonts.openlilylib.org),

https://sites.google.com/site/tisimst/Home/custom-font-how-to#localized-font-changes

You can use another built-in function "add-music-font" to provide instant access to any of the music fonts I've published (with one kind-of-caveat I'll explain in a moment). The "add-music-fonts" function puts associates the music fonts with the proper glyph encoding (i.e., NOT "latin-1", which is what the text fonts use). For example, say we wanted to make Profondo locally available, we would do something like:

\paper {
  #(add-music-fonts fonts
    'profondo  % <--- this is the variable you will use to access the font
    "profondo"   % <--- the music font name
    "emmentaler"  % <--- the piano brace font name
    feta-design-size-mapping   % <--- required, don't change
    (/ staff-height pt 20))
}

At this point, Emmentaler is still the global document notation font. However, whenever you want to change any notation element to be from the Profondo font, all you need to do is:

\override [LayoutObject].font-family = #'profondo

This can be done on-the-fly like any other override or score-wide in a \layout block.

THE KIND-OF-CAVEAT

It's not really a caveat, but here's the only catch to changing music fonts this way. After a while of playing around with LP and its font mechanisms, I realized that this is NOT a great way to change the global document music font. If you do some searching online, you might find something like this (which is similar to what you'll find in "ly/paper-defaults-init.ly"):

\paper {
  #(define font-defaults
     '((font-family . profondo) (font-encoding . fetaMusic)))
}

The reason this isn't a great way to change the font globally is because it doesn't catch every layout object. You have to add additional \layout overrides to DynamicText, Fingering, Script, TrillSpanner, and a host of other layout objects in order to get everything. BUT, if all you want is a local \override, then the syntax I showed above is all you need. Now you can write variables to change things just like is done with \smuflOn and \bravuraOn.

HTH,
Abraham

reply via email to

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