[cairo] Fwd: Re: Uniform Line Widths

Behdad Esfahbod behdad at behdad.org
Sat Feb 23 14:50:58 PST 2008

On Fri, 2008-02-22 at 17:06 -0800, Bill Spitzak wrote:
> Behdad Esfahbod wrote:
> >>> Fixing this for text is even trickier.  When do you lock the ctm?!  At
> >>> cairo_set_font_size(), sure.  At cairo_set_font_matrix() too?!  That
> >>> kinda doesn't sound right, but makes some sense...  I'll discuss that
> >>> more when we consider this change...
> >> I'm pretty certain it would be done at the time of the set_font_matrix.
> >> I believe font_size should be a convinence wrapper over this, just as
> >> you are proposing for the pen.
> > 
> > Problem with it is, people expect that sandwiching between
> > "cairo_save(); cairo_scale(2,2);" and "cairo_restore()" should make it
> > draw twice bigger text.  If we lock, that wouldn't happen.  Donno.
> I don't understand this. I also expect twice-bigger text if the 
> set_font_matrix is put at the point like you suggest.

Right.  But I was talking about the case without set_font_matrix().
Just a bare cairo_scale().

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.

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

> As I see it, the 
> matrix given to set_font_matrix() is immediatly multiplied by the ctm 
> and only that result is stored and used from then on to transform glyphs 
> to the output surface, thus I also think the resulting matrix is locked 
> at that point.
> The request for the font matrix has to divide the stored constant matrix 
> by the ctm.


"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list