Help with textmorph

Steven Swerling sps2000 at mail.com
Fri Feb 20 21:47:00 UTC 2004


You can change fonts w/in the Text object itself using TextAttributes.

Try this:

| font1 font2 t1 t2 |
tMorph _ TextMorph new.
font1 _ (TextFontReference toFont: (StrikeFont familyName: 'Atlanta' 
size: 22)).
font2 _ (TextFontReference toFont: (StrikeFont familyName: 'Atlanta' 
size: 11)).
t1 _ 'this is font1' asText addAttribute: font1.
t2 _ ' and this is font2' asText addAttribute: font2.
tMorph contents: (t1,t2).
tMorph openInHand.


ducasse wrote:

> hi all
> 
> 
> I would like to have a textMorph (if you have soemthing better please 
> say it)
> that contains different fonts.
> 
> I tried
> TextMorph new openInWorld;  string: 'JJLLJL' fontName: #Atlanta size: 22 
> wrap: false
> It works. What I do not succeed to do is to add another text with 
> another font.
> 
> I tried
>     
>     fontName: #Atlanta size: 18.   
>     contents: 'stéphane in accuate18'
>     
> So any help is really appreciated
> 
> Stef
> 
> 




More information about the Squeak-dev mailing list