=== Top of the Swiki === Attachments ===

High-quality font support


Anti-aliased fonts sample desktop page with illustration and description of sub-pixel rendering

General


There is now support for anti-aliasing and sub-pixel-rendered fonts in Squeak, as well as a version of the open source FreeType font rendering library made as a plugin for Squeak. (As of 7 March 2000 this is all work in progress.)

1) One change set provides support for using anti-aliased (aa) fonts wherever the usual black-and-white fonts appear now. This includes support for sub-pixel rendering (SPR) which yields much better resolution on color LCD screens. This looks good. (See this page for a good explanation of how SPR works.)

To go with this I also provide some filed-out ready-made aa fonts (in .font files) that can be imported via the yellow button menu in a file browser. (All these are generated from good-quality fonts from the Internet, http://ttf.eosnet.com/ and http://www.fontfile.com/, that are labelled as freeware.)

Note that the sub-pixel preference is by default turned on, but that switching it off reduces memory use by half for fonts that you create. See the Preferences panel, Morphic category. (SPR is of no use on non-LCD monitors, but does no harm either, it just works like ordinary anti-aliasing. You may also 'manually' reduce the Forms of the provided fonts to 8 bits if you don't want SPR.)

2) The second change set is support for the FreeType truetype rendering library, version 2.0 beta. Along with this I supply a compiled beta FreeType plugin for Squeak/Mac PPC. You can use this combo to render your own truetype .ttf fonts in Squeak, which was how I produced the above font files. Other platforms should just be able to compile FT 2.0 as a plugin for their own system and use that. (Announce to the list if you will be doing this, so as not to duplicate effort.)

Here, note that part 1 can be used entirely without part 2, and thus without any patent concerns as far as I understand (others will surely be able to give better answers to the legal issues). I have taken some care to separate these two parts as a 'just in case'.

NB: 1) FreeType 2.0 is still an unfinished, incomplete beta version. 2) Beware that copyright issues apply to the FreeType library in eg. in the USA and Japan, but probably not in Europe. (see http://www.freetype.org/)

Download


All the files are available here. As the specific names will vary with the version numbers, there are no explicit links here, but just use the given link to list the directory contents and find what you are looking for.

Why FreeType 2.0?



Important limitations in the current versions of these files:





How to install:


Part 1 is simple: just file in the change set, then the fonts via the file browser. Older versions of Squeak, definitely 2.7, should be ok here. Use the system/appearance/system fonts menu, or cmd-shift-K and k in text panes.

This change set is found here, under the name "Antialiased fonts" plus the version date.

The .font files are in this directory.

Part 2, the FreeType part, is a bit more complex. Firstly it requires the new FFI support, which means a post-2.7 image and possibly a new VM (on the Mac at least) with the necessary updates, plus an FFI plugin (Mac version).

You will also need the "FFI fixes" change set (file it in before the FreeType change set). This contains some important stuff that anyone working with FFI will need: it fixes some serious bugs with FFI (given my level of plugin expertise I was obviously the first to try it out, since I could find & fix them), plus an (unfinished) Inspector that allows you to inspect external C structures (almost) like any Smalltalk object, incl. modifying values.

Then you will need the change set proper, named "FreeType 2.0"

and the plugin, "FreeType2 PPC beta.sit" (Mac version)

Important: The current version cannot properly release the memory for a FreeType font (at least on the Mac). Thus the Squeak side currently doesn't release loaded fonts, which prevents crashing, but thus limits how many fonts can be read during one Squeak session. Running out of memory may yield strange errors from FreeType, like 'Bad file format specified', or fonts with blank characters. Just save & restart Squeak and go again and everything is forgiven. This is not such a dramatic setback, really, since you only need to load the font via FreeType once, then you can save the image or export the result.

'Issues':




Other minor things to do:






Feel free to take on anything, like these tasks or the above color/bold etc. issues, plus porting of course, PS support, etc, etc! Ideas about the memory bug also appreciated greatly.

The problem is, now you will probably like me want to improve all the other aspects of fonts that haven't been very important before.

Remember that Squeak is the only environment whatsoever (to my knowledge) that can renders type this nicely (ie. sub-pixel). MS announced it in the last century. We're still waiting. But thanks to Andreas, Windows has it too, now!

Henrik Gedenryd