[squeak-dev] Re: font confusion

Andreas Raab andreas.raab at gmx.de
Fri Aug 7 04:57:31 UTC 2009


Ralph Boland wrote:
> At this point I became confused.  I was expecting to be able to do something
> like:  'aText  useFont:  aFont'.  But I could not figure out how I am
> supposed to set the font I want to use for my text.

Just use a TextFontReference, e.g.,

   aFont := (TextStyle named: 'Atlanta') defaultFont. "or any other"
   text := 'Hello World' asText.
   text addAttribute: (TextFontReference toFont: aFont).
   text asTextMorph openInHand.

This will do it. The magic is using the right text attribute (check the 
TextAttribute hierarchy for inspiration).

Cheers,
   - Andres



More information about the Squeak-dev mailing list