[another Buglet] & a question about fonts

Norton, Chris chrisn at Kronos.com
Thu Apr 22 23:50:46 UTC 1999


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

PS>  Here's another Buglet (baseline 2.4 w/ updates up to 854, Win NT 4.0 SP
3 platform)

*	In a workspace, type:  StrikeFont example
*	Do it
*	If the file does not exist, you get a popup menu asking for another
name, or cancel (see StandardFileStream class>>readOnlyFileNamed:).  Select
cancel.
*	You will now get tossed into the debugger with a self halt (this
should probably be removed)
*	When you allow the debugger to proceed, you get another walkback,
this time from StrikeFont>> readFromStrike2:.
*	The walkback states:  "Message not understood: binary"

Analysis:  Essentially, the return value from the StandardFileStream is not
checked.  A quick scan of senders of StandardFileStream
class>>readOnlyFileNamed: show 37 in the baseline 2.4 image.  I didn't see
much in the way of validation in these 37 senders.  Clearly this issue is a
bit complicated and should be approached from one perspective or the other
(either bullet proof the return value, or validate in each sender).  I'm not
sure what Squeak Central's usual approach is in situations like this.

Side note:  A quick search for senders of "halt" brought up 64, 63 of which
may be unnecessary.  I'm not sure if anyone is "chartered" to keep an eye on
halts, but it is worth noting as an area of possible fragility.





More information about the Squeak-dev mailing list