GDI Text on Windows
Posted by Dave Hyatt on Tuesday, March 25th, 2008 at 10:47 amThe version of WebKit that ships with Safari 3.1 on Windows uses CoreGraphics antialiasing for text. The latest WebKit in nightly builds has made good progress on a GDI text rendering mode (i.e., the text rendering matches your OS look/settings). We encourage Windows testers to try out GDI text rendering and file bugs that you find at http://bugs.webkit.org/.
To enable GDI text rendering, you will need to hand edit your preferences file, as there is no visible UI option in Safari 3.1 for this. You will need to set WebKit’s “WebKitFontSmoothingType” preference to a value of “4″.
The preferences file on Windows XP is:
C:\Documents and Settings\<username>\Application Data\Apple Computer\Safari\WebKitPreferences.plist
On Vista, it is:
C:\Users\<username>\AppData\Roaming\Apple Computer\Safari\WebKitPreferences.plist
The values that are listed in Safari’s UI for this preference map to the numbers 0-3.
Note that while you can turn on GDI text rendering in the WebKit that ships with Safari 3.1, most advanced text features will not work. These include stroking and filling text, most advanced text features in SVG, shadows, partially transparent text (rgba/hsla) and text inside a transparency layer (opacity). All of these features should work now in the latest nightlies.
If you have changed the setting in Safari you may have to edit that preference file. It can be found at:
%APPDATA%\Apple Computer\Safari\Preferences\com.apple.Safari.plist
March 25th, 2008 at 12:46 pm
tadunne :
Windows users deserve awful presentation, you’re right
More seriously, apple have to preserve a certain branding.
Imagine if winamp took a windows look, how crappy it would have been.
March 25th, 2008 at 12:46 pm
I set the value to 4, but as soon as I opened Safari up, the integer was reverted back to 3. I’d love to be able to see this different rendering mode… any trick to this trick?
March 25th, 2008 at 12:57 pm
You need in com.apple.Safari.plist also change value FontSmoothing to 4, otherwise WebKitFontSmoothingType is reverted to previous value. And now it works.
March 25th, 2008 at 1:03 pm
And it reacts on change in Windows Font smoothing setting. Just change font smoothing in your Windows and Reload page in Safari.
March 25th, 2008 at 1:06 pm
thanks met. i looked through the .com.apple.Safari.plist and didn’t see it the first few times i checked. 4th times a charm i suppose.
March 25th, 2008 at 1:21 pm
Sadly, in the latest available for download Webkit nightly r31238 for Windows, the described changes are absent!
You should wait for the newer Webkit nightly for Windows.
March 25th, 2008 at 1:28 pm
Robert: This IS in latest r31238 build. Just switch it on and read comments above.
March 25th, 2008 at 2:17 pm
met, the GDI changes landed in this changeset: http://trac.webkit.org/projects/webkit/changeset/31246 so the Webkit nightly with the changes should have at least version r31246
March 25th, 2008 at 2:48 pm
Robert: OK thanks. This is probably reason why smoothing in last nightly worked incorrectly on same pages for me.
March 25th, 2008 at 5:53 pm
GDI Text Rendering For Safari On Windows…
Looks like Apple will be switching Safari to use GDI for font rendering on Windows in the future. Not such a bad thing. The CoreGraphics antialiasing looks good on a Mac, but does look strange on Windows. I think this will please more Windows users …
March 25th, 2008 at 9:43 pm
GDI rendering has been in WebKit for a while, But it had problems with opacity I think (which that changeset fixes)
I still prefer the mac rendering though, fonts look better (round bits are still round)
March 26th, 2008 at 1:44 am
The GDI rendering does not seem to work on Apple.com and webkit.org it looks like it’s using the std rendering. Other sites appear to use GDI. Is there a page level override?
March 26th, 2008 at 3:03 am
http://trac.webkit.org/projects/webkit/changeset/28867
That’s where it was originally added (and has comments about the issues that have been fixed in this change set)
in http://trac.webkit.org/projects/webkit/changeset/28867#file9 on line 255 (old) 261 (new) states that Lucida Grande is hard coded to use normal rendering (due to it’s weights)
March 26th, 2008 at 9:03 am
What we’ll probably end up doing is pretending like Lucida Grande does not exist when GDI is on, since it looks so bad with GDI rendering.
March 26th, 2008 at 11:46 am
I enabled this on 3.1. After surfing to a few sites, I honestly didn’t notice a difference.
March 27th, 2008 at 4:29 am
With last night’s WebKit, I didn’t have a WebKitPreferences.plist file. So instead, I modified the com.apple.Safari.plist file – but WebKit kept reverting it back to 3 whenever I entered 4.
So I copied Safari’s prefs to WebKitPreferences.plist and tried again with 4. This time, WebKit didn’t try to modify the setting, but the font rendering was still the same old heavily emboldened type that Safari uses.
WinXP.
March 27th, 2008 at 4:35 am
Using met’s tip of also setting FontSmoothing to 4, and tadunne’s tip of visiting a site other than apple.com works. Yea!
March 27th, 2008 at 6:50 am
I am not seeing an option for FontSmoothing. Where is it in the file?
March 27th, 2008 at 8:21 am
Scott: The change is not available in the 3.1, it is only available in the latest nightly. Read the first paragraph in the blog entry.
March 27th, 2008 at 1:07 pm
This is awesome news! Thanks WebKit team– you ROCK!
March 28th, 2008 at 10:10 am
@ajmas: I guess I was confused by the statement later on:
March 29th, 2008 at 12:06 pm
I hope this never becomes the default. I hate that when I specify something to be bold on the page that it never really looks all that much bolder in other Windows browsers, and that the different fonts lose their distinctive design qualities. Just having it as an option in the preferences to placate the crybabies is good enough.
Are you working to eventually support the advanced text features in GDI? Or have CoreGraphics support a GDI option?