=== Top of the Swiki === Attachments ===

Changing fonts

In the newer versions of Squeak (2.7 and beyond), you can simply go to the "appearance..." menu and select "system fonts...", and choose a new font. (This only works from the Morphic world menu.) -- Doug Way

For more font info, see Fonts in Squeak.


Or, to do it the old-fashioned way...

From: "Andrew C. Greenberg"
Subject: Re: [Q] Chaing Default Display Font in Squeak
Resent-From: squeak@cs.uiuc.edu

> I want to change default Squeak font NewYork(?) to Comic Plain. I like this font
> but I do not know where I can change this. Yes, I know per window by window using
> menu, but what I want to is changing all display font in my squeak.
>
> Thanks in advance.

Again, I'm just a newbie, but so far as I can tell, ParagraphEditor looks to the TextConstants, which is a global dictionary, for an entry entitled #DefaultTextStyle.

Setting this to the desired TextStyle appears to be most of what you want to do, to wit:

TextConstants at: #DefaultTextStyle put: myTextStyle

Be aware that the New York fonts do not have their own entry in the TextConstants dictionary, so you may want to copy them to such an entry before replacing (TextConstants at: #DefaultTextStyle) with the TextStyle for Comic Plain. On my base system 2.3, the following seems to do most of what you wanted:

TextConstants at: #NewYorkPlain put: (TextConstants at: #DefaultTextStyle).
TextConstants at: #DefaultTextStyle put: (TextConstants at: #ComicPlain).
You can test this out by opening new windows, and paragraph text will begenerated in Comic Plain. You can restore the old settings with:

TextConstants at: #DefaultTextStyle put: (TextConstants at: #NewYorkPlain).

Another side-effect of the addition of a TextStyle to TextConstants is that the TextStyle will thereafter be incorporated into the Command-Shift-K select-a-style menu.

I'm sure more elegant explanations and advices coud be given, but I'm just a Squeak baby. Since noone else offered an answer, I offer this for what its worth.

PART II: A META-ANSWER TO THE QUESTION POSED:

On the theory that teaching a person to fish is better than giving someone a fish, I'll answer the question again, but in a different way, for the benefit of other newbies like myself who are wondering how to find undocumented information given the dearth of Squeak documentation. Don't be scared about messing with the system in this way -- the ability to do this is one of the key FEATURES of Squeak. And don't be intimidated -- if a mere lawyer such as myself can do this much damage, imagine what you high-end technical types can do!

Anyway, here's how I found the aforementioned "answer-in-part":

Messing around with the system, It occurred to me that the menu generated by Command-shift-6 might in the browser text fields might lead me to the code in which I was interested. So I noted the string "Link to comment," in that menu and did a search for method strings including that text (select the string, then press Command-Shift-E).

This brought me to the method 'changeEmphais' in ParagraphEditor.

Asking who called changeEmphasis (Command-Shift-N) brought me to the method initializeCmdKeyShortCuts and initializeShiftCmdKeyShortCuts of class ParagraphEditor class.

These procedures gave me a roadmap for the code I needed to find, and ultimately studying methods changeEmphasis and changeStyle, and a wee bit of experimentation taught me what I related above.

For the near term, at least, that is what newbies need to do to find information. However, Squeak (and the Smalltalk-80 system from which it derives) is an enormous system, and to their credit, the guys who built it and the community have already done a banner job documenting so much as they have. The Old Smalltalk books are VERY helpful to fill in the gaps, and I recommend them to anyone seriously interested in the system. In the meanwhile, we have to wait for folks with some time on their hands to document things. And while we do, browsing around as I did above is not only a decent way to learn what isn't yet documented, but also a great way to learn how to code in and use Smalltalk.