Menu

#4882 Remove `-dgs-load-fonts` in lilypond-book

Started
None
needs_work
Enhancement
2016-06-15
2016-06-05
No

Some fonts cannot use with -dgs-load-fonts option
(also -dgs-load-lily-fonts option).

http://codereview.appspot.com/300280043

Discussion

  • David Kastrup

    David Kastrup - 2016-06-05

    Can we get some view on the disk space and time requirements for building LilyPond documentation, and the resulting file sizes of the final PDFs, compared to without this patch?

     
  • Anonymous

    Anonymous - 2016-06-06
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> needs_work
     
  • Anonymous

    Anonymous - 2016-06-06

    Sorry, I wasn't paying attention, I think this fails make (but it cound be make check). It never got to Make doc, so it is one of those

    --snip--

    GNU LilyPond 2.19.43

    Forking into jobs: (14404 14403 14402 14401 14400 14399 14398)
    logfile lilypond-multi-run-1.log (exit 1):
    1 #) ...) (ly:system cmd) ...)
    169: 28 (if (not (= 1 anti-alias-factor)) (for-each (lambda # #) files))
    170: 29 [for-each #<procedure #f="" (f)=""> ("./9e/lily-f2cfd744.png")]
    In unknown file:
    ?: 30
    [#<procedure #f="" (f)=""> "./9e/lily-f2cfd744.png"]
    In /home/james/lilypond-git/build/out/share/lilypond/current/scm/ps-to-png.scm:
    171: 31 [scale-down-image 2 "./9e/lily-f2cfd744.png"]
    55: 32 (let
    (# # # ...) (ly:debug # file ...) ...)
    73: 33* [copy-binary-file "./9e/lily-f2cfd744.png" "/tmp/lilypond-AhRTfM"]
    In /home/james/lilypond-git/build/out/share/lilypond/current/scm/backend-library.scm:
    138: 34 (if (eq? PLATFORM (quote windows)) (let (# #) (let loop # ...)) ...)
    154: 35 [copy-file "./9e/lily-f2cfd744.png" "/tmp/lilypond-AhRTfM"]

    /home/james/lilypond-git/build/out/share/lilypond/current/scm/backend-library.scm:154:7: In procedure copy-file in expression (copy-file from-name to-name):
    /home/james/lilypond-git/build/out/share/lilypond/current/scm/backend-library.scm:154:7: No such file or directory
    fatal error: Children (1) exited with errors.

    --snip--

     
  • Masamichi Hosoda

    If I understand correctly,
    "make doc" failure caused by ghostscript option "-dSAFER".

    LilyPond with "-dgs-load-fonts" invokes a ghostscript with "-dNOSAFER".
    I removed "-ds-load-fonts". In this case, LilyPond invokes a ghostscript with "-dSAFER".

    Some snippets in input/regression/ use "\epsfile".
    "\epsfile" with "-dSAFER" raises the problem.

    It works with "-dgs-load-fonts".
    But, in my humble opinion, both options "-dgs-load-fonts" and "-dgs-load-lily-fonts" should be deprecated.
    http://lists.gnu.org/archive/html/lilypond-devel/2016-06/msg00056.html

    So I'd like to propose new LilyPond option like "-dgs-safer".
    It is different from "-dgs-load-fonts", it does not change font loading way.
    Its default is #t except Windows. LilyPond invokes a ghostscript with "-dSAFER".
    If it is #f, LilyPond invokes a ghostscript with "-dNOSAFER".

    I'll make the patch.

     
  • David Kastrup

    David Kastrup - 2016-06-07

    I'm ambiguous about this. In my opinion, if LilyPond is running PostScript as part of its PDF production process, things like gs-load-fonts and epsfile inclusion at runtime are perfectly valid means to increase efficient and reduce the size of intermediate PostScript files.

    Where PostScript is the final format, fonts as well as epsfile and similar should be embedded in the file.

    Also, we do have the problem that any use of \epsfile and other embedded user-specified PostScript content means that Ghostscript should only be run with -dSAFER. In other words: there is no actual use case for letting \epsfile work by reading an external file: we should really always embed the file directly into the PostScript output and only run the result with the equivalent of -dSAFER which rules out use of gs-load-fonts (unless we load all fonts before dropping file access privileges).

     
  • Werner LEMBERG

    Werner LEMBERG - 2016-06-07

    The very issue is that you cannot embed OTCs or TTCs as PS resources, even if the
    target format is PDF. In other words, two font formats that are fully valid in PDFs
    don't work – and it is not trivial to the user to find out which fonts work and which
    fonts don't work, especially on OS X that is going to use more and more OTCs even
    for non-CJK scripts. Limited support for TTCs exist in the PS handling of GhostScript
    using GhostScript extensions, but OTCs are really completely unsupported currently
    on the PS side.

     
  • Masamichi Hosoda

    Unfortunately, my understanding was wrong.
    The cause of this failure is not -dSAFER.

    The cause is that \epsfile can't include the EPS that contain the byte of 0x00.
    When you use -dgs-load-fonts for EPS building, the EPS does not contain the byte of 0x00.
    However, when you do not use -dgs-load-fonts, the EPS contains the byte of 0x00.

    I've created Issue 4890 for \epsfile issue.
    https://sourceforge.net/p/testlilyissues/issues/4890/

     
  • Masamichi Hosoda

    I've compared it in my environment.
    With --bigpdfs (Patch Set 1), the final PDFs file sizes become bigger.
    So I propose the way that without both options, -dgs-load-fonts and --bigpdfs.
    It is Patch Set 2.

    ---Original (with -dgs-load-fonts, without --bigpdfs)---
    Patches:
    master branch's
    commit 37da55e4c857a21b017981eed0a28943e9fae119
    with Issue 4890

    Time requirements for building LilyPond documentation:
    58m6.769s

    Disk size of building directory:

    $ du -ms .
    4648    .
    

    Resulting file sizes of the final PDFs:

    $ du -k out-www/offline-root/Documentation/*.pdf
    752     out-www/offline-root/Documentation/changes.es.pdf
    620     out-www/offline-root/Documentation/changes.it.pdf
    752     out-www/offline-root/Documentation/changes.pdf
    796     out-www/offline-root/Documentation/contributor.pdf
    1508    out-www/offline-root/Documentation/essay.de.pdf
    1540    out-www/offline-root/Documentation/essay.es.pdf
    1412    out-www/offline-root/Documentation/essay.fr.pdf
    1536    out-www/offline-root/Documentation/essay.hu.pdf
    1532    out-www/offline-root/Documentation/essay.pdf
    360     out-www/offline-root/Documentation/extending.de.pdf
    416     out-www/offline-root/Documentation/extending.es.pdf
    432     out-www/offline-root/Documentation/extending.fr.pdf
    404     out-www/offline-root/Documentation/extending.pdf
    1740    out-www/offline-root/Documentation/internals.pdf
    4884    out-www/offline-root/Documentation/learning.ca.pdf
    5348    out-www/offline-root/Documentation/learning.de.pdf
    5352    out-www/offline-root/Documentation/learning.es.pdf
    5308    out-www/offline-root/Documentation/learning.fr.pdf
    2676    out-www/offline-root/Documentation/learning.hu.pdf
    5268    out-www/offline-root/Documentation/learning.it.pdf
    4668    out-www/offline-root/Documentation/learning.nl.pdf
    5308    out-www/offline-root/Documentation/learning.pdf
    1840    out-www/offline-root/Documentation/music-glossary.pdf
    33828   out-www/offline-root/Documentation/notation.de.pdf
    36148   out-www/offline-root/Documentation/notation.es.pdf
    36108   out-www/offline-root/Documentation/notation.fr.pdf
    36140   out-www/offline-root/Documentation/notation.it.pdf
    35972   out-www/offline-root/Documentation/notation.pdf
    10120   out-www/offline-root/Documentation/snippets.pdf
    396     out-www/offline-root/Documentation/usage.ca.pdf
    388     out-www/offline-root/Documentation/usage.de.pdf
    404     out-www/offline-root/Documentation/usage.es.pdf
    416     out-www/offline-root/Documentation/usage.fr.pdf
    320     out-www/offline-root/Documentation/usage.hu.pdf
    392     out-www/offline-root/Documentation/usage.it.pdf
    380     out-www/offline-root/Documentation/usage.pdf
    2492    out-www/offline-root/Documentation/web.pdf
    

    ---Patch Set 1 (without -dgs-load-fonts, with --bigpdfs)---
    Patches:
    master branch's
    commit 37da55e4c857a21b017981eed0a28943e9fae119
    with Issue 4890 + Issue 4882 Patch Set 1

    Time requirements for building LilyPond documentation:
    61m10.790s

    Disk size of building directory:

    $ du -ms .
    14566   .
    

    Resulting file sizes of the final PDFs:

    $ du -k out-www/offline-root/Documentation/*.pdf
    5756    out-www/offline-root/Documentation/changes.es.pdf
    5148    out-www/offline-root/Documentation/changes.it.pdf
    5752    out-www/offline-root/Documentation/changes.pdf
    796     out-www/offline-root/Documentation/contributor.pdf
    6264    out-www/offline-root/Documentation/essay.de.pdf
    6608    out-www/offline-root/Documentation/essay.es.pdf
    6480    out-www/offline-root/Documentation/essay.fr.pdf
    6604    out-www/offline-root/Documentation/essay.hu.pdf
    6600    out-www/offline-root/Documentation/essay.pdf
    2048    out-www/offline-root/Documentation/extending.de.pdf
    2804    out-www/offline-root/Documentation/extending.es.pdf
    2820    out-www/offline-root/Documentation/extending.fr.pdf
    2792    out-www/offline-root/Documentation/extending.pdf
    1740    out-www/offline-root/Documentation/internals.pdf
    39036   out-www/offline-root/Documentation/learning.ca.pdf
    43272   out-www/offline-root/Documentation/learning.de.pdf
    43240   out-www/offline-root/Documentation/learning.es.pdf
    42940   out-www/offline-root/Documentation/learning.fr.pdf
    18988   out-www/offline-root/Documentation/learning.hu.pdf
    42864   out-www/offline-root/Documentation/learning.it.pdf
    37564   out-www/offline-root/Documentation/learning.nl.pdf
    43232   out-www/offline-root/Documentation/learning.pdf
    14164   out-www/offline-root/Documentation/music-glossary.pdf
    264616  out-www/offline-root/Documentation/notation.de.pdf
    285192  out-www/offline-root/Documentation/notation.es.pdf
    284180  out-www/offline-root/Documentation/notation.fr.pdf
    285520  out-www/offline-root/Documentation/notation.it.pdf
    285200  out-www/offline-root/Documentation/notation.pdf
    75692   out-www/offline-root/Documentation/snippets.pdf
    2112    out-www/offline-root/Documentation/usage.ca.pdf
    1884    out-www/offline-root/Documentation/usage.de.pdf
    1896    out-www/offline-root/Documentation/usage.es.pdf
    1908    out-www/offline-root/Documentation/usage.fr.pdf
    1744    out-www/offline-root/Documentation/usage.hu.pdf
    1888    out-www/offline-root/Documentation/usage.it.pdf
    1876    out-www/offline-root/Documentation/usage.pdf
    2492    out-www/offline-root/Documentation/web.pdf
    

    ---Patch Set 2 (without -dgs-load-fonts, without --bigpdfs)---
    Patches:
    master branch's
    commit 37da55e4c857a21b017981eed0a28943e9fae119
    with Issue 4890 + Issue 4882 Patch Set 2

    Time requirements for building LilyPond documentation:
    58m45.157s

    Disk size of building directory:

    $ du -ms .
    8500    .
    

    Resulting file sizes of the final PDFs:

    $ du -k out-www/offline-root/Documentation/*.pdf
    752     out-www/offline-root/Documentation/changes.es.pdf
    620     out-www/offline-root/Documentation/changes.it.pdf
    752     out-www/offline-root/Documentation/changes.pdf
    796     out-www/offline-root/Documentation/contributor.pdf
    1508    out-www/offline-root/Documentation/essay.de.pdf
    1540    out-www/offline-root/Documentation/essay.es.pdf
    1412    out-www/offline-root/Documentation/essay.fr.pdf
    1536    out-www/offline-root/Documentation/essay.hu.pdf
    1532    out-www/offline-root/Documentation/essay.pdf
    360     out-www/offline-root/Documentation/extending.de.pdf
    416     out-www/offline-root/Documentation/extending.es.pdf
    432     out-www/offline-root/Documentation/extending.fr.pdf
    404     out-www/offline-root/Documentation/extending.pdf
    1740    out-www/offline-root/Documentation/internals.pdf
    4888    out-www/offline-root/Documentation/learning.ca.pdf
    5348    out-www/offline-root/Documentation/learning.de.pdf
    5352    out-www/offline-root/Documentation/learning.es.pdf
    5308    out-www/offline-root/Documentation/learning.fr.pdf
    2676    out-www/offline-root/Documentation/learning.hu.pdf
    5268    out-www/offline-root/Documentation/learning.it.pdf
    4668    out-www/offline-root/Documentation/learning.nl.pdf
    5308    out-www/offline-root/Documentation/learning.pdf
    1840    out-www/offline-root/Documentation/music-glossary.pdf
    34008   out-www/offline-root/Documentation/notation.de.pdf
    36324   out-www/offline-root/Documentation/notation.es.pdf
    36288   out-www/offline-root/Documentation/notation.fr.pdf
    36316   out-www/offline-root/Documentation/notation.it.pdf
    36148   out-www/offline-root/Documentation/notation.pdf
    10468   out-www/offline-root/Documentation/snippets.pdf
    396     out-www/offline-root/Documentation/usage.ca.pdf
    388     out-www/offline-root/Documentation/usage.de.pdf
    404     out-www/offline-root/Documentation/usage.es.pdf
    416     out-www/offline-root/Documentation/usage.fr.pdf
    320     out-www/offline-root/Documentation/usage.hu.pdf
    392     out-www/offline-root/Documentation/usage.it.pdf
    380     out-www/offline-root/Documentation/usage.pdf
    2492    out-www/offline-root/Documentation/web.pdf
    
     
  • Anonymous

    Anonymous - 2016-06-12
    • Needs: -->
    • Patch: new --> needs_work
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2016-06-12

    This fails 'make check'

    -snip-

    169: 28 (if (not (= 1 anti-alias-factor)) (for-each (lambda # #) files))
    170: 29 [for-each #<procedure #f="" (f)=""> ("./9e/lily-f2cfd744.png")]
    In unknown file:
    ?: 30
    [#<procedure #f="" (f)=""> "./9e/lily-f2cfd744.png"]
    In /home/james/lilypond-git/build/out/share/lilypond/current/scm/ps-to-png.scm:
    171: 31 [scale-down-image 2 "./9e/lily-f2cfd744.png"]
    55: 32 (let
    (# # # ...) (ly:debug # file ...) ...)
    73: 33* [copy-binary-file "./9e/lily-f2cfd744.png" "/tmp/lilypond-FQaqS6"]
    In /home/james/lilypond-git/build/out/share/lilypond/current/scm/backend-library.scm:
    138: 34 (if (eq? PLATFORM (quote windows)) (let (# #) (let loop # ...)) ...)
    154: 35 [copy-file "./9e/lily-f2cfd744.png" "/tmp/lilypond-FQaqS6"]

    /home/james/lilypond-git/build/out/share/lilypond/current/scm/backend-library.scm:154:7: In procedure copy-file in expression (copy-file from-name to-name):
    /home/james/lilypond-git/build/out/share/lilypond/current/scm/backend-library.scm:154:7: No such file or directory
    fatal error: Children (1) exited with errors.

    --snip--

    /9e/lily-f2cfd744.*

    is the file generated from

    $LILYPOND_GIT/Documentation/snippets/clip-systems.ly

     
  • Masamichi Hosoda

    • summary: Replace -dgs-load-fonts' to--bigpdfs' in lilypond-book --> Remove -dgs-load-fonts in lilypond-book
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,10 +1,4 @@
    -Replace `-dgs-load-fonts' to `--bigpdfs' in lilypond-book
    -
    -Some fonts cannot use with `-dgs-load-fonts' option
    -(also `-dgs-load-lily-fonts' option).
    -
    -`--bigpdfs' option is more suitable than `-dgs-load-fonts'
    -because the common font that is used by multiple snippets
    -in the document becomes integrated into one.
    +Some fonts cannot use with `-dgs-load-fonts` option
    +(also `-dgs-load-lily-fonts` option).
    
     http://codereview.appspot.com/300280043
    
     
  • David Kastrup

    David Kastrup - 2016-06-14

    If we use -dgs-load-lily-fonts, is it possible to omit -dinclude-eps-fonts ? Because that may be involved with the disk space usage as well.

     
  • Masamichi Hosoda

    In that case, intermediate PDF will be broken if you use a font that ghostscript can not find.

    In my environment, ghostscript can not find TeX Gyre fonts.
    Here is a sample file.

    %%% aaa.ly %%%
    
    \version "2.19.42"
    
    \markup {
      {Here is the default font.}
      \override #'(font-name . "Nimbus Sans L")
      {Here is Nimbus Sans L.}
    }
    

    The following command builds intermediate EPS files and intermediate PDF files.

    $ lilypond -dbackend=eps -dno-include-eps-fonts --ps --pdf aaa.ly
    

    The generated aaa-1.pdf is embedded wrong font (maybe Courier) as TeX Gyre.

     

Log in to post a comment.