Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
TextMorph examples
Last updated at 8:45 pm UTC on 11 June 2017
 tMorph := TextMorph new.
 font  :=  (TextFontReference toFont:  (StrikeFont familyName: 'Atlanta' size: 22)).
 aString := 'Aa Bc Cd Dd Ee Ff'.
 aText := aString asText addAttribute: font; addAttribute: (TextColor color: Color red).
 tMorph contents: aText.
 tMorph openInHand.

A example with fixed width and wrapFlag set to true.

 | t |
 t := TextMorph new contents: 'Very first line'; wrapFlag: true.
 t openInWorld.
 2 to: 20 do: [ :i | t contents: (t contents, String cr, ' line ',
  i asString) ]

aTextMorph beAllFont: aFont example
(TextMorph new 
   beAllFont: ((TextStyle default fontOfSize: 36) emphasized: 1);
   color: Color magenta;
   contents: 'Some text') openInWorld

Font size and TextMorph

Question:I just wondered if you'd worked out a way to pop up a TextMorph in italic?
Answer: Ned Konz 21 December 2001

 TextMorph new
 contents: (Text string: 'this is something longer than normal' attribute: TextEmphasis italic);
 fontName: #BitstreamVeraSans size: 24;
 releaseCachedState; "—-added"
 openInWorld

See also