--- a/Text.st Fri Aug 24 17:14:50 2001 +0200
+++ b/Text.st Wed Sep 05 20:18:50 2001 +0200
@@ -655,6 +655,7 @@
|savedFont savedPaint savedBgPaint font color boldFont italicFont boldItalicFont
bgPaint ulPaint strikePaint
+ wasItalic
bold italic underline underwave strikeout reverse
pos "{ Class: SmallInteger }"
endPos "{ Class: SmallInteger }"
@@ -671,7 +672,10 @@
pos := 1.
x := x0.
+ bold := italic := underline := underwave := strikeout := reverse := false.
+
runs runsDo:[:len :emphasis |
+ wasItalic := italic.
color := savedPaint.
bold := italic := underline := underwave := strikeout := reverse := false.
bgPaint := savedBgPaint.
@@ -779,6 +783,14 @@
aGC paint:color on:bgPaint.
].
endPos := pos + len - 1.
+
+ wasItalic ~~ italic ifTrue:[
+ italic ifFalse:[
+ "/ going from italic to non-italic; leave some space for the shear
+ x := x + (font width " // 2" )
+ ].
+ ].
+
opaque ifTrue:[
aGC displayOpaqueString:string from:pos to:endPos x:x y:y.
] ifFalse:[
@@ -1253,7 +1265,7 @@
widthOn:aGC
"return the number of device units, required on aGC's device"
- |savedFont boldFont italicFont bold italic pos f l device|
+ |savedFont boldFont italicFont bold italic wasItalic pos f l device|
device := aGC graphicsDevice.
@@ -1261,10 +1273,12 @@
pos := 1.
l := 0.
+ italic := false.
runs runsDo:[:len :emphasis |
+ wasItalic := italic.
emphasis isSymbol ifTrue:[
- bold := emphasis == #bold.
- italic := emphasis == #italic.
+ bold := (emphasis == #bold).
+ italic := (emphasis == #italic).
] ifFalse:[
(emphasis isNil
or:[emphasis isMemberOf:Association]) ifTrue:[
@@ -1291,6 +1305,12 @@
]
].
f := f onDevice:device.
+ wasItalic ~~ italic ifTrue:[
+ italic ifFalse:[
+ "/ going from italic to non-italic; leave some space for the shear
+ l := l + (f width " // 2" )
+ ].
+ ].
l := l + (f widthOf:string from:pos to:(pos + len - 1)).
pos := pos + len
].
@@ -1335,6 +1355,6 @@
!Text class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.72 2001-02-16 20:26:50 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.73 2001-09-05 18:18:50 cg Exp $'
! !
Text initialize!