class: Text
authorClaus Gittinger <cg@exept.de>
Sat, 01 Feb 2014 23:29:26 +0100
changeset 3158 32762c55c099
parent 3157 44f5f9f79256
child 3159 1ea80d1ded0c
class: Text class definition changed: #displayOn:x:y:opaque: #initialize
Text.st
--- a/Text.st	Wed Jan 29 14:35:33 2014 +0100
+++ b/Text.st	Sat Feb 01 23:29:26 2014 +0100
@@ -11,14 +11,15 @@
 "
 "{ Package: 'stx:libbasic2' }"
 
-CharacterArray subclass:#Text
+CharacterArray variableByteSubclass:#Text
 	instanceVariableNames:'string runs'
 	classVariableNames:'BackgroundColorEmphasis ColorEmphasis ItalicEmphasis BoldEmphasis
 		UnderlineEmphasis UnderwaveEmphasis OverlineEmphasis
 		StrikeoutEmphasis ReverseEmphasis BoldUnderlineEmphasis
 		BoldOverlineEmphasis BoldUnderwaveEmphasis
 		ItalicUnderlineEmphasis ItalicUnderwaveEmphasis
-		UnderlineColorEmphasis StrikeoutColorEmphasis EtchColorEmphasis'
+		UnderlineColorEmphasis StrikeoutColorEmphasis EtchColorEmphasis
+		FontEmphasis'
 	poolDictionaries:''
 	category:'Collections-Text'
 !
@@ -184,6 +185,7 @@
     UnderlineColorEmphasis := #underlineColor. 
     StrikeoutColorEmphasis := #strikeoutColor. 
     EtchColorEmphasis := #etchColor.
+    FontEmphasis := #font.
 
     "
      Text initialize
@@ -730,7 +732,7 @@
 
     |savedFont savedPaint savedFgPaint savedBgPaint font color boldFont italicFont boldItalicFont 
      bgPaint etchColor ulPaint strikePaint
-     wasItalic overline
+     wasItalic overline altFont
      bold italic underline underwave strikeout reverse
      pos    "{ Class: SmallInteger }"
      endPos "{ Class: SmallInteger }"
@@ -753,6 +755,7 @@
         wasItalic := italic.
         color := savedPaint.
         bold := italic := underline := underwave := strikeout := reverse := false.
+        altFont := nil.
         bgPaint := savedBgPaint.
 
         emphasis isSymbol ifTrue:[
@@ -790,7 +793,10 @@
                     ] ifFalse:[k == EtchColorEmphasis ifTrue:[
                         etchColor := value onDevice:device.
                         "/ emphasis value:etchColor.
-                    ]]]]]
+                    ] ifFalse:[k == FontEmphasis ifTrue:[
+                        altFont := value onDevice:device.
+                        "/ emphasis value:altFont.
+                    ]]]]]]
                 ]
             ] ifFalse:[
                 emphasis notNil ifTrue:[
@@ -827,7 +833,10 @@
                                     ] ifFalse:[k == EtchColorEmphasis ifTrue:[
                                         etchColor := value onDevice:device.
                                         "/ entry value:etchColor.
-                                    ]]]]]
+                                    ] ifFalse:[k == FontEmphasis ifTrue:[
+                                        altFont := value onDevice:device.
+                                        "/ entry value:altFont.
+                                    ]]]]]]
                                 ]
                             ]
                         ]]]]]]]]]]]
@@ -835,30 +844,32 @@
                 ]
             ]
         ].
-
-        bold ifTrue:[
-            italic ifTrue:[
-                boldItalicFont isNil ifTrue:[
-                    boldItalicFont := savedFont asBold asItalic onDevice:device
-                ].
-                font := boldItalicFont.
+        altFont notNil ifTrue:[
+            font := altFont.
+        ] ifFalse:[
+            bold ifTrue:[
+                italic ifTrue:[
+                    boldItalicFont isNil ifTrue:[
+                        boldItalicFont := savedFont asBold asItalic onDevice:device
+                    ].
+                    font := boldItalicFont.
+                ] ifFalse:[
+                    boldFont isNil ifTrue:[
+                        boldFont := savedFont asBold onDevice:device
+                    ].
+                    font := boldFont.
+                ]
             ] ifFalse:[
-                boldFont isNil ifTrue:[
-                    boldFont := savedFont asBold onDevice:device
-                ].
-                font := boldFont.
-            ]
-        ] ifFalse:[
-            italic ifTrue:[
-                italicFont isNil ifTrue:[
-                    italicFont := savedFont asItalic onDevice:device
-                ].
-                font := italicFont.
-            ] ifFalse:[
-                font := savedFont
-            ]
+                italic ifTrue:[
+                    italicFont isNil ifTrue:[
+                        italicFont := savedFont asItalic onDevice:device
+                    ].
+                    font := italicFont.
+                ] ifFalse:[
+                    font := savedFont
+                ]
+            ].
         ].
-
         font := font onDevice:device.
         aGC basicFont:font.
         reverse ifTrue:[
@@ -1817,11 +1828,11 @@
 !Text class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.122 2013-09-05 23:07:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.123 2014-02-01 22:29:26 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.122 2013-09-05 23:07:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.123 2014-02-01 22:29:26 cg Exp $'
 ! !