Comment 11 for bug 697791

Revision history for this message
Jay Taoko (jaytaoko) wrote :

The way the pixel count is done is not accurate. The original submitter of the bug is counting the pixels starting from the upper part of the tooltip that looks darker and counts down to the upper pixel of the text. The same thing is done below in revert. However, this is not the real extent of the text. We use Pango to render the text and retrieve a texture with Cairo. The background of the tooltip is rendered with cairo and then processed through a filtering algorithm to produce the smooth soft shadow. So the real outline of the texture returned by Pango/Cairo is not visible in the tooltip and counting pixels like it is done above is not accurate.
We place the text texture inside the tooltip is like this: vertically, the text texture is in the center inside the tooltip rectangle. Invariably, there is going to be at most one pixel off depending on the height of the text texture and the height of the tooltip. Theses heights can be even or odd. Added to that, Pango rendering is affected by the hinting and other factors.
The fix that was done for this bug as been reverted as it causes an even more serious problem.
Looking at the tooltip, I don't see an issue with the rendering of the text but the nature of the method we use can cause an offset of 1 pixel. We could improve on that but we need more inputs for an appropriate solution.