Bug 300469 - Inconsistent font spacing in window title and window menu
Summary: Inconsistent font spacing in window title and window menu
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: http://www.youtube.com/watch?v=BuathU...
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-22 19:50 UTC by S. Christian Collins
Modified: 2012-05-23 19:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description S. Christian Collins 2012-05-22 19:50:46 UTC
After upgrading from Kubuntu 11.10 to 12.04, I noticed that the font spacing of the titlebar text seemed a little bit off (the spacing between letters looks inconsistent).  Also, when first clicking on the menu icon of a window, the font spacing looks okay, but as the mouse travels over the menu items, some of the letters jump to the left or right.  This can be observed in the following video: http://www.youtube.com/watch?v=BuathUVpdNk

In the video, when the mouse moves over the words "To Desktop", you can see the "D" move to the left and the "k" move to the right.  Also, when the mouse hovers over "All Desktops" from the submenu, the numbers to the left of "Desktop 1", "Desktop 2", etc. all move slightly to the right and become misaligned with their underline markings.  There are other letters that move around besides what I have mentioned.  This shifting of the letters only happens the first time this menu is opened.  Afterward, the letters will remain in their shifted positions until you log out and back in again.

Reproducible: Always

Steps to Reproduce:
Note, if these reproduction steps don't work for you, try using a Kubuntu 12.04 LiveCD, which can reproduce the bug on all three systems I've tried.
1. From a fresh login, Open Dolphin.
2. Click on the application menu (top-left icon on the title bar) and drag the mouse over the different options (as seen in the video).
Actual Results:  
The font spacing shifts and some letters are too close together.

Expected Results:  
The font spacing should remain the same and should be properly spaced.

I can reproduce this bug on all three systems I have tested, one with an NVIDIA 7600 GT (using both NVIDIA and Nouveau drivers), one with Intel i915 and one with AMD graphics.  I did not notice this bug running Kubuntu 10.11 with KDE 4.8.2, but the bug does happen in Kubuntu 12.04 with KDE 4.8.2 (and also 4.8.3).  Perhaps this is a Qt bug?
Comment 1 S. Christian Collins 2012-05-22 20:01:55 UTC
I should add that I can reproduce the bug using hinting settings of "none" and "slight", with or without RGB subpixel rendering.  The bug does not seem to appear with hinting settings of "medium" (I didn't try "full").
Comment 2 Thomas Lübking 2012-05-22 20:06:09 UTC
There are 2 possible sources:
- Do you use the XRender backend?
- What's the situation after running "kwin --replace &"
Comment 3 S. Christian Collins 2012-05-22 20:20:19 UTC
This happens with OpenGL, Xrender and even no compositing at all.  Running "kwin --replace &" is similar to logging out and in again... I can reproduce the bug again after running the command.
Comment 4 Thomas Lübking 2012-05-22 20:31:28 UTC
Try
kwin --replace --graphicssystem raster &
-> check for the issue

kwin --replace --graphicssystem native &
-> check for the issue

(since it happens w/o compositing it's for sure not caused but only triggered by kwin - and rast ./. native font redering - depending on the hinting - in Qt was an issue as well)
Comment 5 S. Christian Collins 2012-05-22 20:55:53 UTC
The bug disappears when Kwin uses the raster graphics system.  If I switch back to native, the bug reappears.
Comment 6 S. Christian Collins 2012-05-22 21:16:15 UTC
The workaround for me is to switch Kwin to use the raster graphics system.  To make this setting permanent, I did the following:
Create the following script as /usr/local/bin/kwin-raster and make it executable:
[code]#!/bin/bash
kwin --graphicssystem=raster[/code]
Then, add the following to /etc/profile:
[code]export KDEWM="kwin-raster"[/code]
Comment 7 S. Christian Collins 2012-05-22 21:17:17 UTC
Let's try this again...
------------------------
The workaround for me is to switch Kwin to use the raster graphics system.  To make this setting permanent, I did the following:
Create the following script as /usr/local/bin/kwin-raster and make it executable:

#!/bin/bash
kwin --graphicssystem=raster

Then, add the following to /etc/profile:

export KDEWM="kwin-raster"
Comment 8 Thomas Lübking 2012-05-22 21:39:22 UTC
For everybody not using ubuntu but kwin >= 4.8
kwriteconfig --file kwinrc --group Compositing --key GraphicsSystem raster

NOTICE that you should NOT use this setting with the XRender backend as it will lead to suboptimal performance.

The bug itself is either in Qt or fontconfig
Comment 9 Christoph Feck 2012-05-23 19:45:14 UTC
Not really a bug. Qt 4.8 now defaults to subpixel layouting (i.e. characters can have a fractional horizontal pixel advance), a much requested feature. The X native rendering calls do not support it, so the letters look "randomly" spaced to compensate for the fractional advances when not using "raster" graphics engine. Applications can request integer metrics from Qt, we had to do that e.g. in Konsole.