GNOME Bugzilla – Bug 328189
Deal with proper change notification for PangoContext
Last modified: 2006-05-19 18:04:23 UTC
Cleaning up 5-years old pango/TODO.xml: <code>pango_layout_context_changed()</code> is a hack. Either the context should have change-notification, or else the layout should make a copy of the context when the context is set. Use signals for change-notification needs to wait on <code>GSignal</code> getting finished. Not sure how hard it would be nowadays with the cairo backend. For the least, it needs cairo to support change notification on cairo_t objects if I'm not mistaken. Not sure if it's worth the change at all now that people are used to this function.
Well, with the Cairo backend, you aren't going to get away from having to call pango_cairo_update_context(), but it would still be nice if that automatically propagated to layouts created for that context. I don't think people are used to pango_layout_context_changed(), they just don't change their contexts very often :-) This bug could actually be fixed without adding a signal to PangoContext by keeping a serial, and then pango_layout_check_lines() could compare the context's serial with the last serial seen by the layout. You don't get the temporary memory saving of dumping the cached layouts, but you don't pay the overhead of signal connections in the common case where the context doesn't change.
(To expand a little on the memory issue, while the transition is going on, you have: - All fonts used by all layouts which have been updated - All fonts used by all layouts which haven't yet been updated if you have active notification then the second set will be empty when the transition finishes, but with only passive noticing of changes, then the second set could stay non-empty forever. Still, I'm not sure this makes up for the signal costs and complexity)
Agreed. But does it only affect pango_layout_check_lines()?
All cached information in PangoLayout I'm aware of is within the big blob of things eliminated by pango_layout_clear_lines() and recomputed by pango_layout_check_lines(), but probably would be good to audit to reconfirm.
*** This bug has been marked as a duplicate of 340066 ***