[cairo] User font feature

Kristian Høgsberg krh at bitplanet.net
Sun Apr 9 22:26:49 PDT 2006


On 4/9/06, Behdad Esfahbod <behdad at cs.toronto.edu> wrote:
> On Fri, 7 Apr 2006, Kristian Høgsberg wrote:
>
> >   cairo_public cairo_font_face_t *
> >   cairo_user_font_face_create (cairo_ucs4_to_index_func_t     ucs4_to_index,
> >                                cairo_get_glyph_metrics_func_t get_glyph_metrics,
> >                                cairo_render_glyph_func_t      render_glyph,
> >                                cairo_get_glyph_path_func_t    get_glyph_path);
> >
> > Using this API the application can create a font face given a set of
> > call backs.  The font face can be used as any other font face and
> > works with cairo_show_text() and cairo_show_glyphs() etc.  The idea is
> > that when cairo needs metrics or the glyph bitmap it calls out to the
> > application provided callbacks.  The glyphs bitmaps are cached and
> > evicted as needed etc. behind the scenes as for the other cairo font
> > face types.
> >
> > While this API is sufficient to fix the poppler performance problem,
> > there's a few other issues to consider:
>
> Is it?  I don't think so.  It doesn't get any data, so you end up
> needing one set of functions per font!

I was thinking that you'd set any data you need as user data on the
cairo_font_face_t object.  We've preferred this approach before to
adding callback specific data and corresponding destroy funcs.

cheers,
Kristian


More information about the cairo mailing list