lilypond-devel
[Top][All Lists]
Advanced

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

Re: NR pdf is larger with current git by 15%


From: Masamichi Hosoda
Subject: Re: NR pdf is larger with current git by 15%
Date: Sat, 11 Jul 2020 15:06:59 +0900 (JST)

> your fix for gs works fine; the resulting PDFs are small again.
> Thanks a lot!
> 
> BUT: They are not as small as previously.  For example, with commit
> 21a20de3, the NR has 10 pages more and is now 8.3MByte (I've tested
> compilation with both gs 9.21 and 9.52) instead of 7.1MByte (with gs
> 9.21, produced April 20th using commit f86f7705).  As far as I can
> see, my used xetex binary is the same, as is `texinfo.tex` (version
> 2019-02-16.14), and the included fonts.
> 
> Do you have any explanation for this?  Is this expected, probably a
> side effect of your latest changes?  I uncompressed the PDFs using
> `pdftk` and did a comparison; unfortunately I couldn't see big
> differences in the diff file, which probably hints at small but many
> changes that accumulate to the 15% difference.

If I understand correctly,
it is due to the difference in the method of invoking Ghostscript.
The new method was introduced from commit 017927b4.

For example, here is my experiment with commit 21a20de3 and gs-9.52.

```
$ cat foo.ly
{ c d e f g a b }

$ lilypond -dgs-never-embed-fonts --ps --pdf foo.ly
...snip...

$ echo "mark /OutputFile (foo.new-method.pdf) /PageSize [595.28 841.89] 
(pdfwrite) finddevice putdeviceprops setdevice newpath fill (foo.ps) run" > 
gs-command.ps

$ gs -dNODISPLAY -dNOSAFER -dNOPAUSE -dBATCH -dAutoRotatePages=/None 
-dPrinted=false gs-command.ps
...snip...

$ gs -dSAFER -dNOPAUSE -dBATCH -dAutoRotatePages=/None -dPrinted=false 
-sDEVICE=pdfwrite -dDEVICEHEIGHTPOINTS=841.89 -dDEVICEWIDTHPOINTS=595.28 
-sOutputFile=foo.old-method.pdf -f foo.ps
...snip...

$ ls -l *.pdf
-rw-r--r--+ 1 trueroad none 7081 Jul 11 14:41 foo.new-method.pdf
-rw-r--r--+ 1 trueroad none 6423 Jul 11 14:41 foo.old-method.pdf
-rw-r--r--+ 1 trueroad none 7084 Jul 11 14:41 foo.pdf

$
```

>From the same PostScript file, the new method generates a PDF of 7081 bytes
and the old method generates a PDF of 6423 bytes.
The new method is more than 10 % larger than the old method.

Next, I tried to find out what the increase was.

```
$ qpdf --qdf foo.pdf foo.qdf

$ qpdf --qdf foo.new-method.pdf foo.new-method.qdf

$ qpdf --qdf foo.old-method.pdf foo.old-method.qdf

$ diff -u foo.qdf foo.new-method.qdf > direct-to-new.diff

$ diff -u foo.old-method.qdf foo.new-method.qdf > old-to-new.diff

$
```

>From `old-to-new.diff`, it seems that the amount of drawing operators
in the /Contents has increased significantly.



reply via email to

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