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

Behdad Esfahbod behdad at behdad.org
Tue Feb 6 20:15:56 PST 2007


On Tue, 2007-02-06 at 17:20 -0800, Behdad Esfahbod wrote:
> 
>   So we get the good stuff from the old design, with a cleaner
>   API.  Another desired effect here is that it should be easy to
>   wrap another cairo font with the user font API.  So it should
>   be easy to take font metrics from another font and pass them
>   on.  You can do that in your scaled_font_create() with the
>   proposed API by:
> 
>     /* we are in font space already */
>     cairo_set_font_size (cr, 1.);
>     cairo_font_extents (cr, extents);
> 
>   So we are all good. 

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.

  - 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.

-- 
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