From: latta@scam.berkeley.edu (Craig R. Latta)
Newsgroups: comp.lang.smalltalk
Subject: Re: very large fonts
Date: 2 Sep 92 23:47:22
Organization: Experimental Computing Facility (XCF)
NNTP-Posting-Host: xcf.berkeley.edu
In-reply-to: johnson@m.cs.uiuc.edu's message of 3 Sep 92 03:02:57 GMT



	Ralph Johnson (johnson@m.cs.uiuc.edu) writes:

> I'm teaching a Smalltalk course and am projecting the display of a
> Smalltalk-80 session on a screen.  Large font is not large enough.
> Does anybody know what to do to get very large fonts?  I assume that I
> will have to find some fonts somewhere and load them into the image.
> I'm not a font mavin; I know how to change fonts on a Mac and that is
> about it.  Are there tools for importing X fonts?

	Try this very crude hack. It installs a "change font to..."
item in the Launcher "Special" menu, making the host's fonts
available. I think it works on all platforms, under 4.1. 
	Do with it what you will, no guarantees, it works for me,
blah, blah, blah...


-C


***

!LauncherView class methodsFor: 'private'!

specialMenu
	"Answer a submenu of so-called special items"
	| keys subMenu |

	keys := 'change font to...\refresh windows\collect garbage\global GC\open project\exit project\save as...\publish as...' withCRs asText allBold.
	subMenu := PopUpMenu
			labels: keys
			lines: #(1 4 6)
			values: (Array new: 8).
	subMenu valueAt: 1 put: [ | fontClass availableFonts fonts fontList index oldCursor|
	fontClass := Screen default preferredFontClass.
availableFonts := Screen default listFontNames collect: [:fontName| fontClass parse: fontName].
		fonts:= availableFonts select: [:aFont | aFont pixelSize > 0 and: [aFont family notNil]].
		fontList  := fonts collect: [:aFont | aFont family, '   ', aFont pixelSize printString].
		(index := (PopUpMenu labelList: (Array with: fontList)) startUp) = 0
		ifFalse: [oldCursor := Cursor currentCursor.
		Cursor currentCursor: (Cursor wait).
		TextAttributes setStyleToFont: (fonts at: index).
		Cursor currentCursor: oldCursor]].
	subMenu valueAt: 2 put: [ScheduledControllers restore].
	subMenu valueAt: 3 put: [ObjectMemory verboseCompactingGC].
	subMenu valueAt: 4 put: [ObjectMemory verboseGlobalCompactingGC].
	subMenu valueAt: 5 put: [Project openViewOn: Project new].
	subMenu valueAt: 6 put: [Project current exit].
	subMenu valueAt: 7 put: [ObjectMemory saveDialogThenQuit: false].
	subMenu valueAt: 8 put: [ObjectMemory publishPermSpaceDialogThenQuit: false].

	^subMenu! !

!TextAttributes class methodsFor: 'constants'!

setStyleToFont: aFontDescription

	| cStyle tStyle characterSize |
	characterSize := aFontDescription pixelSize.
	cStyle := CharacterAttributes new.
	cStyle at: #large put: [:query | query pixelSize: characterSize * 7 // 6].
	cStyle at: #serif put: [:query | query serif: true].
	cStyle at: #bold put: [:query | query boldness: 0.7].
	cStyle at: #italic put: [:query | query italic: true].
	cStyle at: #underline put: [:query | query underline: true].
	cStyle setDefaultQuery: ((FontDescription new) fixedWidth: (aFontDescription fixedWidth); serif:  (aFontDescription serif); italic:  (aFontDescription italic); boldness: (aFontDescription boldness); pixelSize: characterSize).
	CharacterAttributes styleNamed: #selected put: cStyle.
	tStyle := TextAttributes new.
	tStyle setCharacterAttributes: cStyle.
	tStyle lineGrid: characterSize * 5 // 4; baseline: characterSize.
	TextAttributes styleNamed: #selected put: tStyle.
	
	self setDefaultTo: #selected; resetViews! !

--
-----------------------------------------------------------------------------
Craig R. Latta           Experimental Computing Facility                (XCF)
Composer, Software and   ParcPlace Systems, Inc.        (latta@parcplace.com)
    Recording Engineer   NetJam, Berkeley                (netjam-request@xcf)
latta@xcf.Berkeley.EDU   Smallmusic OO music project (smallmusic-request@xcf)
(standard  disclaimer)   proof NL parsing project         (proof-request@xcf)
-----------------------------------------------------------------------------