admin管理员组

文章数量:1335436

We're using Ghostscript to embed fonts into PDF files and compress them at the same time. Recently, when upgrading to Ghostscript 10, we noticed that the process took significantly longer than before. We were able to restore the old performance by adding -dNEWPDF=false, but of course that can only be a temporary fix.

This is our invocation (inspired by .ts#L242):

gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dEmbedAllFonts=true -dSubsetFonts=true -dColorImageDownsampleType=/Bicubic -dColorImageResolution=144 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=144 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=144 -sOutputFile=${output} ${input}

While trying to debug the issue, I noticed two differences between the output of the command with NEWPDF enabled and disabled:

  • The new interpreter outputs several warning: ignoring zlib error: incorrect data check messages to stderr that the old one doesn't.
  • Without -q, the old interpreter repeatedly writes messages like these:
Can't find (or can't open) font file /usr/share/ghostscript/10.00.0/Resource/Font//usr/sh.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/Arial.ttf... 8289900 6751216 7254872 5777824 4 done.

where the new one simply writes

Loading font ArialMT (or substitute) from /usr/share/ghostscript/10.00.0/Resource/Font/NimbusSans-Regular

Whether those differences are relevant or not, the new interpreter is consistently slower. Is there something we can do to speed it up?

We're running GS 10.0.0 on a Debian 12 system with the following fonts packages installed: fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf.

本文标签: Ghostscript39s new PDF interpreter slower at embedding fontsStack Overflow