GNOME Bugzilla – Bug 163154
GtkHTML / Pango-1.8 incompatbility
Last modified: 2005-03-02 21:58:15 UTC
GtkHTML defines a "new" attribute type with: static const PangoAttrClass html_pango_attr_font_size_klass = { PANGO_ATTR_SIZE, html_pango_attr_font_size_copy, html_pango_attr_font_size_destroy, html_pango_attr_font_size_equal }; The reuse of PANGO_ATTR_SIZE there is *highly* invalid, size attributes have to be allocated using pango_attr_size_new(). What GtkHTML should be doing is to add a *separate* custom attribute to the attribute list along with the size. And use a custom type registered with pango_attr_type_register() for the custom attribute. The problem that came up with Pango-1.8 is that the structure for PANGO_ATTR_SIZE was extended from PangoAttrInt to PangoAttrSize which adds a 'guint absolute : 1' field. That overlaps with the GtkHTMLFontStyle style, with unpredictable results. (Some font styles will show up with smaller pixel-based sizes.) So, what now: - We could declare 1.8.0 "don't use", back out the extension of PANGO_ATTR_SIZE and do the Pango API some other way (add a absolute_size attribute type, likely) This is definitely the way I would have gone if I had found the problem earlier before 1.8.0, but I hate to do it now. (We could keep the pango_attr_size_new_absolute() name to maintain better, though not absolute, compatibility with 1.8.0) - We could just require the GtkHTML bug fix.... the impact on people using older GtkHTML isn't huge; just a bit of font mis-sizing. Any other ideas?
Created attachment 35570 [details] [review] Possible patch I'm attaching a Pango patch that introduces PANGO_ATTR_ABSOLUTE_SIZE, fixing the GtkHTML problem (GTK+ never looks at anything beyond the fields shared with PangoAttrInt) but preserves PangoAttrSize and sets the PangoAttrSize.absolute field on attributes it creates itself. So, it's basically API/ABI compatible with Pango-1.8.0 - the only difference is that if you call pango_attr_size_new_absolute() you get a PANGO_ATTR_ABSOLUTE_SIZE. It would be possible to write code that would get confused by that, but I doubt anyone has in the last month.
Patch has been in HEAD (accidentally ;-() for a while without reported problems. Now committed to pango-1-8. 2005-03-02 Owen Taylor <otaylor@redhat.com> Redo the handling of absolute sizes for PangoAttribute to work around compatibility problems with GtkHTML which was counting on the details of the implementation of size attributes. (#163154) * pango/pango-attributes.[ch] docs/tmpl/text-attributes.sgml: Split PANGO_ATTR_SIZE into PANGO_ATTR_SIZE and PANGO_ATTR_ABSOLUTE_SIZE, and use that distinction rather than the boolean field in PangoAttrSize to distinguish between attributes created pango_attr_size_new_absolute() and pango_attr_size_new()