Bug 225040

Summary: The underline of links with special text is longer than it should (line width calculation does not consider font kerning ?)
Product: [Applications] konqueror Reporter: Dario Andres <andresbajotierra>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: CONFIRMED ---    
Severity: normal CC: aiacovitti, bugs, laidig
Priority: NOR    
Version: 4.8.95 (RC1)   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Testcase
Screenshot of the 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 2.6.32.3

Testcase HTML:

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

Bug:
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]
Testcase
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)