Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
High-quality font support
Last updated at 5:27 pm UTC on 4 September 2009
External Image
High-quality font support page with illustration and description of sub-pixel rendering

General

Support for anti-aliasing and sub-pixel-rendered fonts in Squeak (updated for version 3.0/3.1), as well as a version of the open source FreeType font rendering library made as a plugin for Squeak (only for 2.7 yet).

For Squeak 3.0

This now works on 16 & 32 bit screen depth, plus works in emergency evaluator & other oddball MVC uses that show up in Morphic. Should also work properly in MVC; this has not been tested.

I therefore consider it fully functional for general use (i.e. no longer 'experimental'), except that it doesn't support drawing the font in color, or as bold/italic/underlined. (Both are a problem with diff views!)

The special BitBlt mode used for SPR font rendering is now in the image, and thus also in most 3.0 VMs. If yours doesn't work you can compile an external BitBlt plugin with this. See note 3 below.

I'd like to hear about successful use on non-Mac platforms.

This code should work in 2.8-2.9 with minimal changes.

Files are in here. File in in this order: ServiceRegistry, part 1, part 2. Then file in uncompressed .fonts from a FileList.

Henrik

Note: Generating fonts using FreeType is handled by an entirely separate package, not yet updated for 2.8 and later. The present set is sufficient for using such fonts however.

First experimental version for 2.7

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/)

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 2.7 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:






Henrik Gedenryd

Henrik's work has been continued, and updated, please see here - FreeType Plus