GNOME Bugzilla – Bug 435709
pango_cairo_context_[sg]et_shape_renderer()
Last modified: 2007-05-04 13:50:38 UTC
Add a new attribute type PANGO_CAIRO_ATTR_SHAPE, probably give it a number like 100 or something, not sure about that part. Anyway, pango_cairo_attr_shape_new() will take a callback and data, and will call the callback passing in: * a cairo_t translated to have the shape origin (left baseline) at (0,0). * const attr struct, which includes logical/ink extents of the shape and user data. * possibly the data pointer again. So you get free-form drawing in PangoLayout with the cairo backend.
Sorry for the noise.
I thought more about this and for the shape machinery to work in the generic layout process it's got to be of type PANGO_ATTR_SHAPE. So I'm changing the proposal. Will add a draw_shape() method to PangoRendererClass, that the PangoCairoRenderer will override and get calls for the SHAPE attrs. There will also be a new api pango_cairo_context_set_shape_renderer() that takes a callback. The PangoContextRenderer then will dispatch to the callback on shape attributes.
Humm, I'm an idiot. The draw_shape part is already there. Just need to add the pangocairo parts.
Created attachment 87519 [details] [review] Committed patch Owen, Matthias, can you review the API please?
Created attachment 87520 [details] sample output output of examples/cairoshape.c
2007-05-04 Behdad Esfahbod <behdad@gnome.org> Bug 435709 – pango_cairo_context_[sg]et_shape_renderer() * pango/pangocairo.h: * pango/pangocairo-context.c: * pango/pangocairo-render.c: New API PangoCairoShapeRendererFunc and pango_cairo_context_[sg]et_shape_renderer() * docs/pango-sections.txt, docs/tmpl/pangocairo.sgml: Document new API. * examples/Makefile.am, examples/cairoshape.c: New example to show off new API/feature.
There is a bug: the example says that gnome provides 2 things, but then goes on to list 3 things...
That's a feature.