Bug 93263

Summary: [Qt] Monospace font does not render in proper sizes
Product: WebKit Reporter: mdesign <m.karoly>
Component: TextAssignee: Allan Sandfeld Jensen <allan.jensen>
Status: RESOLVED FIXED    
Severity: Normal CC: allan.jensen, ap, mitz, noam, pierre.rossi, trevor, webkit.org, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 36532    
Attachments:
Description Flags
Test html file
none
Firefox 14 - renders right
none
qtwebkit fails
none
WebKit-r124698 fails
none
Patch
none
Patch jturcotte: review+

mdesign
Reported 2012-08-06 06:15:05 PDT
Created attachment 156674 [details] Test html file Dear Devs! Monospace font does not render in proper sizes: Overview: I can't set a monospace font (eg: Courier) to 10CPI size. Theoretically Courier 12pt = 10CPI. Steps to Reproduce: Open the attachment in webkit Actual Results: Notice that the text does not fill the grey box Expected Results: Open the text html in Firefox 14, the block with 12pt Courier font exactly fills the box. Open a microsoft word or libreoffice writer, create a text with 12pt Courier font, it prints exactly the same size, like firefox. Build Date & Platform: Linux 2.6.32-21-generic-pae #32-Ubuntu SMP Fri Apr 16 09:39:35 UTC 2010 i686 GNU/Linux Additional Builds and Platforms: Linux 3.2.0-27-generic-pae #43-Ubuntu SMP Fri Jul 6 15:06:05 UTC 2012 i686 i686 i386 GNU/Linux Windows 7 (WebKit.exe#WebKit-r124698)
Attachments
Test html file (6.45 KB, text/html)
2012-08-06 06:15 PDT, mdesign
no flags
Firefox 14 - renders right (29.26 KB, image/png)
2012-08-06 06:15 PDT, mdesign
no flags
qtwebkit fails (40.89 KB, image/png)
2012-08-06 06:16 PDT, mdesign
no flags
WebKit-r124698 fails (211.75 KB, image/jpeg)
2012-08-06 06:18 PDT, mdesign
no flags
Patch (1.88 KB, patch)
2013-03-19 02:18 PDT, Allan Sandfeld Jensen
no flags
Patch (2.00 KB, patch)
2013-03-19 06:52 PDT, Allan Sandfeld Jensen
jturcotte: review+
mdesign
Comment 1 2012-08-06 06:15:56 PDT
Created attachment 156675 [details] Firefox 14 - renders right
mdesign
Comment 2 2012-08-06 06:16:17 PDT
Created attachment 156676 [details] qtwebkit fails
mdesign
Comment 3 2012-08-06 06:18:07 PDT
Created attachment 156678 [details] WebKit-r124698 fails
mdesign
Comment 4 2012-08-07 02:48:37 PDT
If anyone can help, where can i start hacking the code, don't hesitate, please share with me!:)
mdesign
Comment 5 2012-08-20 22:20:33 PDT
Does anyone know what libs responsible for the font rendering in webkit on different operating systems? The proper rendering in Firefox 14 and Internet Explorer 9 is done via new DirectWrite API. Before using DirectWrite the monospace rendering failed same way like webkit. There is a list about different browsers and rendering engines in this article: http://www.smashingmagazine.com/2012/04/24/a-closer-look-at-font-rendering/ I tested every browser on windows. Just the browsers with DirectWrite engine renders properly.
Allan Sandfeld Jensen
Comment 6 2012-12-05 05:43:04 PST
Interesting. Have you tried compiling WebKit yourself? If you do, you can try to activate SUBPIXEL_LAYOUT and see if that helps. It looks like sizes are rounded poorly.
mdesign
Comment 7 2012-12-05 05:52:14 PST
Im using webkit in Qt. I found a workaround: Commenting out this row in this file makes the monospace fonts render correctly: /src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp font.setStyleStrategy(QFont::ForceIntegerMetrics);
Trevor North
Comment 8 2013-01-28 09:25:49 PST
In my testing the workaround suggested in comment #7 also results in a general improvement in font kerning which was previously often very poor.
Stefan Neufeind
Comment 9 2013-02-09 13:23:37 PST
mdesign
Comment 10 2013-02-12 07:23:44 PST
Dear Allan Sandfeld Jensen! I using Qt, so i suggested a workaround for it. But the issue exists in webkit too (as you can see it in the screenshots) Best regards, Károly Marton
Allan Sandfeld Jensen
Comment 11 2013-03-13 03:11:19 PDT
I think there a two ways about this. One, we need to establish if the bug #36532 still applies on Mac. Can we remove ForceIntegerMetrics. Second, maybe ForceIntegerMetrics is being too aggressive, and should only force basic metrics to integers but not advances. I can confirm that removing the forced rounding on advances also solves this bug.
Allan Sandfeld Jensen
Comment 12 2013-03-19 02:18:31 PDT
Jocelyn Turcotte
Comment 13 2013-03-19 06:15:50 PDT
Comment on attachment 193767 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=193767&action=review Pierre, any opinion? > Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp:74 > +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) Please add a comment in the code explaining why the version guard is used.
Allan Sandfeld Jensen
Comment 14 2013-03-19 06:52:48 PDT
Pierre Rossi
Comment 15 2013-03-19 07:12:16 PDT
Comment on attachment 193814 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=193814&action=review LGTM. That seems like the sensible approach (not affecting < 5.1 behaviour I mean) > Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp:75 > + // Kept enabled for Qt<5.1 to maintain stable baselines for 5.0. coding style: Qt < 5.1. Ah wait no, I'm told it doesn't matter for comments ;) > Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp:76 > + // FIXME: Remove when we depend on Qt 5.1. not sure if that was strictly necessary... But it'll go away with the whole ifdef chunk soon enough :)
Allan Sandfeld Jensen
Comment 16 2013-03-19 07:31:00 PDT
Allan Sandfeld Jensen
Comment 17 2013-04-03 05:34:04 PDT
Note You need to log in before you can comment on or make changes to this bug.