Bug 93559 - CFF OpenType fonts using Identity-H encoding not displayed
Summary: CFF OpenType fonts using Identity-H encoding not displayed
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: cairo backend (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
: 93780 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-01-02 11:00 UTC by Brecht Machiels
Modified: 2016-02-12 09:47 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Incorrectly rendered PDF (644.13 KB, application/pdf)
2016-01-02 11:00 UTC, Brecht Machiels
Details
Evince screenshot (93.77 KB, image/png)
2016-01-02 11:01 UTC, Brecht Machiels
Details
add OT font types (2.48 KB, patch)
2016-01-03 05:37 UTC, Adrian Johnson
Details | Splinter Review
add OT font types v2 (2.83 KB, patch)
2016-02-01 11:25 UTC, Adrian Johnson
Details | Splinter Review

Description Brecht Machiels 2016-01-02 11:00:08 UTC
Created attachment 120764 [details]
Incorrectly rendered PDF

The following PDF file is not properly rendered:
http://www.mos6581.org/files/intro_template.pdf

This is what it looks like in Evince:
http://i.imgur.com/ha4J3XO.png

Text typeset using a CFF/PostScript OpenType font is not being displayed using Identity-H encoding (two bytes per glyph). The text that is displayed is a Type1 font.

Other PDF viewers (SumatraPDF, Adobe Reader, PDF-XChange, Foxit, Ghostscript, Apple Preview, recent PDF.js versions) display this PDF correctly.

It is interesting to note that when the CFF OpenType font is replaced with a TrueType font (also Identity-H encoded), the resulting PDF rendered properly by Pooppler.

See this issue for more information:
https://github.com/brechtm/rinohtype/issues/2
Comment 1 Brecht Machiels 2016-01-02 11:01:44 UTC
Created attachment 120765 [details]
Evince screenshot
Comment 2 Albert Astals Cid 2016-01-02 18:12:48 UTC
Works fine with Okular so cairo backend bug it'd seem.
Comment 3 Adrian Johnson 2016-01-03 05:37:49 UTC
Created attachment 120772 [details] [review]
add OT font types

Add support for the two missing font types in cairo font:
  - fontCIDType0COT for this bug
  - fontTrueTypeOT (test case in bug 20605)
Comment 4 Adrian Johnson 2016-01-19 20:57:00 UTC
*** Bug 93780 has been marked as a duplicate of this bug. ***
Comment 5 Carlos Garcia Campos 2016-01-31 10:20:36 UTC
Comment on attachment 120772 [details] [review]
add OT font types

Review of attachment 120772 [details] [review]:
-----------------------------------------------------------------

Thanks for the patch, I have a couple of comments/questions, though.

::: poppler/CairoFontEngine.cc
@@ +550,5 @@
> +    codeToGID = NULL;
> +    n = 0;
> +    if (((GfxCIDFont *)gfxFont)->getCIDToGID()) {
> +      n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
> +      codeToGID = (int *)gmallocn(n, sizeof(int));

I think we should check n here just in case, because GfxFont allocates the array and then tries to fill it, so we could have codeToGID != NULL && codeToGIDLen == 0

@@ +553,5 @@
> +      n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
> +      codeToGID = (int *)gmallocn(n, sizeof(int));
> +      memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
> +	     n * sizeof(int));
> +    }

Don't we need to handle here the case of not having a CIDtoGID and !useCIDs?
Comment 6 Adrian Johnson 2016-02-01 11:25:46 UTC
Created attachment 121439 [details] [review]
add OT font types v2

Updated patch.
Comment 7 Adrian Johnson 2016-02-12 09:47:02 UTC
Pushed


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.