Better Postscript CFF font rendering with DirectWrite

October 22nd, 2009 by John Daggett

For those playing with Windows 7, check out some of the work Bas Schouten has been doing with adding DirectWrite support to Firefox. DirectWrite is Microsoft’s replacement for Uniscribe in Windows 7 and it has much better rendering of Postscript CFF fonts, fonts that are typically labeled “OpenType” with an .otf extension. Many well-known font vendors ship these fonts almost exclusively.

Here’s a waterfall test that uses Jos Buivenga’s Calluna font, a beautiful serif text font that can be used as a downloadable font. In the lower part of the page is the same waterfall with Constantia, one of Microsoft’s ClearType fonts that ships with Vista and Windows 7. Below is a comparison of the default rendering now under XP and Windows 7 and the rendering with the patch Bas is working on:

Text Waterfall comparing GDI to DirectWrite rendering

At very low sizes (e.g. 6px – 9px), the text drawn with the DirectWrite API is much more readable. The reason for this is clearer if you zoom in closely and look at the pixels.

Small text (6px – 8px) drawn with Windows 7 GDI ClearType rendering:

Small text drawn with Windows 7 GDI ClearType

The same text drawn with DirectWrite:

Small text drawn with Windows 7 DirectWrite

Up close neither looks great but slide your chair back a few feet; the text rendered with GDI looks awful and is barely readable, the text rendered with DirectWrite legible. The default GDI rendering doesn’t do subpixel antialiasing so the glyphs appear less defined, they look thinner.

Great stuff!! Hats off to Bas!

Note: platform API’s on Mac OS X and Linux already do a good job rendering Postscript CFF fonts, this just brings them up to parity under Windows 7.

16 Responses to “Better Postscript CFF font rendering with DirectWrite”

  1. Alexander Limi (limi) 's status on Thursday, 22-Oct-09 08:57:43 UTC - Identi.ca Says:

    [...] http://blog.mozilla.org/nattokirai/2009/10/22/better-postscript-cff-font-rendering-with-directwrite… a few seconds ago from web [...]

  2. Olly Hodgson Says:

    This is fantastic news! I was ranting just yesterday about Firefox’s rendering of CFF fonts under Windows, so it’s great to see something being done about it :)

    Now for the big challenge. Is there anything that can be done to enable sub-pixel rendering of CFF fonts under XP and Vista? (see bug #503150)

  3. Seamus Says:

    For anyone looking at the waterfall and not seeing the type get smaller than 10px, you need to change the “Minimum font size” to “none” in the preferences ( “Preferences” > “Content” tab > “Advanced…” for “Fonts & Colors” ).

  4. Siddharth Agarwal Says:

    As a side note, DirectWrite (along with the rest of the new Direct* APIs) will be made available to Vista users too.

  5. Alex Says:

    Great to see support for DirectWrite this close to the release, sub-pixel positioning and rendering is great (for TrueType and PostScript fonts), and it removes the jitter in animation (translation and rotation and such)

    @Olly, short of ignoring GDI and using Freetype, nothing can be done, XP is too old to be getting updates like DirectWrite.

  6. Sex, lies, & type | i love typography, the typography and fonts blog Says:

    [...] Better Postscript CFF font rendering with DirectWrite. [...]

  7. Olly Hodgson Says:

    @Alex – Even if this won’t help XP users, it’s good to know Vista and W7 users will finally get better typography :)

    Any idea if this will make it into 3.6?

  8. Sex, lies, & type | i love typography, the typography and fonts blog Says:

    [...] support for WOFF. Boing Boing Redesign Uncovers Web Font IgnoranceWhere to get Web fontsBetter Postscript CFF font rendering with DirectWrite.Typotheque has now released its Web fonts. Comes with a 30-day free evaluation, so why not give it a [...]

  9. miha Says:

    Yeeeeaaah!

    Was waiting for this.

  10. Luc(as) Says:

    The article mentions: “Small text drawn with Windows 7 GDI ClearType rendering:” Obviously that is not ClearType rendering, there are no subpixel colors, ClearType only works with TrueType fonts, it looks like the sample is drawn with the good old Adobe rasteriser. DirectWrite seems to apply ClearType like subpixel precision on CFF fonts, or is it finally a newer version of the Adobe rasteriser? I wonder if it would look even better if the PS font was properly hinted.

  11. treckle Says:

    Sorry to nitpick, but the zoomed in GDI text looks like grayscale, not ClearType. However, the point is well taken – DWrite looks much better. I just wanted to make sure the comparison is fair.

  12. jdaggett Says:

    @Lucas @treckle Right, the rendering shows GDI rendering with ClearType enabled. As you both point out, it’s not actually using subpixel anti-aliasing when rendering the CFF fonts since ClearType only supports subpixel anti-aliasing of TrueType fonts. DWrite appears to do nicer job with both TrueType and CFF fonts.

  13. Firefox hopes to one-up IE with fast graphics « Interesting finds Says:

    [...] on Windows. The DirectWrite technology helps that operating system catch up to its rivals, said Mozilla’s John Daggett in a blog post Sunday. “Platform APIs [application programming interfaces] on Mac OS X and Linux already do [...]

  14. Browser Choice vs Font Rendering | Phinney on Fonts Says:

    [...] and noting because it has already been announced that Internet Explorer 9 will use DirectWrite, and apparently FireFox is working on it as well. added to Font rendering, Making fonts work, Type Design, Web fonts by Thomas Phinney [ [...]

  15. Thomas Phinney Says:

    Lucas: Actually, under both WPF and DirectWrite, ClearType is enabled with OpenType CFF fonts, not just TrueType fonts. Adobe worked very closely with Microsoft to make that happen, and yes it’s a newer version of the Adobe rasterizer involved in that as well.

    I would expect that the DirectWrite rasterizer would enable sub-pixel positioning for CFF outlines (that is, the initial position of each glyph can vary at a subpixel level), but I don’t think I know for certain that it does or can.

  16. travesti Says:

    he article mentions: “Small text drawn with Windows 7 GDI ClearType rendering:” Obviously that is not ClearType rendering, there are no subpixel colors, ClearType only works with TrueType fonts, it looks like the sample is drawn with the good old Adobe rasteriser. DirectWrite seems to apply ClearType like subpixel precision on CFF fonts, or is it finally a newer version of the Adobe rasteriser? I wonder if it would look even better if the PS font was properly hinted.tt