Bug 29430 - [Qt] QWebView font size formatting through CSS does not match Qt's native font sizes
Summary: [Qt] QWebView font size formatting through CSS does not match Qt's native fon...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P3 Normal
Assignee: Nobody
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2009-09-18 07:45 PDT by Tor Arne Vestbø
Modified: 2012-07-11 14:59 PDT (History)
4 users (show)

See Also:


Attachments
Testcase (819 bytes, text/x-c++src)
2010-03-17 08:29 PDT, Kent Hansen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Arne Vestbø 2009-09-18 07:45:00 PDT
This bug report originated from issue QTBUG-3326
<http://bugreports.qt.nokia.com/browse/QTBUG-3326>

--- Description ---

If the text in the HTML of a QWebView is formatted using a cascading style sheet to change the size, then the size of the text differs from what you get when using the same values to contruct a QFont and use this to render text in another Qt widget such as a QTextEdit.
Comment 1 Diego Gonzalez 2010-03-16 12:37:24 PDT
Is this a specific Mac OS bug?
Comment 2 Tor Arne Vestbø 2010-03-17 08:28:54 PDT
Confirmed in trunk. AFAIK webkit assumes 96dpi, could this be the issue?
Comment 3 Kent Hansen 2010-03-17 08:29:57 PDT
Created attachment 50909 [details]
Testcase

I'm bored, so I made this testcase.
Comment 4 Kent Hansen 2010-03-17 08:32:16 PDT
It's not Mac-specific, I see it on Linux.
Comment 5 kasthuri 2011-01-11 11:01:09 PST
The problem seems to be with the test case.  QFont constructor assumes font size to be in terms of number of points.  But the CSS part in the test case is setting the font-size in terms of number of pixels.  That's why we are seeing the difference in displayed text size.

So if we set the CSS font-size to be "40pt" or set the QFont size in terms of pixels explicitly,

QFont fnt("Arial");
fnt.setPixelSize(40);

then the displayed texts have the same size.
Comment 6 Noam Rosenthal 2012-07-11 14:59:49 PDT
Closing this 2-year-old bug, the problem is with the test case.