Ship it with Squeak
Bob Arning
arning at charm.net
Sat Jul 1 18:43:12 UTC 2000
On Sat, 1 Jul 2000 14:21:33 -0400 (EDT) Bob Arning <arning at charm.net> wrote:
>It would be easy to add attributes of TextFontReference to selected text in much the same manner that sizes and colors are done today.
Well, here it is. It changes ParagraphEditor>>offerFontMenu (cmd-k) so that all availbale fonts are shown.
Cheers,
Bob
===== code follows =====
'From Squeak2.9alpha of 13 June 2000 [latest update: #2440] on 1 July 2000 at 2:36:34 pm'!
"Change Set: manyFonts
Date: 1 July 2000
Author: Bob Arning
Changes ParagraphEditor>>offerFontMenu to offer all known fonts as options for changing the font of the current selection."!
!ParagraphEditor methodsFor: 'editing keys' stamp: 'RAA 7/1/2000 14:33'!
offerFontMenu
"Present a menu of available fonts/sizes, and if one is chosen,
apply it to the current selection.
Use ALL Fonts!! "
| reply niceNames realFonts |
niceNames _ OrderedCollection new.
realFonts _ OrderedCollection new.
StrikeFont familyNames do: [ :fam |
(TextStyle named: fam) fontArray do: [ :sf |
niceNames add: sf name withoutTrailingDigits, ' ', sf pointSize printString.
realFonts add: sf.
]
].
reply _ (SelectionMenu labelList: niceNames selections: realFonts) startUp ifNil: [^self].
self replaceSelectionWith: (
Text
string: self selection asString
attribute: (TextFontReference toFont: reply)
) ! !
More information about the Squeak-dev
mailing list
|