Bug 73441 - Cairo generates PDFs with wrong font names
Summary: Cairo generates PDFs with wrong font names
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Chris Wilson
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-09 16:39 UTC by Marek Kasik
Modified: 2014-01-10 10:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Generate PDFs with correct font names (5.60 KB, patch)
2014-01-09 16:39 UTC, Marek Kasik
Details | Splinter Review
CFF reproducer (6.07 KB, application/octet-stream)
2014-01-09 16:40 UTC, Marek Kasik
Details
Type1 reproducer (11.44 KB, application/octet-stream)
2014-01-09 16:42 UTC, Marek Kasik
Details

Description Marek Kasik 2014-01-09 16:39:29 UTC
Created attachment 91766 [details] [review]
Generate PDFs with correct font names

Cairo exports font names in their original form. But these can be wrong, they can sometimes contain white space characters or PDF/PostScript delimiter characters. Such fonts are not common but they appear.

This can cause a problem when you are printing such file in evince. The printing fails during processing of an intermediate PDF because there are delimiter characters where they shouldn't be.

Attached patch escapes PostScript names of fonts (ps_name variable) right after these are loaded. It was already case for TrueType and OpenType fonts but not for pure CFF fonts. Type1 fonts were just shortened to the last correct character.

Marek
Comment 1 Marek Kasik 2014-01-09 16:40:27 UTC
Created attachment 91767 [details]
CFF reproducer
Comment 2 Marek Kasik 2014-01-09 16:42:08 UTC
Created attachment 91768 [details]
Type1 reproducer

You can find the intermediate PDF in /var/spool/cups/d* .
Comment 3 Adrian Johnson 2014-01-10 10:34:28 UTC
Pushed. Thanks for the patch

> You can find the intermediate PDF in /var/spool/cups/d* .

The easier way is to use pdftocairo.

BTW, what application created the PDF? This looks like PS incorrectly translated to PDF:

stream
300 300 m
/F2 40 Tf
(Hello) Tj
endstream

it should be:

stream
BT
1 0 0 1 300 300 Tm
/F2 40 Tf
(Hello) Tj
ET
endstream
Comment 4 Marek Kasik 2014-01-10 10:40:50 UTC
(In reply to comment #3)
> Pushed. Thanks for the patch

Thank you very much.

> > You can find the intermediate PDF in /var/spool/cups/d* .
> 
> The easier way is to use pdftocairo.
> 
> BTW, what application created the PDF? This looks like PS incorrectly
> translated to PDF:
> 
> stream
> 300 300 m
> /F2 40 Tf
> (Hello) Tj
> endstream
> 
> it should be:
> 
> stream
> BT
> 1 0 0 1 300 300 Tm
> /F2 40 Tf
> (Hello) Tj
> ET
> endstream

I've created it manually and I overlooked this somehow.


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.