strikeout
authorClaus Gittinger <cg@exept.de>
Sun, 12 May 1996 17:17:22 +0200
changeset 310 2c2ce53ef527
parent 309 6458ec5cc033
child 311 3416b4f24670
strikeout
Text.st
--- a/Text.st	Sun May 12 17:07:30 1996 +0200
+++ b/Text.st	Sun May 12 17:17:22 1996 +0200
@@ -120,9 +120,12 @@
 
      Dialog
         information:(Text string:'hello' emphasis:#underline)
+
+     Dialog
+        information:(Text string:'hello' emphasis:#strikeout)
     "
 
-    "Modified: 12.5.1996 / 17:04:34 / cg"
+    "Modified: 12.5.1996 / 17:16:03 / cg"
 ! !
 
 !Text methodsFor:'comparing'!
@@ -198,7 +201,12 @@
     "display the receiver on a GC"
 
     |savedFont font color boldFont italicFont savedPaint 
-     bold italic underline strikeout pos x l|
+     bold italic underline strikeout 
+     pos    "{ Class: SmallInteger }"
+     endPos "{ Class: SmallInteger }"
+     x      "{ Class: SmallInteger }"
+     l      "{ Class: SmallInteger }"
+     yL|
 
     savedFont := aGC basicFont.
     savedPaint := aGC paint.
@@ -262,26 +270,32 @@
         aGC basicFont:font.
         aGC paint:color.
 
+        endPos := pos + len - 1.
         opaque ifTrue:[
-            aGC displayOpaqueString:string from:pos to:(pos + len - 1) x:x y:y.
+            aGC displayOpaqueString:string from:pos to:endPos x:x y:y.
         ] ifFalse:[
-            aGC displayString:string from:pos to:(pos + len - 1) x:x y:y.
+            aGC displayString:string from:pos to:endPos x:x y:y.
         ].
-        l := aGC font widthOf:string from:pos to:(pos + len - 1).
+        l := aGC font widthOf:string from:pos to:endPos.
 
         underline ifTrue:[
-            aGC displayLineFromX:x y:y toX:x+l-1 y:y
+            yL := y+1.
+            aGC displayLineFromX:x y:yL toX:x+l-1 y:yL
+        ].
+        strikeout ifTrue:[
+            yL := y-(font ascent//2).
+            aGC displayLineFromX:x y:yL toX:x+l-1 y:yL
         ].
 
         x := x + l.
-        pos := pos + len
+        pos := endPos + 1
     ].
 
     aGC basicFont:savedFont.
     aGC paint:savedPaint.
 
     "Created: 12.5.1996 / 11:14:30 / cg"
-    "Modified: 12.5.1996 / 11:55:06 / cg"
+    "Modified: 12.5.1996 / 17:15:23 / cg"
 !
 
 displayOpaqueOn:aGC x:x y:y
@@ -550,5 +564,5 @@
 !Text class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.4 1996-05-12 15:07:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.5 1996-05-12 15:17:22 cg Exp $'
 ! !