'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 27 May 2005 at 7:02:11 pm'! "Change Set: displayFontRefactoring Date: 27 May 2005 Author: Takashi Yamamiya Use original method as possible. Because some method for displaying font is different between Tweak and 3.8, multibyte characters can not be showed. - replace the calls to font displayString: string on: bitBlt ... -> bitBlt displayString: string font: font ... ( CTransformCanvas >> drawString:from:to:in:font:color:kern: MultiDisplayScanner >> displayLine:offset:leftInRun: ) - redundant method is unified displayString:from:to:at:kern:baselineY: ... displayString:from:to:at:kern: ... "! !BitBlt methodsFor: '*Tweak-Costume' stamp: 'tak 5/27/2005 17:50'! displayString: aString from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: baselineY font: aFont ^ aFont displayString: aString on: self from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: baselineY! ! !BitBlt methodsFor: '*Tweak-Costume' stamp: 'tak 5/27/2005 17:59'! displayString: aString from: startIndex to: stopIndex at: aPoint kern: kernDelta font: aFont ^ aFont displayString: aString on: self from: startIndex to: stopIndex at: aPoint kern: kernDelta ! ! !CTransformCanvas methodsFor: 'drawing-text' stamp: 'tak 5/27/2005 17:51'! displayString: aString from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: baselineY font: aFont ^self displayString: aString from: startIndex to: stopIndex at: aPoint font: aFont kern: kernDelta! ! !CTransformCanvas methodsFor: 'drawing-text' stamp: 'tak 5/27/2005 18:04'! displayString: aString from: startIndex to: stopIndex at: aPoint kern: kernDelta font: aFont ^self displayString: aString from: startIndex to: stopIndex at: aPoint font: aFont kern: kernDelta! ! !CTransformCanvas methodsFor: 'drawing-text' stamp: 'tak 5/27/2005 18:11'! drawString: aString from: firstIndex to: lastIndex in: bounds font: fontOrNil color: c kern: kernDelta transform isPureTranslation ifTrue:[ ^super drawString: aString from: firstIndex to: lastIndex in: bounds font: fontOrNil color: c kern: kernDelta ]. self pushState. self clipBy: bounds. font := fontOrNil ifNil:[TextStyle defaultFont]. font installOn: self foregroundColor: (shadowColor ifNil:[c]) backgroundColor: Color transparent. self displayString: aString from: firstIndex to: lastIndex at: bounds topLeft font: font kern: kernDelta. self popState.! ! !MultiDisplayScanner methodsFor: 'scanning' stamp: 'tak 5/27/2005 17:50'! displayLine: textLine offset: offset leftInRun: leftInRun "The call on the primitive (scanCharactersFrom:to:in:rightX:) will be interrupted according to an array of stop conditions passed to the scanner at which time the code to handle the stop condition is run and the call on the primitive continued until a stop condition returns true (which means the line has terminated). leftInRun is the # of characters left to scan in the current run; when 0, it is time to call setStopConditions." | done stopCondition nowLeftInRun startIndex string lastPos | line _ textLine. morphicOffset _ offset. lineY _ line top + offset y. lineHeight _ line lineHeight. rightMargin _ line rightMargin + offset x. lastIndex _ line first. leftInRun <= 0 ifTrue: [self setStopConditions]. leftMargin _ (line leftMarginForAlignment: alignment) + offset x. destX _ runX _ leftMargin. fillBlt == nil ifFalse: ["Not right" fillBlt destX: line left destY: lineY width: line width left height: lineHeight; copyBits]. lastIndex _ line first. leftInRun <= 0 ifTrue: [nowLeftInRun _ text runLengthFor: lastIndex] ifFalse: [nowLeftInRun _ leftInRun]. baselineY _ lineY + line baseline. destY _ baselineY - font ascent. runStopIndex _ lastIndex + (nowLeftInRun - 1) min: line last. spaceCount _ 0. done _ false. string _ text string. [done] whileFalse:[ startIndex _ lastIndex. lastPos _ destX@destY. stopCondition _ self scanCharactersFrom: lastIndex to: runStopIndex in: string rightX: rightMargin stopConditions: stopConditions kern: kern. lastIndex >= startIndex ifTrue:[ bitBlt displayString: string from: startIndex to: lastIndex at: lastPos kern: kern baselineY: baselineY font: font]. "see setStopConditions for stopping conditions for displaying." done _ self perform: stopCondition. "lastIndex > runStopIndex ifTrue: [done _ true]." ]. ^ runStopIndex - lastIndex "Number of characters remaining in the current run"! ! !StrikeFontSet methodsFor: '*Tweak-LastFixes-override' stamp: 'yo 1/7/2005 12:04'! displayString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta ^ self displayString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: aPoint y + self ascent. ! ! !StrikeFontSet methodsFor: '*Tweak-LastFixes-override' stamp: 'yo 1/7/2005 15:16'! displayString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: baselineY | destPoint leftX rightX glyphInfo g destY | destPoint _ aPoint. glyphInfo _ Array new: 5. startIndex to: stopIndex do: [:charIndex | self glyphInfoOf: (aString at: charIndex) into: glyphInfo. g _ glyphInfo first. leftX _ glyphInfo second. rightX _ glyphInfo third. (glyphInfo fifth ~= aBitBlt lastFont) ifTrue: [ glyphInfo fifth installOn: aBitBlt. ]. aBitBlt sourceForm: g. destY _ baselineY - glyphInfo fourth. aBitBlt destX: destPoint x. aBitBlt destY: destY. aBitBlt sourceOrigin: leftX @ 0. aBitBlt width: rightX - leftX. aBitBlt height: self height. aBitBlt copyBits. destPoint _ destPoint + (rightX - leftX + kernDelta @ 0). ]. ^ destPoint. ! ! !TTCFont methodsFor: '*Tweak-LastFixes-override' stamp: 'yo 1/7/2005 12:04'! displayString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta ^ self displayString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: aPoint y + self ascent. ! ! !TTCFont methodsFor: '*Tweak-LastFixes-override' stamp: 'yo 1/7/2005 15:17'! displayString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: baselineY | destPoint form glyphInfo destY | destPoint _ aPoint. glyphInfo _ Array new: 5. startIndex to: stopIndex do: [:charIndex | self glyphInfoOf: (aString at: charIndex) into: glyphInfo. form _ glyphInfo first. (glyphInfo fifth ~= aBitBlt lastFont) ifTrue: [ glyphInfo fifth installOn: aBitBlt. ]. destY _ baselineY - glyphInfo fourth. aBitBlt sourceForm: form. aBitBlt destX: destPoint x. aBitBlt destY: destY. aBitBlt sourceOrigin: (glyphInfo second) @ 0. aBitBlt width: glyphInfo third - glyphInfo second. aBitBlt height: form height. aBitBlt copyBits. destPoint _ destPoint + ((glyphInfo third - glyphInfo second) + kernDelta @ 0). ]. ^ destPoint. ! ! !TTCFontSet methodsFor: '*Tweak-LastFixes-override' stamp: 'yo 1/7/2005 15:17'! displayString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: baselineY | destPoint font form encoding glyphInfo char charCode destY | destPoint _ aPoint. glyphInfo _ Array new: 5. startIndex to: stopIndex do: [:charIndex | char _ aString at: charIndex. encoding _ char leadingChar + 1. charCode _ char charCode. font _ fontArray at: encoding. ((charCode between: font minAscii and: font maxAscii) not) ifTrue: [ charCode _ font maxAscii]. self glyphInfoOf: char into: glyphInfo. form _ glyphInfo first. (glyphInfo fifth ~= aBitBlt lastFont) ifTrue: [ glyphInfo fifth installOn: aBitBlt. ]. destY _ baselineY - glyphInfo fourth. aBitBlt sourceForm: form. aBitBlt destX: destPoint x. aBitBlt destY: destY. aBitBlt sourceOrigin: 0 @ 0. aBitBlt width: form width. aBitBlt height: form height. aBitBlt copyBits. destPoint _ destPoint + (form width + kernDelta @ 0). ]. ^ destPoint. ! ! CTransformCanvas removeSelector: #displayString:from:to:at:kern:baselineY:strikeFontSet:! CTransformCanvas removeSelector: #displayString:from:to:at:kern:baselineY:ttcFontSet:! CTransformCanvas removeSelector: #displayString:from:to:at:kern:baselineY:ttcFont:! CTransformCanvas removeSelector: #displayString:from:to:at:kern:strikeFontSet:! CTransformCanvas removeSelector: #displayString:from:to:at:kern:strikeFont:! CTransformCanvas removeSelector: #displayString:from:to:at:kern:ttcFontSet:! CTransformCanvas removeSelector: #displayString:from:to:at:kern:ttcFont:! CTransformCanvas removeSelector: #displayString:from:to:at:ttcFont:kern:! BitBlt removeSelector: #displayString:from:to:at:kern:baselineY:strikeFontSet:! BitBlt removeSelector: #displayString:from:to:at:kern:baselineY:ttcFontSet:! BitBlt removeSelector: #displayString:from:to:at:kern:baselineY:ttcFont:! BitBlt removeSelector: #displayString:from:to:at:kern:strikeFontSet:! BitBlt removeSelector: #displayString:from:to:at:kern:strikeFont:! BitBlt removeSelector: #displayString:from:to:at:kern:ttcFontSet:! BitBlt removeSelector: #displayString:from:to:at:kern:ttcFont:! BitBlt removeSelector: #displayString:from:to:at:ttcFont:kern:!