Bug 46744

Summary: [patch] pdftops git 29feb12 -passfonts regression
Product: poppler Reporter: William Bader <williambader>
Component: utilsAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: williambader
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: patch against poppler cloned from git on 29Feb12
new patch against poppler cloned from git on 2Mar12

Description William Bader 2012-02-28 20:56:35 UTC
Created attachment 57789 [details] [review]
patch against poppler cloned from git on 29Feb12

When a PDF references a non-embedded font, the git version of pdftops ignores -passfonts and attempts to embed an external font.

This is a regression from 0.18.4 on two counts.

First, when pdftops embeds the font, it creates a font with the name referenced in the pdf even if it embeds a substitute.  This makes the generated EPS file misleading because pre-flight scans of the EPS won't generate warnings about missing fonts, but the file will print incorrectly, even if the printer has the correct font.

Second, even if pdftops embeds a font with the same name, the font might be different, for example, the Linux system running pdftops might have a low quality free font while the printer might have a high quality commercial font.

In addition, I have a workflow with a lot of little files that all use a small number of fonts.  For a sample 2326 byte PDF, pdftops 0.18.4 generated a 18080 byte EPS while the new git version generates a 1157015 byte EPS, over 60X as large, due to the embedded font (which happens to be a substitution anyway).  I have to build PS pages that each contain several hundred of these files, and all of the extra copies of the font add up.

It seems like someone tried to replace psSubstFonts with psFontPassthrough in GlobalParams, but pdftops.cc sets psSubstFonts while GfxFont.cc tests psFontPassthrough.  I made the smallest change to get -passfonts working, which was restoring GlobalParams::getPSSubstFonts() and testing globalParams->getPSSubstFonts() in GfxFont::locateFont().  This restores the behavior of 0.18.4 (and previous versions).

William
Comment 1 Albert Astals Cid 2012-03-01 14:43:03 UTC
I'd prefer if you killed getPSSubstFonts (also kill the psSubstFonts variable) and made pdftops call getPSFontPassthrough, that gets us closed to xpdf3.03 code base
Comment 2 William Bader 2012-03-01 18:19:47 UTC
Created attachment 57889 [details] [review]
new patch against poppler cloned from git on 2Mar12

This patch fixes pdftops -passfonts by using the new psFontPassthrough variable consistently and removing the old psSubstFonts and its setter and getter in GlobalParams.

William
Comment 3 Albert Astals Cid 2012-03-02 10:43:03 UTC
Pushed, thanks a lot :-)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.