Jump to content

Changing the default text font family: Difference between revisions

From LilyPond wiki
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:
You may have to install additional fonts.
You may have to install additional fonts.


Red Hat Fedora
Red Hat Fedora: dejavu-fonts-all


  dejavu-fonts-all
Debian GNU/Linux, Ubuntu: fonts-dejavu-core
 
                          fonts-dejavu-extra
Debian GNU/Linux, Ubuntu
 
  fonts-dejavu-core
  fonts-dejavu-extra
%}
%}


\paper {
\paper {
   % change for other default global staff size.
   % change for a different default global staff size
   myStaffSize = #20
   myStaffSize = #20
   %{
   %{
     run
     run
Line 23: Line 20:
     to show all fonts available in the process log.
     to show all fonts available in the process log.
   %}
   %}
   #(define fonts
   #(define fonts
     (make-pango-font-tree "DejaVu Serif"
     (make-pango-font-tree "DejaVu Serif"
Line 54: Line 50:
</lilypond>
</lilypond>


[[Category:Text]]
[[Category:Text]]
[[Category:Text]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 15:41, 12 December 2025

The default font families for text can be overridden with make-pango-font-tree.

\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 }
    }
  }
}