[cairo] Re: User-font API, take 3

Behdad Esfahbod behdad at behdad.org
Wed Feb 7 16:14:49 PST 2007


On Tue, 2007-02-06 at 20:15 -0800, Behdad Esfahbod wrote:
> 
> So I thought about it a bit more and I want to suggest:
> 
>   - Instead of ctm and font_matrix, we just pass scaled_font->scale to
> scaled_font_create().  The product of ctm and font_matrix is the only
> thing that the font should care about, and the ctm and font_matrix can
> be accessed using public API anyway.

Done.

>   - Set cairo_set_font_size (cr, 1.) on the cairo_t passed to
> get_glyph(), so the context has the same font and user space. 

Done too.  But for this to be useful, I also set the font options on the
cairo_t, and set scaled_font->scale as the ctm.  This means, the
meta-surface that we record to now records in device space, not font
space.  This makes a lot of sense.  The user-font can now simply use the
cairo_t font API and it will all just work.

This has the advantage that when replaying, we don't need a freeform
device_transform anymore, which is good.  The bad thing is that we now
have to add a way to get the glyphs extents out of the meta-surface *in
font space*.  This may be hard.  One way to do it is to replay the
meta-surface against another meta-surface to get back to font space and
implement the freeform device_transform thing as before.


-- 
behdad
http://behdad.org/

"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