Bug 103249 - pdftocairo PDF output breaks embedded fonts
Summary: pdftocairo PDF output breaks embedded fonts
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: pdf backend (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Adrian Johnson
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-12 23:40 UTC by Stephen E.
Modified: 2017-10-14 01:39 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Input file with embedded fonts (30.15 KB, application/pdf)
2017-10-12 23:40 UTC, Stephen E.
Details
Before and After Comparison (182.72 KB, image/png)
2017-10-12 23:41 UTC, Stephen E.
Details

Description Stephen E. 2017-10-12 23:40:04 UTC
Created attachment 134819 [details]
Input file with embedded fonts

Steps to reproduce:

1. Save the attached file (EmbeddedFont.pdf)
2. Run: pdftocairo -pdf EmbeddedFont.pdf out.pdf

Expected:

- Output has same appearance as input (a serif font).

Actual:

- Output falls back to a system font (sans serif) because fonts are no longer embedded.

Notes:

- The other output formats (PNG, JPEG, SVG) appear to produce the correct/desired appearance. Only the PDF output is affected.
Comment 1 Stephen E. 2017-10-12 23:41:22 UTC
Created attachment 134820 [details]
Before and After Comparison

Screenshot comparing the input and output files using Evince
Comment 2 Adrian Johnson 2017-10-13 09:25:23 UTC
The font family name in the embedded font contained > 3000 chars of garbage. As a result the font name was truncated and missing the closing delimiter.

Prevent long strings from being truncated in PDF file:

https://cgit.freedesktop.org/cairo/commit/?id=202a9ed64e3d164307defddb41a9f8cf9e9b751b

Sanity check the font name length and ignore it if too long:

https://cgit.freedesktop.org/cairo/commit/?id=bb10bd10138a262759b37281135b5199e334f392
Comment 3 Stephen E. 2017-10-14 00:28:34 UTC
Interesting finding! Thank you for the explanation and fast fix.

I'm assuming if I now build libcairo from master and then re-run pdftocairo, I should see a different result?
Comment 4 Adrian Johnson 2017-10-14 01:39:14 UTC
Yes, it works for me now. The missing delimiter caused viewers to fail to parse the font and as a result substitute it with something else.


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.