Bug 225040 - The underline of links with special text is longer than it should (line width calculation does not consider font kerning ?)
Summary: The underline of links with special text is longer than it should (line width...
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: 4.8.95 (RC1)
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Konqueror Developers
Depends on:
Reported: 2010-01-31 20:49 UTC by Dario Andres
Modified: 2012-11-15 11:08 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:

Testcase (82 bytes, text/html)
2010-01-31 20:51 UTC, Dario Andres
Screenshot of the bug (2.81 KB, image/png)
2010-01-31 20:52 UTC, Dario Andres

Note You need to log in before you can comment on or make changes to this bug.
Description Dario Andres 2010-01-31 20:49:40 UTC
Here using:

Qt: 4.6.1 (kde-qt master commit 5ccbae0c2d9254efe67599137afec763d4fec0f6
        Date:   Tue Jan 19 20:42:24 2010 +0100)
KDE Development Platform: 4.4.61 (KDE 4.4.61 (KDE 4.5 >= 20100127))
kdelibs svn rev. 1082077 / kdebase svn rev. 1082077
on ArchLinux i686 - Kernel

Testcase HTML:

<a href="#">ToToToToToToToToToToToToToToToToToToToToToToToToToToToToToToToToTo</a>

The underline of that link is longer than the text itself. The problem gets bigger if the "To" sequence is bigger.

It could be related to the line width not calculating the font kerning: the "o" are below the "T".
Comment 1 Dario Andres 2010-01-31 20:51:27 UTC
Created attachment 40420 [details]
Comment 2 Dario Andres 2010-01-31 20:52:34 UTC
Created attachment 40421 [details]
Screenshot of the bug
Comment 3 Christoph Feck 2010-02-01 16:43:17 UTC
Not only the underline, but the "hit box" is affected, too.
Comment 4 Graeme Hewson 2012-11-13 17:34:34 UTC
See also bug 307824.
Comment 5 Andrea Iacovitti 2012-11-15 10:47:25 UTC
khtml/rendering/font.cpp:317 (Font::width function)
It seems "fast algorithm" does not always return correct string length (that's the case of the reported testcase).
That's is the sum of the single char with (QFontMetrics::width(QChar)) of the string does't always match the length of the string (QFontMetrics::width(QString,..)).
Comment 6 Andrea Iacovitti 2012-11-15 11:08:37 UTC
... and the reason why "fast algorithm" was introduced is stated in comment at the beginning of Font::width function (major speed regression in qt4 compared to qt3)