[cairo] UserFontFace documentation suggestion (cairomm)

Ian Britten britten at caris.com
Tue Dec 2 08:02:18 PST 2008


Hi all,
Just a minor suggestion for the cairomm UserFontFace class
documentation.

I had to do some digging to find out how to get my custom render
function passed to UserFontFace::set_render_glyph_func(), due to
the use of libsigc++ for the function pointers.
Here's an example, in case anyone else hits it.

     Cairo::ErrorStatus drawUserGlyph(
             const Cairo::RefPtr<Cairo::ScaledFont>& scaled_font,
             unsigned long glyph,
             const Cairo::RefPtr<Cairo::Context>& cr,
             Cairo::TextExtents& metrics)
     {
             return CAIRO_STATUS_SUCCESS;
     }

     // elsewhere
     Cairo::RefPtr<Cairo::UserFontFace> uFace(
             Cairo::UserFontFace::create());
     uFace->set_render_glyph_func(sigc::ptr_fun(drawUserGlyph));
                  // NOTE this    ^^^^^^^^^^^^^

Note the critical part is the sigc::ptr_fun temporary.  It's
easy, once you've found it ;)  Expanding the example in the
docs might help others in the future...

Just my $0.02 (Keep up the great work though)
Ian


More information about the cairo mailing list