Ned,
Have a look at the following two methods: BitBlt>>installStrikeFont:foregroundColor:backgroundColor: BitBlt>>displayString:on:from:to:at:kern: That's where most of the magic happens. You might experiment with the first method for installing an appropriate alpha map and blending rules. I would also recommend to take out the primitive code (from the second method) because I'm uncertain if there are some optimizations down deep which might interfere with your experiments.
Cheers, - Andreas
-----Original Message----- From: Ned Konz [mailto:ned@bike-nomad.com] Sent: Sunday, April 01, 2001 1:12 PM To: squeak@cs.uiuc.edu Cc: recipient list not shown Subject: How can I get FormSetFonts (from TrueType fonts) to display anti-aliased?
I've been trying to get TrueType fonts to display anti-aliased. I've gotten them as far as reading in good-looking Forms.
I've gotten the TrueType fonts to read in well using the attached change set.
The attached FSFonts.gif is a 2X magnified picture of two samples of the same font (Verdana Bold Italic 42). The top (better-looking) sample was made directly from the glyphs Form in the FormSetFont using this from a Workspace:
The attached FSFont1x.gif is a 1X version of the better looking sample, showing that it can look pretty good in practice.
SketchMorph withForm: (FormSetFont allInstances first glyphs contentsOfArea: (1810@0 extent: 100@53)) ) openInHand
The bottom sample is a TextMorph that uses the same font.
It appears that the problem lies with the drawing of the characters of the FormSetFont by the TextMorph (actually (I think) the NewParagraph).
Although the FormSetFont has an 8-bit (or deeper) Form with grey-scale antialiasing, it seems to be drawn 1-bit deep.
What I'd like is for the grey edges in the FormSetFont glyphs form to be rendered as alpha blending when drawn, so the FormSetFonts could be used to make good-looking headlines, etc. I suspect that this could be done by using a correct color map and BitBlt mode, but I'm not sure where to do it.
Can anyone point me in the right direction? I started looking at how the fonts were drawn, but I quickly ran into my lack of knowledge about BitBlt modes and the DisplayScanner.
Rather than spend too much more time on this, if anyone has a suggestion or quick fix, it would be appreciated!
We're really close to having TrueType fonts work pretty well in Squeak!
-- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com
squeak-dev@lists.squeakfoundation.org