ClearType for Squeak/Sub-pixel antialiasing

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Wed Oct 6 15:41:13 UTC 1999


The TrueType font rendering and antialiasing in Squeak is very cool. I
realized it would be quite easy to implement sub-pixel rendering, at least
in a simple form.

If you haven't heard of it, sub-pixel rendering is when you manipulate the
individual R, G and B cells of an LCD screen's pixels to achieve a 3x
increase in horizontal antialiasing resolution, which makes especially text
much sharper. In effect, you use the three cells of each pixel as
independent pixels, and balance their colors so you don't notice that they
are of different colors (like you don't notice that a white pixel is made of
one red, one green, and one blue cell).

Now this only works on LCD screens (more or less), but that's what a
Dynabook is meant to use after all, isn't it?!! Or you could use that
22-inch Apple $4000 monster LCD monitor, for example...

Microsoft is implementing this as ClearType, boasting about it and claiming
to have invented it, although it's an old invention by Apple, Xerox, and
others (hmm, doesn't that sound familiar?).

A good description of how it works and of how to implement it, with good
pictures and a simple demo implementation, is at
http://www.grc.com/ctwhat.htm
(Those three pages are all the information I needed to do my preliminary
implementation, in my spare time. It ended up being only 20-30 lines of
Squeak.)

I attached a small sample GIF as an illustration. In it, the four variants
are, top to bottom:

1. Standard Morphic anti-aliasing
2. Simple sub-pixel version without color balancing (notice color
artifacts).
3. 3-pixel color balancing.
4. 5-pixel color balancing. Should be sharper than #3 but appears not to be;
I don't know why.

Note that the vertical resolution is not improved by this technique.

However, Andreas Raab tells me, "the reason that none of the TrueType
stuff is actually used is that we don't have grid-fitting or hinting in
Squeak which means that despite the efforts of anti-aliasing stuff fonts at
small resolutions are hardly readable (too blurry)". Now sub-pixel
techniques improve this a lot (as the right sample in the image is meant to
show; the effect is even greater with italics).

The lack of grid-fitting is the cause, I believe, of the gray blur that can
be seen in particular inside the lower case 'e', and below the horizontal
bar of the 'A', in the small samples.

Actually, also the SP-rendered images would become even sharper with
improved type rendering, as they use the same anti-aliasing code.

Are these improvements hard to do? I'm not sure, does anyone out there know?
There is eg. a free-source (C) package called FreeType that implements
TrueType rendering with hinting and all. Now I'm just hoping that others
also would like better TrueType support in Squeak, and would like to chip in
w r t hinting etc. and implementing general use of outline type in Squeak.

Note that we have a working cross-platform version of ClearType even before
Microsoft has released any version at all! As for now, this is just an
experimental implementation. It can be made more general, much faster, and
better integrated into Morphic, for example.
I am on my part certainly willing to do the fixes needed to make it general
enough, and to optimize it and produce a C-compiled version for Balloon.

Anyone?

Henrik

< = > .


Attachment converted: Anon:sub-pixel.gif (GIFf/8BIM) (00014B78)





More information about the Squeak-dev mailing list