[ENH] Anti-aliasing type support & FreeType 2.0 beta plugin (very beta)

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Mon Mar 6 00:11:39 UTC 2000


This is to announce anti-aliased type enhancements for Squeak. I'm not
releasing it because its is finished, but so that eg. others can start
porting it to their platforms.

General:

1) One change set provides support for using anti-aliased fonts wherever the
usual black-and-white fonts appear now. This includes support for sub-pixel
rendering which yields much better resolution on color LCD screens. This
looks good.

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,
ttf.eosnet.com and www.fontfile.com, that are labelled as freeware. I doubt
that for a couple though.)


Note that the sub-pixel preference is by default turned on, but that
switching it of 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 www.freetype.org)

<Many of the URLs are divided onto two lines--I'm sorry about this, but I
didn't want to put the files in the US where I have acces to shorter URLs,
nor post any files to the list, because of the patent issues.>

http://www.lucs.lu.se/people/Henrik.Gedenryd/Squeak/
type/FreeType license.txt

Why FreeType 2.0?

Much better anti-aliasing quality (128 gray levels instead of 5). Built in
support for both PostScript type 1 and OpenType font formats, plus Mac
'sfnt' truetype files, kerning tables, pS char names and more. (I have not
done anything serious on getting these to work, but PS and sfnt code is
already in the Mac plugin.)

Important limitations:

Some text doesn't display properly in other than 32 bit display depth (for
Squeak, not the OS) because of BitBlt mode limitations. (Won't remedy them
till the new BitBlt is out.)

No support for synthetic variants yet (emboldened, underline etc.), nor for
colored type.

No bg color other than white in paragraphs (but in QuickPrint, eg. menus,
lists.)

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.

http://www.lucs.lu.se/people/Henrik.Gedenryd/Squeak/
type/Antialiased fonts.05Mar1917.cs

the first font file is:

http://www.lucs.lu.se/people/Henrik.Gedenryd/Squeak/
type/SqueakAAfonts/Arial Rounded Bold.font.gz

then replace filename with these in the URL (same folder; sorry, no folder
http access to the server:)

Blue Highway Regular.font.gz
Federation Regular.font.gz
Humanst521 BT Bold.font.gz
Humanst521 BT Roman.font.gz
Monofonto Regular.font.gz
Montana 2001.font.gz
Nova Normal.font.gz
ZapfHumnst BT Bold.font.gz
ZapfHumnst BT Roman.font.gz

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

You will also need my "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. I
will announce this change set separately.

http://www.lucs.lu.se/people/Henrik.Gedenryd/Squeak/
type/FFI fixes.05Mar1843.cs

Then the change set proper:

http://www.lucs.lu.se/people/Henrik.Gedenryd/Squeak/type/FreeType2.05Mar1917
.cs

and the plugin: 

http://www.lucs.lu.se/people/Henrik.Gedenryd/Squeak/
type/FreeType2 PPC beta.sit

Mac only note 1: The Mac FFI plugin that was released by Andreas Raab has
some bad Mojo (it jumps to an invalid address in the VM when passing a
string argument). You will need to use the one I have compiled (I didn't
change any code). I have reported this issue to John Maloney and Andreas
Raab.

http://www.lucs.lu.se/people/Henrik.Gedenryd/Squeak/type/SqueakFFIPrims.sit

Mac only note 2: Mac memory conventions limit how much memory FreeType can
get, since C code allocates from the share of Squeak's alloted memory
outside Squeak's object memory. This share is made quite small by the
current VM, but may easily be increased by recompiling the VM. (Note that
this plugin memory issue ought to be resolved in general.) I have compiled a
special Mac VM with 500k for this, which lasts a good while longer. 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.

http://www.lucs.lu.se/people/Henrik.Gedenryd/Squeak/
type/Squeak VM PPC FTb.sit

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 (cf. the previous note). 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.

[Late update, literally: I don't know why, but the FreeType plugin doesn't
play nice with the 2.8a image available at st.cs.uiuc.edu, although it's
fine with mine that I've updated myself from the updates server. Mine runs
even with the standard Mac 2.7b VM released some time ago. Perhaps it's in
the later change sets--mine is up to 1819. I'll look into this. Until then
change set 1 does work as advertised.]

'Issues':

In principle, there should be no noticeable slow-down from these fonts at
all(!). The support was already there in the BitBlt operations. However
there may be some slowing down on Unix/X or elsewhere where moving bits to
the screen is expensive.
      
Some fonts render worse-looking results than others although they shouldn't
(typically serifed fonts). I think this is an issue in FreeType (2.0?)
itself, in its grid-fitting and antialiasing. Also point a MagnifierMorph at
eg. the glitch on upper-lefthand corners of rounded characters (can there be
such a thing?) like O, q, c, and so on.

Other minor things to do:

Autoinstall Squeak's arrows in AAFonts.

Micro-adjust outlines' position & scale for best rendering.

Remove badChars from glyphs Form to reduce memory use.

FFI: Still the nil field name problem with ExternalStructureInspector.



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.

Enjoy, and don't find too many bugs please--I'm falling behind elsewhere!
There should at least not be 63.000 of them.

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

Henrik

< = > .






More information about the Squeak-dev mailing list