logo       

Re: Fonts with non-standard sizes?: msg#00062

lang.smalltalk.squeak.beginners

Subject: Re: Fonts with non-standard sizes?

Simon,

What version of Squeak are you using?

> I know I can choose my own size using StrikeFont class>>fromUser, but
> what's the best way to do this in my code, non-interactively?

This is a good starting point. StrikeFont class>fromUser calls:
StrikeFont class>fromUser:allowKeyboard:, and down in the method, you
find lines like:

ptMenu add: 'new size'
target ... #addNewFontSizeDialog: ...

This suggests that for the 'new size' menu item, a message whose
selector is addNewFontSizeDialog: is sent to an object. And if you
look at the implementors of the method, it is TextStyle.

So, if you evaluate:

(TextStyle named: 'BitstreamVeraSans') addNewFontSize: 120.

you can add the new size.

> Oh, and should I prefer TTCFont or StrikeFont, or does it not
> matter?

StrikeFont is pixel font and not good for making new size
programatically. Your safe bet is on TTCFont.

> And what should I use for the font family, for maximum portability?
> Can I assume BitstreamVeraSans is always available? What's better
> than assuming that?

Nobody would lobby to remove it but you could do:

TTFontDescription default name

to figure out the "default TrueType font" in the current system.

-- Yoshiki


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise