Changing the default text font family: Difference between revisions
Appearance
mNo edit summary |
mNo edit summary |
||
| Line 1: | Line 1: | ||
The default font families for text can be overridden with <code>make-pango-font-tree</code>. | The default font families for text can be overridden with <code>make-pango-font-tree</code>. | ||
<div class="nodoc"> | |||
Note: Starting with LilyPond 2.25.4, font selection works differently; the most usual cases can be handled by {{Convert-ly-devel}}. See the [{{LILYDEVELDOC}}/notation/fonts ‘Notation’ manual] for more information. | |||
</div> | |||
<lilypond version="2.24"> | <lilypond version="2.24"> | ||
Latest revision as of 14:11, 12 January 2026
The default font families for text can be overridden with make-pango-font-tree.
Note: Starting with LilyPond 2.25.4, font selection works differently; the most usual cases can be handled by convert-ly. See the ‘Notation’ manual for more information.
\version "2.24"
%{
You may have to install additional fonts.
Red Hat Fedora: dejavu-fonts-all
Debian GNU/Linux, Ubuntu: fonts-dejavu-core
fonts-dejavu-extra
%}
\paper {
% change for a different default global staff size
myStaffSize = #20
%{
run
lilypond -dshow-available-fonts
to show all fonts available in the process log.
%}
#(define fonts
(make-pango-font-tree "DejaVu Serif"
"DejaVu Sans"
"DejaVu Sans Mono"
(/ myStaffSize 20)))
}
{
g'''4^\markup {
DejaVu Serif: \bold bold
\italic italic
\italic \bold { bold italic }
}
g4_\markup {
\override #'(font-family . sans) {
DejaVu Sans: \bold bold
\italic italic
\italic \bold { bold italic }
}
}
g''2^\markup {
\override #'(font-family . typewriter) {
DejaVu Sans Mono: \bold bold
\italic italic
\italic \bold { bold italic }
}
}
}