After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 435709 - pango_cairo_context_[sg]et_shape_renderer()
pango_cairo_context_[sg]et_shape_renderer()
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
1.16.x
Other Linux
: Normal enhancement
: Small API
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2007-05-04 03:32 UTC by Behdad Esfahbod
Modified: 2007-05-04 13:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Committed patch (17.54 KB, patch)
2007-05-04 11:32 UTC, Behdad Esfahbod
committed Details | Review
sample output (9.48 KB, image/png)
2007-05-04 11:33 UTC, Behdad Esfahbod
  Details

Description Behdad Esfahbod 2007-05-04 03:32:43 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.
Comment 1 Behdad Esfahbod 2007-05-04 03:33:10 UTC
Sorry for the noise.
Comment 2 Behdad Esfahbod 2007-05-04 08:13:54 UTC
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.
Comment 3 Behdad Esfahbod 2007-05-04 08:15:22 UTC
Humm, I'm an idiot.  The draw_shape part is already there.  Just need to add the pangocairo parts.
Comment 4 Behdad Esfahbod 2007-05-04 11:32:36 UTC
Created attachment 87519 [details] [review]
Committed patch

Owen, Matthias, can you review the API please?
Comment 5 Behdad Esfahbod 2007-05-04 11:33:53 UTC
Created attachment 87520 [details]
sample output

output of examples/cairoshape.c
Comment 6 Behdad Esfahbod 2007-05-04 11:48:40 UTC
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.

Comment 7 Matthias Clasen 2007-05-04 13:33:31 UTC
There is a bug: the example says that gnome provides 2 things, but then goes on to list 3 things...
Comment 8 Behdad Esfahbod 2007-05-04 13:50:38 UTC
That's a feature.