[Newbies] How to set a Font in a StringMorph?

John-Reed Maffeo jrmaffeo at gmail.com
Thu Sep 10 20:02:57 UTC 2015


Fredrik,

It looks like you have not received a reply yet. Does this help?

font: ((TextStyle named: #Atlanta ) fontOfSize: 14)

jrm

On Fri, Sep 4, 2015 at 3:51 PM, Fredrik Alink <falink at free.fr> wrote:

> Hi,
>
> I got a nice way of creating button Morphs somewhere on the Web. However,
> for showing the button label it uses the StringMorph. In StringMorph I find
> the method “font: aFont”. Could I use that for setting the Font shown on
> the
> button? And what should I use as aFont? Doing “aFont := TextMorph new …..”
> is wrong. Are there other ways to get to an alternative of the default font
> through the StringMorph?
>
> What I did so far:
>
> *My Class instance:*
>         labelMorph := (ButtonElementMorph “new”)
>                 createLabelMorph: aLabel
>                 withEmphasis: anEmphasis
>                 /withFont: aFont./
>
> What I found on the web – *ButtonElementMorph Class instance:*
>         (StringMorph contents: aLabel)
>                 emphasis: anEmphasis;
>                 /font: aFont./
>
> *StringMorph class instance:*
>         emphasis: anEmphasis.
>         /font: aFont/ “can I use this and what should I place here?”
>
> Thank you in advance for giving me th right direction to find a solution!
>
> Fredrik
>
>
>
>
> --
> View this message in context:
> http://forum.world.st/How-to-set-a-Font-in-a-StringMorph-tp4848183.html
> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20150910/8c98955f/attachment.htm


More information about the Beginners mailing list