[cairo] [PATCH 0/5] Fix dashing with zero length dash intervals.

Jeff Muizelaar jeff at infidigm.net
Fri Apr 14 10:41:15 PDT 2006


On Fri, Apr 14, 2006 at 10:15:49AM -0700, Carl Worth wrote:
> On Sun, 9 Apr 2006 23:10:36 -0400, Jeff Muizelaar wrote:
> >
> > The current implementation will render a zero-length visible segment as having
> > zero length. However, the ghostscript rasterizer as well as acrobat both render
> > these segments as they do zero-width lines -- 1 pixel thick.
> 
> Oh, so that's actually a problem.
> 
> Now that the zero-length dash stuff has landed I am getting a failure
> for the new dash-zero-length test against the PostScript backend. The
> claim of the test case is that butt-capped zero-length dash segments
> should be invisible.
> 
> I like that semantic, as it is consistent with the fact that zero
> width stroked lines in cairo are also invisible.
> 
> So this new failure is a bug in the PostScript backend since it's not
> emitting something invisible.
> 
> In the case of zero-width lines, cairo's PostScript should be
> consistent with cairo's "invisible" semantics because we catch the 0.0
> case early up in cairo_gstate.c and don't draw anything.
> 
> So maybe we should do the same thing here, and at a high-level catch
> the case of butt-capped dashing and filter out any zero elements in
> the dash array. For example, a dash array of:
> 
> 	[4 0 1]
> 
> would be replaced with:
> 
> 	[5]
> 
> when drawing with butt caps, (and should be left alone when drawing
> with round or square caps).
> 
> What do you think?

I wasn't aware that we already handled the zero-width lines in
postscript properly. But yeah, I agree that this should be dealt with in
similar way with the dashing array being temporarily modified while
stroking with butt caps.

-Jeff


More information about the cairo mailing list