Better Postscript CFF font rendering with DirectWrite
October 22nd, 2009 by John DaggettFor 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:
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:
The same text drawn with 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.



October 22nd, 2009 at 5:57 pm
[...] http://blog.mozilla.org/nattokirai/2009/10/22/better-postscript-cff-font-rendering-with-directwrite… a few seconds ago from web [...]
October 22nd, 2009 at 7:20 pm
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)
October 23rd, 2009 at 1:40 am
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” ).
October 23rd, 2009 at 4:56 am
As a side note, DirectWrite (along with the rest of the new Direct* APIs) will be made available to Vista users too.
October 23rd, 2009 at 6:13 pm
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.
October 25th, 2009 at 5:25 am
[...] Better Postscript CFF font rendering with DirectWrite. [...]
November 5th, 2009 at 7:05 pm
@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?
November 14th, 2009 at 2:22 am
[...] 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 [...]
November 20th, 2009 at 10:01 pm
Yeeeeaaah!
Was waiting for this.
November 21st, 2009 at 8:18 pm
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.
November 24th, 2009 at 3:13 am
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.
November 24th, 2009 at 3:52 am
@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.
November 25th, 2009 at 2:12 am
[...] 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 [...]
December 29th, 2009 at 4:56 pm
[...] 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 [ [...]
January 6th, 2010 at 8:03 am
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.
March 8th, 2010 at 10:26 am
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