lilypond-devel
[Top][All Lists]
Advanced

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

Reduce size of *TeX generated pdfs with lilypond snippets


From: Knut Petersen
Subject: Reduce size of *TeX generated pdfs with lilypond snippets
Date: Sun, 28 Dec 2014 15:30:02 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

The attached patch (against 2.18.2) changes the way lilypond
uses fonts to draw glyphs.

It avoids to used glyphshow for all emmentaler glyphs and
adds encoding vectors to the emmentaler fonts before they
are used. It also changes the ghostscript parameters used
to generate pdfs from postscript code.

These changes help to reduce pdf file sizes if you include
lilypond snippets in *TeX documents. The pdfs generated by
a patched lilypond and *tex themselves are _much_ bigger,
but if you run ghostscript and pdfsizeopt.py on those
files they implode.

As this patch changes only very low-level routines it should
be invisible to the lilypond user interface. But links from other
pdfs into the processed files are broken. Changing this would
require a major extension of ghostscript.

I think if the discussion in this list shows that this code is
regarded to be usefull, a command line parameter should
be added to lilypond to enable these changes only on user
request. If you don't include lilypond pdfs in *TeX documents
you don't need it and you don't want it.

I don't know scheme well, so somebody should have a close
look at the code. Probably it looks ugly and inefficient to an
experienced scheme programmer.

notation.pdf is a good test object:

file size in bytes / comment
============================
 27.171.654 original 2.18.2 notation.pdf (3442 fonts)
 20.074.736 original 2.18.2 notation.pdf + pdfsizeopt.py (completely broken pdf)
 23.644.317 original 2.18.2 notation.pdf + ghostscript (1737 fonts)
 19.979.555 original 2.18.2 notation.pdf + ghostscript + pdfsizeopt (1736 fonts)
127.676.999 patched 2.18.2 notation.pdf (3458 fonts)
---.---.--- patched 2.18.2 notation.pdf + pdfsizeopt.py (pdfsizeopt aborts with 
error)
  5.953.377 patched 2.18.2 notation.pdf + ghostscript (69 fonts)
  4.307.825 patched 2.18.2 notation.pdf + ghostscript + pdfsizeopt (69 fonts)

+ ghostscript means:
====================
gs -dNOPAUSE -dBATCH -q -r1200 -sDEVICE=pdfwrite -o outfile.pdf infile.pdf

+ pdfsizeopt means:
===================
pdfsizeopt.py --use-multivalent=false infile.pdf

Comments:
=========
- pdfsizeopt.py is neither capable to process the notation.pdf from 2.18.2 nor 
the
  notation.pdf generated by the patched version of lilypond correctly.
- ghostscript up to version 9.14 breaks internal and external links.
- ghostscript 9.15 produces an invalid but readable pdf whenever it
  processes an external link (GoToR)
- ghostscript git master preserves external and internal links
- processing of links in ghostscript git master exposes a bug in evince,
  external links are broken in that program as a result.
- link targets in files processed by ghostscript git master are lost.

cu,
 Knut

Attachment: impLTpdfs.diff
Description: Text Data


reply via email to

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