I was tracking down the source of a bug having to do with typeface preferences not getting transmitted to LilyPond. I came across #309, which seems to match up with the symptoms I'm observing with LilyPond v2.25.11 (the version I got when I installed LilyPond using brew install lilypond --HEAD to dodge another LilyPond bug in v2.24.2 having to do with GhostScript). Unfortunately, the fix supplied by @lemzwerg in that issue no longer works as of LilyPond v2.25.6 because of two changes I found:
In LilyPond v2.25.5 and above, instead of fonts.roman, it needs to be fonts.serif, according to this patch.
In LilyPond v2.25.6 and above, instead of fonts.{serif,sans,typewriter}, it probably needs to be property-defaults.fonts.{serif,sans,typewriter}, according to this patch.
I'm not a Lua expert, but if I had to guess at what the code would look like, this would be it:
Lua code at function Score:ly_fonts()
```lua
function Score:ly_fonts()
if self['pass-fonts'] then
local fonts_def
if self:lilypond_version() >= ly.v{2, 25, 6} then
fonts_def = [[property-defaults.fonts.serif = "%s"
property-defaults.fonts.sans = "%s"
property-defaults.fonts.typewriter = "%s"]]
else if self:lilypond_version() >= ly.v{2, 25, 5} then
fonts_def = [[fonts.serif = "%s"
fonts.sans = "%s"
fonts.typewriter = "%s"]]
else if self:lilypond_version() >= ly.v{2, 25, 4} then
fonts_def = [[fonts.roman = "%s"
fonts.sans = "%s"
fonts.typewriter = "%s"]]
else
fonts_def = [[
#(define fonts
(make-pango-font-tree "%s"
"%s"
"%s"
(/ staff-height pt 20)))
]]
end
return fonts_def:format(self.rmfamily, self.sffamily, self.ttfamily)
else
return '%% fonts not set'
end
end
```
Workaround
It's possible to define a \paper block in the LilyPond code itself. For example,
I was tracking down the source of a bug having to do with typeface preferences not getting transmitted to LilyPond. I came across #309, which seems to match up with the symptoms I'm observing with LilyPond v2.25.11 (the version I got when I installed LilyPond using
brew install lilypond --HEAD
to dodge another LilyPond bug in v2.24.2 having to do with GhostScript). Unfortunately, the fix supplied by @lemzwerg in that issue no longer works as of LilyPond v2.25.6 because of two changes I found:fonts.roman
, it needs to befonts.serif
, according to this patch.fonts.{serif,sans,typewriter}
, it probably needs to beproperty-defaults.fonts.{serif,sans,typewriter}
, according to this patch.I'm not a Lua expert, but if I had to guess at what the code would look like, this would be it:
Lua code at function
```lua function Score:ly_fonts() if self['pass-fonts'] then local fonts_def if self:lilypond_version() >= ly.v{2, 25, 6} then fonts_def = [[property-defaults.fonts.serif = "%s" property-defaults.fonts.sans = "%s" property-defaults.fonts.typewriter = "%s"]] else if self:lilypond_version() >= ly.v{2, 25, 5} then fonts_def = [[fonts.serif = "%s" fonts.sans = "%s" fonts.typewriter = "%s"]] else if self:lilypond_version() >= ly.v{2, 25, 4} then fonts_def = [[fonts.roman = "%s" fonts.sans = "%s" fonts.typewriter = "%s"]] else fonts_def = [[ #(define fonts (make-pango-font-tree "%s" "%s" "%s" (/ staff-height pt 20))) ]] end return fonts_def:format(self.rmfamily, self.sffamily, self.ttfamily) else return '%% fonts not set' end end ```Score:ly_fonts()
Workaround
It's possible to define a
\paper
block in the LilyPond code itself. For example,