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 163679 - Very hard to unset attributes.
Very hard to unset attributes.
Status: RESOLVED OBSOLETE
Product: pango
Classification: Platform
Component: general
1.8.x
Other All
: Normal enhancement
: Small API
Assigned To: Behdad Esfahbod
pango-maint
Depends on:
Blocks:
 
 
Reported: 2005-01-11 15:30 UTC by Morten Welinder
Modified: 2018-05-22 12:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Suggested patch (3.40 KB, patch)
2005-01-12 20:31 UTC, Morten Welinder
rejected Details | Review
a patch for pango_attr_list_unset( ) (2.16 KB, patch)
2006-05-25 08:56 UTC, LingNing Zhang
needs-work Details | Review
modify the patch (3.03 KB, patch)
2006-05-29 10:32 UTC, LingNing Zhang
needs-work Details | Review
modified patch (3.39 KB, patch)
2006-07-11 07:26 UTC, LingNing Zhang
none Details | Review

Description Morten Welinder 2005-01-11 15:30:38 UTC
If I have an attribute list, it is easy to

1. Set character 4 to bold.
2. Set character 4 to non-bold.

but it is very hard to

3. Set character 4 not to have a boldness attribute.

In fact, without access to the internal list structure this feels like one
would have to build a new list, then empty the original one, then copy over.

(There are two versions of this problem: single attribute and all attributes.)\
Comment 1 Owen Taylor 2005-01-11 16:07:24 UTC
Probably something like pango_attr_list_unset (list, start, end, type); would
work. (Would split attributes as necessary, that makes the implementation not
*entirely* trivial, since you have to move the second half of the attribute
further away in the attribute list.)

PangoAttrList was thought of originally as mostly a write-only data structure..
and app would have some other internal representation of attributes and would
convert that representation to a PangoAttrList to pass it to Pango.

A patch would be appreciated.
Comment 2 Morten Welinder 2005-01-12 20:31:30 UTC
Created attachment 35912 [details] [review]
Suggested patch

This patch is based on existing public pango API (so I can still use it outside

pango) and shouldn't be too slow for realistic attribute lists.
Comment 3 Behdad Esfahbod 2006-01-16 09:55:39 UTC
Patch looks good.  Owen, what do you think?
Comment 4 Behdad Esfahbod 2006-01-28 19:38:38 UTC
Ok, we need a better patch that uses the internals of the attrlist.
Comment 5 LingNing Zhang 2006-05-25 08:56:05 UTC
Created attachment 66175 [details] [review]
a patch for pango_attr_list_unset( )

I wrote a patch and implemented pango_attr_list_unset( ) with using the internals of the attrlist.
:)
Comment 6 Behdad Esfahbod 2006-05-25 09:15:35 UTC
Thanks LingNing, but your patch doesn't split attributes if a non-perfect match happens.  See Morten's patch for example
Comment 7 LingNing Zhang 2006-05-25 09:43:00 UTC
ok, let me see.
:)
Comment 8 LingNing Zhang 2006-05-29 10:32:02 UTC
Created attachment 66411 [details] [review]
modify the patch

modify the pango_attr_list_unset( ).
Then the patch can split attributes if a non-perfect match happens.
Comment 9 Behdad Esfahbod 2006-07-10 19:42:15 UTC
LingNing, can you attach a correctly indented patch, with documentation block please?
Comment 10 LingNing Zhang 2006-07-11 02:28:17 UTC
ok, I will attach it.
:)
Comment 11 LingNing Zhang 2006-07-11 07:26:06 UTC
Created attachment 68764 [details] [review]
modified patch

I modified the indenting and added the documentation block.
Comment 12 GNOME Infrastructure Team 2018-05-22 12:08:56 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/22.