Bug 17223

Summary: cairo_set_dash and fallback resolution dependency
Product: cairo Reporter: Paul Sephton <paul>
Component: pdf backendAssignee: Adrian Johnson <ajohnson>
Status: RESOLVED DUPLICATE QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: critical    
Priority: medium CC: paul
Version: 1.7.5   
Hardware: x86 (IA32)   
OS: All   
i915 platform: i915 features:

Description Paul Sephton 2008-08-20 05:39:41 UTC
I have done a bugzilla search and cannot find a similar report.  I hope that this report is helpful.

cairo_set_dash() and subsequent stroking only seems to work properly when the target surface fallback resolution matches the actual device resolution.  For example, with PDF & postscript surfaces, cairo_surface_set_fallback_resolution(s, 72, 72) works, while the default 300x300 does not.  For win32 printers, the fallback resolution must be set to the actual printer resolution.  Again, the default 300x300 does not work.

The effect of this behaviour is that the output differs completely when outputting to PDF (eg. Linux) versus output to a win32 printer.  It also means that for some high res printers a spool file size of >100Meg (under win32) is not uncommon.  The unnecessarily large resolution of the spool file slows things down considerably both in generation as well as production.

To demonstrate the problem, apply the following 2-liner patch to test/fallback_resolution.c.  The overshoot in stroking the dashed lines is very evident.

--- old/fallback-resolution.c	2008-08-20 14:06:39.000000000 +0200
+++ new/fallback-resolution.c	2008-08-20 14:06:33.000000000 +0200
@@ -50,9 +50,10 @@
     cairo_text_extents_t extents;
     cairo_save (cr);
+    double dash[] = {1.0,2.0,3.0};
+    cairo_set_dash(cr, dash, 3, 0);   
     cairo_new_path (cr);
     cairo_set_line_width (cr, .05 * SIZE / 2.0);
     cairo_arc (cr, SIZE / 2.0, SIZE / 2.0,
 	       0.75 * SIZE / 2.0,
Comment 1 Chris Wilson 2008-09-28 13:11:13 UTC
I've modified fallback-resolution to include a dashed line as suggested (and since this is now automatically checked, we have a big FAIL in our test suite :-(.

*** This bug has been marked as a duplicate of bug 9189 ***

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.