Curiosity is bliss    Archive    Feed    About    Search

Julien Couvreur's programming blog and more

Sub-Pixel Font Rendering (ClearType)

 

Sub-Pixel Font Rendering is the technical name for the technology used in Windows XP, known as ClearType. If you use Windows XP, I definitely recommend that you turn it on (it's off by default). You'll see the greatest improvement if you use a laptop or other LCD screen, but even CRT screens will look a bit better.

Here is a cool page that explains this technology in details.
What is interesting is how color artifacts are avoided/minimized, by splitting the energy of the sub-pixel amongst its neighbors (see image below).

A Java implementation is available with source code (mirrored here).

What I am not sure about yet is why this resolution improvement trick works best for horizontal text. A Tablet PC developper told me that improvements for this technology is on its way, for LCD screens used in portait mode. But he didn't tell me more about why it doesn't work as well vertically or how it's going to get fixed.

Also, I have seen mentions of how the font needs to be created so that it gets "cleartyped" properly. I think they call this "hints", but I didn't get in the details yet.

Update: a friend of mine explained me a very interesting sub-pixel font rendering approach. It is based on signal theory and filters. I'll dig in some more and blog it soon.

Update: a little tool (ClearTweak) that demonstrates ClearType and tweak your ClearType settings.

______________________________________

Hi,

I came across your blog and I had some comments on a couple of questions you've raised there:

> What I am not sure about yet is why this
> resolution improvement trick works best for
> horizontal text. A Tablet PC developper told
> me that improvements for this technology is on
> its way, for LCD screens used in portait mode.
> But he didn't tell me more about why it doesn't
> work as well vertically or how it's going to
> get fixed.

In an LCD (unlike a CRT), the red green and blue segments of each pixel are placed next to each other. Cleartype uses this fact to its advantage by effectively splitting a pixel into three segments to achieve font smoothing. I guess the reason it works only in landscape mode is that the three color segments are placed next to each other horizontally. Most text effects (like bold and italics) adjust the character glyphs horizontally only, so the anti-alias effect is really effective only in landscape mode. Perhaps the fact that most characters in English (and related languages) have diagonal strokes that are closer to the vertical than the horizontal also has something to do with it.

> Also, I have seen mentions of how the font
> needs to be created so that it gets
> "cleartyped" properly. I think they call
> this "hints", but I didn't get in the
> details yet.

I am no expert here, but font hints are basically special-purpose instructions provided by a font author to enable the rasterizer to render the font correctly at specific sizes. Typically, the rasterizer scales the font glyph to the size requested by the user. However if a very small size is requested, simply scaling the glyph results in artifacts and the text doesn't look very good. Hinted fonts overcome this problem by rendering the font at that size as a special case. In fact, TrueType includes a full-fledged hinting language that the font creator can use.

http://www.microsoft.com/typography/hinting/hinting.htm

By the way, you have some good stuff on your Web site! I would like to try out your Pen stroke recognition stuff sometime, but I need to install the .NET runtime before I can do that.

Cheers!

Kaushik

Posted by: Kaushik at March 29, 2003 10:29 PM

I find your text here very informative. But I have a doubt and I don't know if you could help me. You say that ClearType is not the default, but what about the Standard anti-alias text effect?

Thanks for your answer,

Robson.

Posted by: Robson at October 21, 2004 02:40 PM

Hi Robson,

I'm not sure what's the default configuration comes on XP (I've already switched all my boxes to use ClearType). If I remember correctly, I would say it's the "Standard" smoothing option that was selected.
I just tried the "Standard" smoothing effect setting again (in the same drop-down where ClearType is available), but it doesn't seem to make much difference with no smoothing at all, even when looking at the fonts with the magnifier tool. So I'm not sure that "Standard" is anti-aliasing.

Does that answer your question?

Posted by: Julien at October 22, 2004 03:23 PM
comments powered by Disqus