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 163154 - GtkHTML / Pango-1.8 incompatbility
GtkHTML / Pango-1.8 incompatbility
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
1.5.x
Other Linux
: Normal normal
: ---
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2005-01-06 18:20 UTC by Owen Taylor
Modified: 2005-03-02 21:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Possible patch (4.55 KB, patch)
2005-01-06 18:51 UTC, Owen Taylor
none Details | Review

Description Owen Taylor 2005-01-06 18:20:30 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?
Comment 1 Owen Taylor 2005-01-06 18:51:58 UTC
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.
Comment 2 Owen Taylor 2005-03-02 21:58:15 UTC
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()