lilypond-user
[Top][All Lists]
Advanced

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

Re: size of pdf files


From: Knut Petersen
Subject: Re: size of pdf files
Date: Mon, 08 Dec 2014 07:53:47 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 05.12.2014 20:51, Werner LEMBERG wrote:
Now I thought a bit and added "-dSubsetFonts=false" to the gs
parameter list in backend-library.scm.  I also changed
lilyponddefs.ps to include white-on-white print commands for all the
emmentaler glyphs used in the four examples (hint: grep, sed, sort &
uniq make it easy to get a list of glyphs from ps files): [...]

     Werner
This is a nice idea!  However, I consider it a bug in ghostscript that
you can't suppress subsetting for the Emmentaler fonts.  Can you send
a bug report to the gs people?

I'll have a close look at the lilypond drawing routines and the gs source code 
first.
That gs not obeys dSubsetFonts=false could be considered a bug, but we only 
need it
because  gs does not merge several subsets of the same font to one optimal 
subset.
Asking to change that is probably a feature request and not a bug report.

I even don't know if we need that because with current ghostscript it might be 
an
even better idea to change lilyponds way to draw music glyphs.

A file size reduction to about 36% of the original is a promising
result.
Indeed.

I tried  the following small patch:

diff --git a/scm/backend-library.scm b/scm/backend-library.scm
index a167718..b732dee 100644
--- a/scm/backend-library.scm
+++ b/scm/backend-library.scm
@@ -79,6 +79,7 @@
                        *unspecified*
                        (ly:format "-dDEVICEHEIGHTPOINTS=~$" paper-height))
                    "-dCompatibilityLevel=1.4"
+                   "-dNoOutputFonts"
                    "-dNOPAUSE"
                    "-dBATCH"
                    "-r1200"

The NoOutputFonts parameter is new to ghostscript 9.15. That minimal patch saves
51 MB (!) in the lilypond install directory tree:

du -sh lilypond_2.18.2orig
849M    lilypond_2.18.2orig

du -sh lilypond_2.18.2test
798M    lilypond_2.18.2test

share/doc/lilypond/html/Documentation/notation.pdf shrinks a lot:
original 2.18.2: 27.159.338 bytes
2.18.2.+patch filesize: 17.141.462 bytes

My small test document attached to the original post compiles to an even
smaller pdf: 47803 bytes. Compared to the original document we have a
file size reduction to a little less than 28%.

There's a drawback if  we use -dNoOutputFonts: We cannot find text
in the documents processed with this option. For notation.pdf that
means we will still be able to find e.g "scherz" in the body text as it is
produced by pdftex, but "scherz" in the music example will be missed.

Well, nobody searches for emmentaler glyphs. But there's another drawback:
-dNoOutputFonts is good for small documents, bigger scores  will grow
if -dNoOutputFonts is used.

So one solution would be a command  line option that allows to mimic what gs 
does
to emmentaler glyphs  with -dNoOutputFonts  active, all that combined with a
better ghostscript.

Another more general solution would be a ghostscript that allows to specify the
list of fonts no to include,  something like gs 
-dNoOutputFonts="emmentaler,foo,bar" ...

I'll have a closer look at the sources.

Why does lilypond think it is a good idea to print a space at origin
using an otherwise unused font?
This is a very good question.  IIRC, it comes from headers or footers
added by lilypond.  It is obviously not possible to *completely*
disable that, hence the silly whitespace.  This is a bug in lilypond,
I think...
It is.

cu,
 Knut



reply via email to

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