Andreas Raab uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-ar.70.mcz==================== Summary ====================
Name: Graphics-ar.70
Author: ar
Time: 29 August 2009, 11:12:24 am
UUID: 58580694-2983-b146-b230-880ea8cca338
Ancestors: Graphics-jmv.69
Add a workaround for BitBlt not returning the advance width from the displayString primitive.
=============== Diff against Graphics-jmv.69 ===============
Item was changed:
----- Method: StrikeFont>>displayString:on:from:to:at:kern: (in category 'displaying') -----
displayString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta
"Draw the given string from startIndex to stopIndex
at aPoint on the (already prepared) BitBlt."
+ | pt |
(aString isByteString) ifFalse: [^ self displayMultiString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: aPoint y + self ascent.].
+ pt := aBitBlt displayString: aString
- ^ aBitBlt displayString: aString
from: startIndex
to: stopIndex
at: aPoint
strikeFont: self
+ kern: kernDelta.
+ pt = aPoint ifFalse:[^pt].
+ "In some situations BitBlt doesn't return the advance width from the primitive.
+ Work around the situation"
+ ^aPoint x + (self widthOfString: aString from: startIndex to: stopIndex) + (stopIndex-startIndex+1*kernDelta) @ aPoint y
+ !
- kern: kernDelta.!
Item was changed:
----- Method: StrikeFont>>displayMultiString:on:from:to:at:kern:baselineY: (in category 'displaying') -----
displayMultiString: aString on: aBitBlt from: startIndex to: stopIndex at: aPoint kern: kernDelta baselineY: baselineY
| leftX rightX glyphInfo char destY form gfont destX destPt |
destX := aPoint x.
charIndex := startIndex.
glyphInfo := Array new: 5.
startIndex to: stopIndex do:[:charIndex|
char := aString at: charIndex.
(self hasGlyphOf: char) ifTrue: [
self glyphInfoOf: char into: glyphInfo.
form := glyphInfo at: 1.
leftX := glyphInfo at: 2.
rightX := glyphInfo at: 3.
destY := glyphInfo at: 4.
gfont := glyphInfo at: 5.
(gfont == aBitBlt lastFont) ifFalse: [gfont installOn: aBitBlt].
destY := baselineY - destY.
aBitBlt displayGlyph: form at: destX @ destY left: leftX right: rightX font: self.
destX := destX + (rightX - leftX + kernDelta).
] ifFalse:[
destPt := self fallbackFont displayString: aString on: aBitBlt from: charIndex to: charIndex at: destX @ aPoint y kern: kernDelta from: self baselineY: baselineY.
+ destPt x = destX ifTrue:[
+ "In some situations BitBlt doesn't return the advance width from the primitive.
+ Work around the situation"
+ destX := destX + (self widthOfString: aString from: startIndex to: stopIndex) + kernDelta.
+ ] ifFalse:[destX := destPt x].
- destX := destPt x.
].
].
^destX @ aPoint y
!