When using lilypond-book it’ll create separate eps/pdf files for each score embedded in the latex sources. Each one embeds a (possibly different) subsetting of the respective music fonts. The end result is that the same glyphs are contained many times and the PDF filesize is blown up dramatically.
Is there a workaround?
-dgs-never-embed-fonts=true -dbackend=ps which causes the fonts to not be embedded at all. But I do need the fonts in the final PDF. I tried to use
gs to embed and subset the fonts, but it fails to find them:
gs -dEmbedAllFonts=true -dPrinted=false -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH … Substituting font Helvetica for Emmentaler-18. Substituting font Helvetica for TeXGyreSchola-Regular.
I’m not sure how I can tell
gs where to look for the respective fonts (I can find the according
otf files on my disk).
I monkey-patched the lilypond script to disable font subsetting.
sed -i 's~NeverEmbed~SubsetFonts false /AlwaysEmbed~' /usr/share/lilypond/2.19.83/scm/framework-ps.scm
This works (together with
-dgs-never-embed-fonts=true -dbackend=ps) and fonts are now always embedded without subsetting.
However, apparently there’s no easy way to merge them. I did try
pdfsizeopt, but it bails out in this particular case with
warning: ignoring … Type1C fonts with /CharStrings longer than 256, obj nums are […]