Skip to content

Add API to compare PangoAttrLists

Jonas Dreßler requested to merge verdre/pango:add-compare-attr-lists into master

Add a new pango_attr_list_equal API that allows comparing the attributes included in two PangoAttrLists and returns TRUE if the lists contain the same attributes and apply to the same ranges.

The function avoids any copying of attributes or lists and applies a minor optimization of skipping the equality check for attributes that were already found in both lists. Other possible optimizations that could be added if necessary would be storing the length of the attributes list in the PangoAttrList class to avoid the g_slist_length calls or reusing the other_iter pointer in case all attributes from 0 to n were already found.

This API would be very helpful for gnome-shell as it allows avoiding unnecessary relayouts of ClutterTexts, see gnome-shell#1411 (closed).

Edited by Jonas Dreßler

Merge request reports