'From etoys3.0 of 24 February 2008 [latest update: #2042] on 24 June 2008 at 1:50:18 am'! "Change Set: pangoJun23-yo Date: 24 June 2008 Author: Yoshiki Ohshima language attribute is created in a primitive. when composing, text lines are not passed into anymore. "! !PangoParagraph methodsFor: 'as yet unclassified' stamp: 'yo 6/24/2008 00:33'! characterBlockForIndex: index | r b rect | r := RomePluginCanvas composingCanvas. r ifNil: [^ super characterBlockForIndex: index]. rect := self compositionRectangle. b := CharacterBlock new. r pangoBlockIn: text string attributeArray: self asPangoAttributes at: index at: positionWhenComposed width: rect width height: rect height into: b. ^ b textLine: (self textLineIncludes: index). ! ! !PangoParagraph methodsFor: 'as yet unclassified' stamp: 'yo 6/24/2008 01:41'! composeAll | r rect w myLines | pangoAttrCache := nil. r := RomePluginCanvas composingCanvas. r ifNil: [^ super composeAll]. rect := self compositionRectangle. w := r pangoComposeString: text string attributeArray: self asPangoAttributes at: rect origin width: rect width height: rect height withWrap: true. w ifNotNil: [ lines := w second. maxRightX := w first. ] ifNil: [ myLines := (1 to: 100) collect: [:i | TextLine new]. w := r pangoComposeString: text string attributeArray: self asPangoAttributes at: rect origin width: rect width height: rect height into: myLines withWrap: true. lines := self validLines: myLines. maxRightX := w. ].! ! !RomePluginCanvas methodsFor: '*pango' stamp: 'yo 6/23/2008 16:30'! basicUtf8StringFor: aString andIndexFor: sqIndex1 and: sqIndex2 into: anArray nullFlag: nullFlag | converter newIndex1 newIndex2 utf8String char | converter := UTF8TextConverter new. newIndex1 := -1. newIndex2 := -1. utf8String := String streamContents: [:stream | 1 to: aString size do: [:i | char := aString at: i. i = sqIndex1 ifTrue: [newIndex1 := stream position]. i = sqIndex2 ifTrue: [newIndex2 := stream position]. converter nextPut: char toStream: stream. ]. nullFlag ifTrue: [stream nextPut: (Character value: 0)]]. anArray at: 1 put: utf8String; at: 2 put: (newIndex1 = -1 ifTrue: [sqIndex1 = -1 ifTrue: [-1] ifFalse: [utf8String size]] ifFalse: [newIndex1]); at: 3 put: (newIndex2 = -1 ifTrue: [sqIndex2 = -1 ifTrue: [-1] ifFalse: [utf8String size]] ifFalse: [newIndex2]). ^ anArray.! ! !RomePluginCanvas methodsFor: '*pango' stamp: 'yo 6/23/2008 23:48'! pangoComposeString: string attributeArray: squeakAttributeArray at: aPoint width: w height: h withWrap: wrapFlag | utf8String pair ret | pair := self utf8StringFor: string andIndexFor: 0. utf8String := pair first. self preserveStateDuring: [ ret := self primPangoComposeString: utf8String x: aPoint x asInteger y: aPoint y asInteger squeakAttributeArray: squeakAttributeArray width: w asInteger height: h asInteger withWrap: wrapFlag textLineClass: TextLine. ]. ^ ret. ! ! !RomePluginCanvas methodsFor: '*pango' stamp: 'yo 6/24/2008 01:23'! primPangoComposeString: utf8String x: x y: y squeakAttributeArray: sqAttrArray width: w height: h withWrap: wrap textLineClass: textLineClass "ignores pen" ^nil! ! !RomePluginCanvas methodsFor: '*pango' stamp: 'yo 6/23/2008 16:30'! primUtf8StringFor: aString andIndexFor: sqIndex1 and: sqIndex2 into: anArray nullFlag: nullFlag ^ self basicUtf8StringFor: aString andIndexFor: sqIndex1 and: sqIndex2 into: anArray nullFlag: nullFlag. ! ! !RomePluginCanvas methodsFor: '*pango' stamp: 'yo 6/23/2008 16:31'! utf8StringFor: aString andIndexFor: sqIndex1 andIndexFor: sqIndex2 ^ self primUtf8StringFor: aString andIndexFor: sqIndex1 and: sqIndex2 into: (Array new: 3) nullFlag: true. ! ! !Text methodsFor: '*rome-pango' stamp: 'yo 6/24/2008 00:29'! pangoLanguageAttributes | ret array | ret := self primLanguageAttributes: string lOop: #L into: (array := Array new: self size//3+10). ret isInteger ifTrue: [^ array copyFrom: 1 to: ret]. ^ ret. " ^ self basicPangoLanguageAttributes. "! ! !Text methodsFor: '*rome-pango' stamp: 'yo 6/24/2008 00:29'! primLanguageAttributes: str lOop: l into: array ^ self basicPangoLanguageAttributes. ! !