GNOME Bugzilla – Bug 497412
GtkCellRendererText restores default values instead of set values to font description
Last modified: 2007-11-18 18:32:48 UTC
Please describe the problem: Although it is possible to set/unset the use of e.g. "background" with "background-set", this is not possible for e.g. "family", "style", "weight". According to the Subversion changelog this is not intended: Revision 4843, Tue Sep 25 11:22:23 2001: * gtk/gtkcellrenderertext.c gtk/gtktexttag.c: Restore the behavior where you could turn family_set (etc) back on and get back the values you had before. Steps to reproduce: 1. set "style" on a GtkCellRendererText to PANGO_STYLE_ITALIC 2. create a GtkTreeViewColumn with that renderer and set attribute "style-set" to a G_TYPE_BOOLEAN column Actual results: The style will be PANGO_STYLE_NORMAL as soon as "style-set" is set to FALSE and won't change to PANGO_STYLE_ITALIC. Expected results: Style should change according to the value of the G_TYPE_BOOLEAN column between PANGO_STYLE_ITALIC and PANGO_STYLE_NORMAL. Does this happen every time? yes Other information: To unset the font attributes pango_font_description_unset_fields() is used. According to http://library.gnome.org/devel/pango/unstable/pango-Fonts.html#pango-font-description-unset-fields in current versions of Pango "The unset fields will get back to their default values." Similar code is used in gtktexttag.c. I'll attach a patch for gtkcellrenderertext.c with a possible solution: I keep a private PangoFontDescription with all set properties and restore the attributes from it. Please have a look.
Created attachment 99214 [details] [review] gtkcellrenderertext-fontdescription.patch
Basically Pango broke API somewhere in 2005/2006 and we've decided to accept this breakage instead of fixing/working around it. See 350882 and 355124 for more information. *** This bug has been marked as a duplicate of 350882 ***