[Q] Chaing Default Display Font in Squeak

Andrew C. Greenberg werdna at gate.net
Wed Dec 30 18:59:00 UTC 1998


> 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.

PART ONE: AN ANSWER-IN-PART TO THE QUESTION POSED:

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

	TextContents at: #DefaultTextStyle put: myTextStyle

Be aware that the New York fonts do not presently appear in the 
TextConstants dictionary, so you may want to create one before replacing it 
with your comic font.  On my standard system, the following seems to do 
most of what you seek:

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

Another side-effect of the addition of a TextStyle to TextContents 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.

Best,
A





More information about the Squeak-dev mailing list