[cairo] Fwd: Re: Uniform Line Widths

Bill Spitzak spitzak at thefoundry.co.uk
Mon Feb 25 00:28:44 PST 2008

Behdad Esfahbod wrote:

> One thing these changes mean is that for example, if you have a routine
> draw_happy_face(cr), then just cairo_scale()ing before calling that
> routine doesn't linearly enlarge the drawing.  because the stroke width
> is not scaled anymore, and the font size is not scaled either.  That's a
> serious change in semantics.

Well that is the entire point of this change. Most people do NOT expect 
the lines to get thicker. The Cairo and PostScript behavior is *bizarre* 
and not at all what is wanted by anybody trying to draw graphics.

Even if there is disagreement about what behavior is more expected, I 
think everybody can agree that the ability to achieve both are useful.

But in the current system the only practical way to avoid changing the 
line width is to not use transforms at all (the suggestion to set the 
ctm to the identity and then set the line width is not correct, as it 
will defeat any scaling the is surrounding the image. You could achieve 
the correct result by remembering the ctm at the point the line width 
would be set and then pushing/popping it around every stroke. Nothing 
will solve fonts however as you cannot split the x/y positioning of the 
glyphs from the rendering).

In the proposed system it is trivial and obvious how to get the line 
width to scale (just set the line width *after* the transform, as 
perhaps 99% of the Cairo-calling code is already doing!).

> Maybe there's a third way, to provide both semantics.

I think the only reason to do this is if the back compatibility problems 
require it.

More information about the cairo mailing list