How to get font size to "stick" on a TextMorph
Randal L. Schwartz
merlyn at stonehenge.com
Mon Sep 10 17:46:59 UTC 2001
>>>>> "Ned" == Ned Konz <ned at bike-nomad.com> writes:
Ned> On Monday 10 September 2001 10:16 am, Randal L. Schwartz wrote:
>> >>>>> "Ned" == Ned Konz <ned at bike-nomad.com> writes:
>>
Ned> If you're doing this programmatically, what you want to do is to pass
>> a Text Ned> (which has styles in it) rather than a String (which would use
>> a default Ned> font).
>>
>> Is there a way to set the "default font" for a TextMorph then?
Ned> Yes; beAllFont: works. TextMorphs have a textStyle instvar.
Oh, but a "Player" doesn't know how to do that. A "Player" knows
how to "setCharacters:", and delegate that to the Morph via
self constume renderedMorph setCharacters: amt
but beAllFont: is not a delegated method
so I'd have to write in my PlayerScript
self costume renderedMorph beAllFont: ...
which seems too inside-peeky to me.
>> If so,
>> how come the halo doesn't do it? I just want to be able to say
>> "update the string you're displaying to be FOO now". That shouldn't
>> be hard in this eToys world. :)
Ned> How does the halo let you change the text? I just select all the characters
Ned> with the mouse or keyboard (cmd-A) and type in new text.
Right. And that lives until the next tick of my script. The
'beAllCharacters:' resets it back to some inherent default font.
>> Or, is there a more appropriate string holder container?
Ned> What are you trying to do?
Well, Saturday, I got the great idea to make a countdown counter to
the rollover of the Unix billion-second-ium. And I got it mostly
working, using the eToy scripting interface, except the font was
wrong, so as I started to poke at the font, and got stuck. Every time
my script would tick (running setCharacters:), the font would reset to
element 1 of the list of fonts, but I had no way to either menu-change
or etoy-change that font.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
More information about the Squeak-dev
mailing list
|