a question about fonts

Duane Maxwell dmaxwell at launchpados.com
Fri Apr 23 00:40:36 UTC 1999


Interesting that you mention this - I actually took a pass at font stuff a
couple of weeks ago with the interesting goal of producing cheap
antialiased text throughout Squeak. Scan conversion of TrueType fonts at
low point sizes looks awful if the renderer doesn't support hinting, as
Squeak currently does it, and high quality PD bitmap fonts are rare.
Besides, everyone else seems to have anitaliased fonts, so it seems only
right that Squeak should too.

I looked into adding support to StrikeFont for font depths of > 1 bit.  The
purpose would be have an 8-bit gray 'glyphs' Form and treat it as an alpha
channel for blending the foreground color into the background.  This would
appear to require some screwing around with BitBlt since it seems this type
of copy mode is not currently supported.  Not my best area - perhaps
someone can look into this and see if I missed something obvious.

After that, creating the glyph Form on the fly from an arbitrary TrueType
font isn't too much of a chore.

This is basically an attempt to use StrikeFonts as an rendered TrueType
cache.  You could render small point sizes in their entirety, but only
convert single characters on demand at larger sizes, and throw them away
when done. There are plenty of PD TrueType fonts, so it is at that point
pretty easy to meet Dan's unencumbered font goal.  MS's font really ought
to be excised to keep Squeak legally clean.

Unfortunately I got distracted in another direction (the problem with a
short attention span) and left this exercise for another time.

The BitFont format refers to an external Mac utility which converts
TrueType to bitmap fonts using the OS-supported hinting, so the results
look nice.

>Hi Folks.
>
>[the buglet is at the end...]
>
>I've been snorkeling around in the Squeak fonts code, trying to make sense
>of it; I thought I might take a crack at building a simple font selection
>dialog.  I gather that there are two basic types of fonts supported by
>Squeak, but I'm not really sure how they relate to each other.  I think that
>most everything uses the StrikeFonts, which apparently are cached in a class
>variable.  The comments on the class side explain how to read them in from a
>file that is already in StrikeFont format.
>
>[I don't really know anything about fonts, but I figure "it's just a file
>format and conversion problem", so I proceeded blissfully onward]
>
>OK.  So I tried to figure out how to get a font into StrikeFont format.  I'm
>still looking.  The FontSet class methods have some tantalizing references
>to a BitFont class, which is not in my image, and there is some code that
>can apparently read this kind of font.  This was a dead end for me.
>
>So I looked at what the file list viewer does when it displays the contents
>of True Type fonts; this is really cool & I have a bunch of these on my
>machine.  Apparently, the viewer loads up a TTSampleFontMorph, which knows
>how to display itself nicely in a world.  However, these TTSampleFontMorph
>objects don't seem to have any conversion routines (i.e. self asStrikeFont).
>I concluded that True Type support is in the "hey isn't that cool" stage.
>It looks like somebody went to great lengths to make the viewer work, but
>stopped there (maybe I'm mistaken?).
>
>So, I'm kind of at an impasse.  I searched the Squeak mail archive for
>"font" and was inundated with messages (more than I was comfortable reading
>today).  I did notice that Dan Ingalls mentioned something about a "font
>quest" (his note: http://macos.tuwien.ac.at:9009/885641068.asHtml) but there
>were no replies.  That was well before my time with Squeak.  Can anybody
>give me a quick synopsis of where that effort is at?
>
>Well, I'd love to continue working on this, but I guess I'm asking for some
>tips at this point.  Has somebody already written a font selection dialog?
>Can anybody direct me to an explanation about how Squeak fonts work?
>Anybody know about any (free) docs on the web that describe font formats,
>etc.?
>
>Thanks!
>
>---==> Chris

===================================================
Duane Maxwell         dmaxwell (at) launchpados.com
CTO                      http://www.launchpados.com
Launchpad, Inc.                 (619) 578-8500 x226

Information contained herein is my personal opinion
    and not necessarily that of Launchpad, Inc.
===================================================





More information about the Squeak-dev mailing list