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 163162 - Support pango_attr_list_change() on broader set of lists
Support pango_attr_list_change() on broader set of lists
Status: RESOLVED OBSOLETE
Product: pango
Classification: Platform
Component: general
1.8.x
Other All
: Normal minor
: Medium fix
Assigned To: pango-maint
pango-maint
Depends on:
Blocks: 162961
 
 
Reported: 2005-01-06 19:37 UTC by Morten Welinder
Modified: 2018-05-22 12:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testattr.c (3.35 KB, text/x-c)
2005-01-06 19:38 UTC, Morten Welinder
Details

Description Morten Welinder 2005-01-06 19:37:27 UTC
Test program coming up.  The final pango_attr_list_change should make
character 8 bold (==700).

./testattr 
Original list: PangoAttrList at 21400
  start=6; end=9
    weight=700
  start=8; end=9
    weight=400
Other list: PangoAttrList at 21418
  start=0; end=1
    weight=700
After splice: PangoAttrList at 21400
  start=6; end=10
    weight=700
  start=8; end=10
    weight=400
After change: PangoAttrList at 21400
  start=6; end=10
    weight=700
  start=8; end=10
    weight=400
Comment 1 Morten Welinder 2005-01-06 19:38:09 UTC
Created attachment 35574 [details]
testattr.c

leaks like crazy, sorry.
Comment 2 Morten Welinder 2005-01-07 17:12:58 UTC
It looks like pango_attr_list_change assumes that no attribute is ever
overridden later in the list.

Thus pango_attr_list_change and pango_attr_list_splice cannot be used on lists
that have ever had one of the _inserts used on them (unless something else
guarantees the above property).

Comment 3 Owen Taylor 2005-03-01 15:31:08 UTC
Well, I'm not really sure what pango_attr_list_splice() and change() 
*should* do on a list of that form.

The basic operation of Pango works with any list created with 
pango_attr_list_insert() which just keeps the start indices
of all the attributes in the list in non-decreasing order.

But the idea of change() is that it keeps the list in a more
strictly canonical form where there is only one attribute of
each type at each position. If the list is not already in
that form, is that a well-defined operation?

Comment 4 Morten Welinder 2005-03-01 16:19:05 UTC
I don't see the ambiguity.

An attribute list has a well-defined meaning, namely the one you get by
iterating over it.  If insert has been used, then the later attributes
may overrule the early ones, but someone iterating will not see that.

With that view, _insert and _change have the same semantics as far as the
meaning of the result.  On top of that, _change adds certain guarantees that
it should probably spell out:

1 Any position that had no overlap (ie., no later overruling earlier) will
  continue to have no overlap.
2 Attributes that become adjacent because of the change will be merged.
3 Repeated changes will not cause the list to grow unboundedly.

If you don't want to promise too much, 1+2 could be promised only for lists
with no overruling only at all.


> If the list is not already in that form, is that a well-defined operation?

There might be several different possible results (like qsort has when some
elements compare equal), but the basic meaning of the change operation is
clear as it follows from the meaning of the list: _change needs to change
the iterated meaning of the list.
Comment 5 Owen Taylor 2005-07-26 14:08:17 UTC
A requirement for a patch implementing this being accepted would be that it
doesn't make pango_attr_list_change() significantly more expensive; it
also would be really nice to have test cases here to verify changes
to this complex function.

Marking Severity as minor because I don't know any real use cases for
calling change() on lists with overlapping attributes.
Comment 6 bill.haneman 2006-06-23 16:51:36 UTC
*** Bug 154487 has been marked as a duplicate of this bug. ***
Comment 7 GNOME Infrastructure Team 2018-05-22 12:08:17 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pango/issues/21.