Bug 73441

Summary: Cairo generates PDFs with wrong font names
Product: cairo Reporter: Marek Kasik <mkasik>
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Generate PDFs with correct font names
CFF reproducer
Type1 reproducer

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.