Surfin' Safari

GDI Text on Windows

Posted by Dave Hyatt on Tuesday, March 25th, 2008 at 10:47 am

The 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

22 Responses to “GDI Text on Windows”

  1. tibastral Says:

    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.

  2. GUESShimself Says:

    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?

  3. met Says:

    You need in com.apple.Safari.plist also change value FontSmoothing to 4, otherwise WebKitFontSmoothingType is reverted to previous value. And now it works.

  4. met Says:

    And it reacts on change in Windows Font smoothing setting. Just change font smoothing in your Windows and Reload page in Safari.

  5. GUESShimself Says:

    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.

  6. Robert Blaut Says:

    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.

  7. met Says:

    Robert: This IS in latest r31238 build. Just switch it on and read comments above.

  8. Robert Blaut Says:

    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

  9. met Says:

    Robert: OK thanks. This is probably reason why smoothing in last nightly worked incorrectly on same pages for me.

  10. Trackback from Robert Accettura's Fun With Wordage:

    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 …

  11. The_Decryptor Says:

    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)

  12. tadunne Says:

    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?

  13. The_Decryptor Says:

    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)

  14. Dave Hyatt Says:

    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.

  15. Scott Johnson Says:

    I enabled this on 3.1. After surfing to a few sites, I honestly didn’t notice a difference.

  16. RichB Says:

    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.

  17. RichB Says:

    Using met’s tip of also setting FontSmoothing to 4, and tadunne’s tip of visiting a site other than apple.com works. Yea!

  18. Unr3a1 Says:

    I am not seeing an option for FontSmoothing. Where is it in the file?

  19. ajmas Says:

    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.

  20. codinghorror Says:

    This is awesome news! Thanks WebKit team– you ROCK!

  21. Scott Johnson Says:

    @ajmas: I guess I was confused by the statement later on:

    “Note that while you can turn on GDI text rendering in the WebKit that ships with Safari 3.1″

  22. Brad Says:

    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?