Bug 44412

Summary: Poppler is ignoring .otf fonts
Product: poppler Reporter: Yi Yang <ahyangyi>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: A patch that solves this bug

Description Yi Yang 2012-01-03 00:44:24 UTC
Created attachment 55066 [details] [review]
A patch that solves this bug

As we know, ttf and otf are essentially the same format with some different conventions. Therefore, they should be treated alike.

In function [void GfxFont::findExtFontFile] in GfxFont.cc and [GlobalParams::getDisplayFont], poppler is testing font's extension names. However, poppler only tested ".ttf", ignoring .otf files.

This will cause pdfs with unembedded fonts being rendered poorly even if fontconfig is configured properly, as long as the correct options have .otf format.

To reproduce this problem, remove the URW++ type 1 fonts if you have any.  Configure fontforge to use Truetype/Opentype fonts like Liberation Fonts or Tex Gyre Fonts to substitute the standard postscript fonts. Then, make sure the suffices of these fonts are .otf. Then open a pdf with unembedded fonts, and the bug should occur.

A simple patch that solves this problem is attached.
Comment 1 Adrian Johnson 2012-01-03 03:28:06 UTC
Comment on attachment 55066 [details] [review]
A patch that solves this bug

I tested the patch with an OpenType/CFF font and it seems to work with both splash and cairo.

Somewhat related I have a patch I have been using to debug font substitution problems that shows what fonts are used for the substitution. See bug 44416.
Comment 2 Albert Astals Cid 2012-01-04 15:30:14 UTC
Adrian if you have confirmed it works with both splash and cairo, please commit to master and 0.18 branches
Comment 3 Adrian Johnson 2012-01-06 15:30:23 UTC
Pushed to master and 0.18 branch.

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.