Bug 24240 - PDF backend seems to rasterize when drawing to group
Summary: PDF backend seems to rasterize when drawing to group
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: pdf backend (show other bugs)
Version: 1.8.8
Hardware: x86-64 (AMD64) Mac OS X (All)
: medium normal
Assignee: Adrian Johnson
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-30 17:50 UTC by Ken Treis
Modified: 2009-10-02 16:51 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Test program (770 bytes, text/plain)
2009-09-30 17:50 UTC, Ken Treis
Details
Output from cairo 1.8.8 (11.48 KB, application/download)
2009-10-01 02:01 UTC, Adrian Johnson
Details
Output from current git (1.9.3) (11.11 KB, application/download)
2009-10-01 02:05 UTC, Adrian Johnson
Details
Screenshot of preview showing 1.9.3 output (66.56 KB, image/png)
2009-10-01 09:31 UTC, Ken Treis
Details
output from current git with bug fix (7.20 KB, image/pdf)
2009-10-02 07:05 UTC, Adrian Johnson
Details

Description Ken Treis 2009-09-30 17:50:53 UTC
Created attachment 29967 [details]
Test program

The attached test case shows an apparent rasterizing of fonts when text is drawn on a group rather than on the bare context.

On Mac OS X (the only platform I have available for test at present), Preview renders the first line using sub-pixel interpolation. The second line uses basic anti-aliasing instead. And when the result is printed, the first line is crisp while the second line looks like.... well, a printed raster graphic.

I don't know if fonts are the only things being rasterized; paths seem to show similar symptoms.

We have been using this technique when drawing items that may need to be wrapped onto another page (draw it on a group, and if you run out of room, pop it, show page, then paint the group) for quite a while. I have PDFs generated with Cairo 1.4 that don't seem to exhibit this problem, though I haven't run this exact test case against an older Cairo to verify.
Comment 1 Adrian Johnson 2009-10-01 02:01:01 UTC
Created attachment 29973 [details]
Output from cairo 1.8.8

It works for me. This is the PDF output I get from 1.8.8. I tested it with evince, okular, and acroread.

It is probably a bug in Preview.
Comment 2 Adrian Johnson 2009-10-01 02:05:54 UTC
Created attachment 29974 [details]
Output from current git (1.9.3)

There have been some changes in the current git version in the way groups are written to PDFs. Cairo now avoids using PDF Patterns (which are really only intended for repeating patterns) for sources with CAIRO_EXTEND_NONE. This makes it easier for PDF viewers to render. One of the benefits is text in groups is now selectable.

Try this version and see if it works with Preview.
Comment 3 Ken Treis 2009-10-01 09:31:21 UTC
Created attachment 29980 [details]
Screenshot of preview showing 1.9.3 output

(In reply to comment #2)
> There have been some changes in the current git version in the way groups are
> written to PDFs. Cairo now avoids using PDF Patterns (which are really only
> intended for repeating patterns) for sources with CAIRO_EXTEND_NONE. This makes
> it easier for PDF viewers to render. One of the benefits is text in groups is
> now selectable.

Nice -- this definitely sounds like a step in the right direction.

> Try this version and see if it works with Preview.

I can select the text that was grouped, but curiously Preview still doesn't render it with sub-pixel smoothing. It may well be a bug in Preview, since Adobe Reader doesn't show the apparent issue on the 1.8.8 output, either on-screen (it always uses antialiasing anyway) or in print (preview's print output is "blurry", where Adobe's is clean).

Also, the leading "A" on "Arial" doesn't show up in Preview (see attached screenshot). It shows up in Adobe Reader on-screen but not when printed -- in fact, after printing, Adobe Reader shows the following:

> An error exists on this page. Acrobat may not display the page correctly.
> Please contact the person who created the PDF document to correct the problem.
Comment 4 Adrian Johnson 2009-10-02 07:05:29 UTC
Created attachment 29998 [details]
output from current git with bug fix

I've fixed the bugs causing the missing 'A' and acroread error message.

Try this version.
Comment 5 Ken Treis 2009-10-02 08:36:37 UTC
I can confirm that your fix makes the missing "A" reappear in Preview and in Acrobat's printed output) and that the error message is gone. Thanks!

I will see if I can report the Preview bug to Apple.


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.