How to get font size to "stick" on a TextMorph

Ned Konz ned at bike-nomad.com
Mon Sep 10 15:47:50 UTC 2001


On Monday 10 September 2001 07:34 am, Randal L. Schwartz wrote:
> So, I create a new TextMorph, and open a viewer on it.
>
> I find I can easily change "Text's" "characters" using the "basic"
> panel.  *That*, I've played with before.
>
> But I pop up a halo on the Text, and try playing with Font change/
> Font size change menu items.  I can select a portion of the string,
> and get it to change just fine.
>
> But the moment I set the characters, it *resets* back to some sort
> of default.

How are you setting the characters? If you use direct editing this works fine.

> In 20 minutes of exploring, it appears that in calling "setCharacters:",
> some associated default TextStyle gets pulled up that is associated
> with the Text, but always uses "font style 1" of that TextStyle at
> its beginning.
>
> Is there a way to change font style 1 of the text from the halo?  Or
> do I need to modify that programmatically?

If you're doing this programmatically, what you want to do is to pass a Text 
(which has styles in it) rather than a String (which would use a default 
font).

You can ask the existing text for its runs and use them (I think) or just use 
Text>>replaceFrom:to:with: and pass it a Text rather than a string.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com




More information about the Squeak-dev mailing list