[ENH][FIX] TextMorph

Michael Rueger Michael.Rueger.-ND at disney.com
Wed Mar 1 23:03:46 UTC 2000


Change Set:		TextMorph-mir
Date:			3 August 1999
Author:			Michael Rueger

Changes to the textstyle are not always propagated to the internal paragraph.
Changing the alignment after setting the textstyle resets the paragraph to
its original textstyle.
This fix also introduces methods to specify wrapping with the initialization
method and to set explicitly set font and size.

-- 

 "To improve is to change, to be perfect is to change often." 
                                            Winston Churchill
+------------------------------------------------------------+
| Michael Rueger                                             |
| Phone: ++1 (818) 623 3283        Fax:   ++1 (818) 623 3559 |
+---------- Michael.Rueger.-ND at corp.go.com ------------------+
-------------- next part --------------
"Change Set:		TextMorph-mir
Date:			3 August 1999
Author:			Michael Rueger

Changes to the textstyle are not always propagated to the internal paragraph. Changing the alignment after setting the textstyle resets the paragraph to its original textstyle.
This fix also introduces methods to specify wrapping with the initialization method and to set explicitly set font and size.
"!

!TextMorph methodsFor: 'accessing' stamp: 'mir 8/2/1999 10:33'!
fontName: fontName size: fontSize
	| newTextStyle |
	newTextStyle _ (TextStyle named: fontName asSymbol) copy.
	newTextStyle ifNil: [self halt: 'Error: font ', fontName, ' not found.'].

	textStyle _ newTextStyle.
	text addAttribute: (TextFontChange fontNumber: (newTextStyle fontIndexOfSize: fontSize)).
	paragraph ifNotNil: [paragraph textStyle: newTextStyle]! !

!TextMorph methodsFor: 'initialization' stamp: 'mir 8/2/1999 10:35'!
string: aString fontName: aName size: aSize wrap: shouldWrap

	shouldWrap
		ifTrue: [self contentsWrapped: aString]
		ifFalse: [self contents: aString].
	self fontName: aName size: aSize! !


!TextMorph methodsFor: 'initialization' stamp: 'mir 8/2/1999 10:34'!
string: aString fontName: aName size: aSize

	self string: aString fontName: aName size: aSize wrap: true! !




More information about the Squeak-dev mailing list