GNOME Bugzilla – Bug 334582
Text is shifted off-by-one in Add to panel
Last modified: 2006-05-04 16:46:27 UTC
There is a case where text (caption of icons) is shifted in an unusual way to the right, when an icon is selected. This has been observed in Ubuntu Dapper, Greek locale. Compare the two following attached screenshots.
Created attachment 61249 [details] "Add to panel" window, when no icon is selected. Notice that the "o" in Pilot appears wider than other "o" in the window. The same goes with the second "mu" (as in micro) at the icon caption below.
Created attachment 61250 [details] "Add to panel" window, when icon is selected. We select an icon and we can now see that text is strangely shifted to the right. It is shifted in a way as if a rectangle is copied and pasted one pixel to the right. Thanks to Konstantinos Togias for both screenshots.
Chances are that bug 329547 may be relevant to this.
Created attachment 61256 [details] Before mouse pointer pass over any applet icon This is the screenshot of "add to panel" window just after it is opened and before mouse pointer pass over any applet icon.
Created attachment 61257 [details] After mouse pointer has just passed over an applet icon at the first row This is a screenshot of "Add to pannel" widow just after mouse pointer has passed over an icon of the first row. Please notice the distortion of character 'y' in 'Sticky Notes', character 's' in GEyes and all the instances of greek character 'η' in 'Αναζήτηση Λεξικού'. Also some of the characters are shifted to right and spaces between characters have been alerted.
The view of "Add to panel" window changes from http://bugzilla.gnome.org/attachment.cgi?id=61256&action=view to http://bugzilla.gnome.org/attachment.cgi?id=61257&action=view and back as mouse pointer passes over the various applet icons and selects by klicking.
The same bug appears when selecting english USA language from GDM and the applet icon captions do not contain greek characters.
Created attachment 62960 [details] Animated gif showing the slight shifting of text This animated GIF was generated on Ubuntu Breezy with en_US.UTF-8 locale and the application font was set to Bitstream Vera Sans Roman. This bug appears in Dapper as well. When you open the Add to Panel dialog box, simply hover the mouse over the icons (no clicking required). To generate the GIF, I did a full hover over all icons and took the second screenshot.
Yes, I observed this in the GNOME 2.14 Live CD. I fixed a rounding bug with Pango+Cairo that *may* fix this too. If it doesn't, I really doubt it's a Pango bug. The most probable thing is that Add to Panel is drawing Pango layouts at non-pixel-boundaries. It shouldn't.
bug #318552 is about that too (same issue on the control-center canvas screen), might be a gnomecanvas bug
*** Bug 318552 has been marked as a duplicate of this bug. ***
Could you point the changelog entry corresponding to that rounding bug fix? The issue happens with the gnome-control-center shell too, could be a gnomecanvas issue maybe?
http://cvs.gnome.org/viewcvs/pango/ChangeLog?rev=1.1391.2.6&view=markup Yes, I think it's a gnomecanvas bug too.
The new pango version doesn't fix the issue, that should probably be reassigned to libgnomecanvas, what do you mean by "is drawing Pango layouts at non-pixel-boundaries", should that be something easy to fix by somebody knowing pango?
Ok, I found the fix, but will charge a couple pints of beer, it damn took hours tonight... :-D
Neither Pango, nor gnomecanvas: gdk. This is what happens: Apparently the bug only happens when hinting is off and bug 307196 happens. Next, there's this bug in gdkpango.c: diff -u -p -d -r1.50 gdkpango.c --- gdk/gdkpango.c 20 Feb 2006 17:17:09 -0000 1.50 +++ gdk/gdkpango.c 28 Apr 2006 06:51:23 -0000 @@ -235,12 +235,12 @@ gdk_pango_renderer_draw_glyphs (PangoRen { cairo_save (cr); emboss_context (cr); - cairo_move_to (cr, x / PANGO_SCALE, y / PANGO_SCALE); + cairo_move_to (cr, (double)x / PANGO_SCALE, (double)y / PANGO_SCALE); pango_cairo_show_glyph_string (cr, font, glyphs); cairo_restore (cr); } - cairo_move_to (cr, x / PANGO_SCALE, y / PANGO_SCALE); + cairo_move_to (cr, (double)x / PANGO_SCALE, (double)y / PANGO_SCALE); pango_cairo_show_glyph_string (cr, font, glyphs); } Normally this shouldn't matter, as x and y are whole-pixels. But with that hinting bug hitting, we get x values that are subpixel, so when gnomecanvas is drawing part of the layout such that after offsetting, x becomes negative, the integer division rounds up (towards zero) which shift one. Now I don't know why gnomecanvas does so many extra exposes, but I'll commit the fix to stable and head right now.
Rocking work Behdad, I've patched the Ubuntu package with that for some days and it works just fine! You can collect the couple pints of beer next time we meet ;)