Re: Detect changes to a PangoLayout

Hi Neil,

I took a note to add some kind of API for that.  See last comment in:

In the mean time here's a trick you can use to detect changes (no signals though):

- Get the first line of the layout using pango_layout_get_line_readonly(layout, 0);

  - Reference that line using pango_layout_line_ref(line) and store it somewhere.

- When you want to detect changes to the layout, check whether line->layout is NULL. If it is, the layout was changed and as a result it disassociated from the old line.

  - If changed, unref the line and repeat.

Hope that helps.


On 05/20/2009 01:45 PM, Neil Roberts wrote:

In Clutter we currently use Pango to render the ClutterTexts. Every
time the ClutterText is painted we call pango_renderer_draw_layout
which creates some geometry to send to the GPU.

It would be nice if we could avoid rebuilding this geometry every
frame and keep it in a vertex buffer object instead. There is a patch
to do this here:

This works by attaching some data to the pango layout when it is first
painted using g_object_set_qdata. It works fine for ClutterTexts because
they abandon the layout and recreate it any time it needs to make some
changes. However we also expose an interface from Cogl for directly
rendering pango layouts. In that case it might not work correctly if
the developer renders the layout, makes some changes to it and then
renders it again later because the VBO will already have been created
and attached to the layout.

So my question is: is there any to detect when the PangoLayout has
been altered so we can recreate the VBO? PangoLayout doesn't seem to
have any properties or signals that I could attach to.

Thanks for your help.

- Neil
gtk-i18n-list mailing list
gtk-i18n-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]