'From etoys3.0 of 24 February 2008 [latest update: #2052] on 28 July 2008 at 3:02:08 pm'! "Change Set: nilContents-yo Date: 28 July 2008 Author: Yoshiki Ohshima Add a guard to StringMorph when contents is nil."! !StringMorph methodsFor: '*pango' stamp: 'yo 7/28/2008 14:59'! pangoDrawOn: aCanvas in: bnds color: c | r pos rect | contents ifNil: [^ self]. (aCanvas isKindOf: FormCanvas) ifFalse: [^ self]. r := RomePluginCanvas drawingCanvasFor: aCanvas. rect := (aCanvas origin = (0@0)) ifTrue: [bnds] ifFalse: [(0@0 corner: aCanvas extent)]. r clipRectangle: rect. pos := (aCanvas origin = (0@0)) ifTrue: [self position] ifFalse: [self position + aCanvas origin]. r pangoString: contents attributeArray: self asPangoAttributes at: pos width: bnds width height: self height selectionStart: -1 selectionEnd: -1 selectionColorPixel: 16rFF0000FF. r finish. ! ! !StringMorph methodsFor: '*pango' stamp: 'yo 7/28/2008 14:59'! pangoMeasureContents | r myLines tl | contents ifNil: [^ 0@0]. r := RomePluginCanvas composingCanvas. myLines := r pangoComposeString: contents attributeArray: self asPangoAttributes at: self position width: SmallInteger maxVal height: SmallInteger maxVal withWrap: false. myLines ifNotNil: [ myLines second size > 0 ifFalse: [^ 0@0]. tl := myLines second first. ^ tl bottomRight - tl topLeft. ]. myLines := Array with: TextLine new. r pangoComposeString: contents attributeArray: self asPangoAttributes at: self position width: SmallInteger maxVal height: SmallInteger maxVal into: myLines withWrap: false. ^ myLines first bottomRight. ! !