--- a/Text.st Wed Feb 11 15:05:14 2009 +0100
+++ b/Text.st Wed Feb 11 16:25:11 2009 +0100
@@ -670,7 +670,7 @@
|savedFont savedPaint savedFgPaint savedBgPaint font color boldFont italicFont boldItalicFont
bgPaint etchColor ulPaint strikePaint
- wasItalic
+ wasItalic overline
bold italic underline underwave strikeout reverse
pos "{ Class: SmallInteger }"
endPos "{ Class: SmallInteger }"
@@ -690,164 +690,171 @@
bold := italic := underline := underwave := strikeout := reverse := false.
runs runsDo:[:len :emphasis |
- wasItalic := italic.
- color := savedPaint.
- bold := italic := underline := underwave := strikeout := reverse := false.
- bgPaint := savedBgPaint.
+ wasItalic := italic.
+ color := savedPaint.
+ bold := italic := underline := underwave := strikeout := reverse := false.
+ bgPaint := savedBgPaint.
- emphasis isSymbol ifTrue:[
- emphasis == #bold ifTrue:[bold := true]
- ifFalse:[emphasis == #italic ifTrue:[italic := true]
- ifFalse:[emphasis == #underline ifTrue:[underline := true]
- ifFalse:[emphasis == #underwave ifTrue:[underwave := true]
- ifFalse:[emphasis == #strikeout ifTrue:[strikeout := true]
- ifFalse:[emphasis == #reverse ifTrue:[reverse := true]
- ifFalse:[emphasis == #boldUnderline ifTrue:[bold := underline := true]
- ifFalse:[emphasis == #boldUnderwave ifTrue:[bold := underwave := true]
- ifFalse:[emphasis == #italicUnderline ifTrue:[italic := underline := true]
- ifFalse:[emphasis == #italicUnderwave ifTrue:[italic := underwave := true]
- ]]]]]]]]]
- ] ifFalse:[
- (emphasis isMemberOf:Association) ifTrue:[
- value := emphasis value.
- value notNil ifTrue:[
- k := emphasis key.
- k == #color ifTrue:[
- color := value onDevice:device.
- emphasis value:color.
- ] ifFalse:[k == #backgroundColor ifTrue:[
- bgPaint := value onDevice:device.
- emphasis value:bgPaint.
- opaque := true.
- ] ifFalse:[k == #underlineColor ifTrue:[
- ulPaint := value onDevice:device.
- emphasis value:ulPaint.
- ] ifFalse:[k == #strikeoutColor ifTrue:[
- strikePaint := value onDevice:device.
- emphasis value:strikePaint.
- ] ifFalse:[k == #etchColor ifTrue:[
- etchColor := value onDevice:device.
- emphasis value:etchColor.
- ]]]]]
- ]
- ] ifFalse:[
- emphasis notNil ifTrue:[
- emphasis do:[:entry |
- entry == #bold ifTrue:[bold := true]
- ifFalse:[entry == #italic ifTrue:[italic := true]
- ifFalse:[entry == #underline ifTrue:[underline := true]
- ifFalse:[entry == #underwave ifTrue:[underwave := true]
- ifFalse:[entry == #strikeout ifTrue:[strikeout := true]
- ifFalse:[entry == #reverse ifTrue:[reverse := true]
- ifFalse:[entry == #boldUnderline ifTrue:[bold := underline := true]
- ifFalse:[emphasis == #boldUnderwave ifTrue:[bold := underwave := true]
- ifFalse:[entry == #italicUnderline ifTrue:[italic := underline := true]
- ifFalse:[emphasis == #italicUnderwave ifTrue:[italic := underwave := true]
- ifFalse:[
- (entry isMemberOf:Association) ifTrue:[
- value := entry value.
- value notNil ifTrue:[
- k := entry key.
- k == #color ifTrue:[
- color := value onDevice:device.
- entry value:color.
- ] ifFalse:[k == #backgroundColor ifTrue:[
- bgPaint := value onDevice:device.
- entry value:bgPaint.
- opaque := true.
- ] ifFalse:[k == #underlineColor ifTrue:[
- ulPaint := value onDevice:device.
- entry value:ulPaint.
- ] ifFalse:[k == #strikeoutColor ifTrue:[
- strikePaint := value onDevice:device.
- entry value:strikePaint.
- ] ifFalse:[k == #etchColor ifTrue:[
- etchColor := value onDevice:device.
- entry value:etchColor.
- ]]]]]
- ]
- ]
- ]]]]]]]]]]
- ]
- ]
- ]
- ].
+ emphasis isSymbol ifTrue:[
+ emphasis == #bold ifTrue:[bold := true]
+ ifFalse:[emphasis == #italic ifTrue:[italic := true]
+ ifFalse:[emphasis == #underline ifTrue:[underline := true]
+ ifFalse:[emphasis == #overline ifTrue:[overline := true] "MB:added"
+ ifFalse:[emphasis == #underwave ifTrue:[underwave := true]
+ ifFalse:[emphasis == #strikeout ifTrue:[strikeout := true]
+ ifFalse:[emphasis == #reverse ifTrue:[reverse := true]
+ ifFalse:[emphasis == #boldUnderline ifTrue:[bold := underline := true]
+ ifFalse:[emphasis == #boldOverline ifTrue:[bold := overline := true] "MB:added"
+ ifFalse:[emphasis == #boldUnderwave ifTrue:[bold := underwave := true]
+ ifFalse:[emphasis == #italicUnderline ifTrue:[italic := underline := true]
+ ifFalse:[emphasis == #italicUnderwave ifTrue:[italic := underwave := true]
+ ]]]]]]]]]]]
+ ] ifFalse:[
+ (emphasis isMemberOf:Association) ifTrue:[
+ value := emphasis value.
+ value notNil ifTrue:[
+ k := emphasis key.
+ k == #color ifTrue:[
+ color := value onDevice:device.
+ emphasis value:color.
+ ] ifFalse:[k == #backgroundColor ifTrue:[
+ bgPaint := value onDevice:device.
+ emphasis value:bgPaint.
+ opaque := true.
+ ] ifFalse:[k == #underlineColor ifTrue:[
+ ulPaint := value onDevice:device.
+ emphasis value:ulPaint.
+ ] ifFalse:[k == #strikeoutColor ifTrue:[
+ strikePaint := value onDevice:device.
+ emphasis value:strikePaint.
+ ] ifFalse:[k == #etchColor ifTrue:[
+ etchColor := value onDevice:device.
+ emphasis value:etchColor.
+ ]]]]]
+ ]
+ ] ifFalse:[
+ emphasis notNil ifTrue:[
+ emphasis do:[:entry |
+ entry == #bold ifTrue:[bold := true]
+ ifFalse:[entry == #italic ifTrue:[italic := true]
+ ifFalse:[entry == #underline ifTrue:[underline := true]
+ ifFalse:[entry == #underwave ifTrue:[underwave := true]
+ ifFalse:[entry == #strikeout ifTrue:[strikeout := true]
+ ifFalse:[entry == #reverse ifTrue:[reverse := true]
+ ifFalse:[entry == #boldUnderline ifTrue:[bold := underline := true]
+ ifFalse:[emphasis == #boldUnderwave ifTrue:[bold := underwave := true]
+ ifFalse:[entry == #italicUnderline ifTrue:[italic := underline := true]
+ ifFalse:[emphasis == #italicUnderwave ifTrue:[italic := underwave := true]
+ ifFalse:[
+ (entry isMemberOf:Association) ifTrue:[
+ value := entry value.
+ value notNil ifTrue:[
+ k := entry key.
+ k == #color ifTrue:[
+ color := value onDevice:device.
+ entry value:color.
+ ] ifFalse:[k == #backgroundColor ifTrue:[
+ bgPaint := value onDevice:device.
+ entry value:bgPaint.
+ opaque := true.
+ ] ifFalse:[k == #underlineColor ifTrue:[
+ ulPaint := value onDevice:device.
+ entry value:ulPaint.
+ ] ifFalse:[k == #strikeoutColor ifTrue:[
+ strikePaint := value onDevice:device.
+ entry value:strikePaint.
+ ] ifFalse:[k == #etchColor ifTrue:[
+ etchColor := value onDevice:device.
+ entry value:etchColor.
+ ]]]]]
+ ]
+ ]
+ ]]]]]]]]]]
+ ]
+ ]
+ ]
+ ].
- 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:[
- italic ifTrue:[
- italicFont isNil ifTrue:[
- italicFont := savedFont asItalic onDevice:device
- ].
- font := italicFont.
- ] ifFalse:[
- font := savedFont
- ]
- ].
- font := font onDevice:device.
- aGC basicFont:font.
- reverse ifTrue:[
- aGC paint:bgPaint on:color.
- opaque := true.
- ] ifFalse:[
- aGC paint:color on:bgPaint.
- ].
- endPos := pos + len - 1.
+ 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:[
+ italic ifTrue:[
+ italicFont isNil ifTrue:[
+ italicFont := savedFont asItalic onDevice:device
+ ].
+ font := italicFont.
+ ] ifFalse:[
+ font := savedFont
+ ]
+ ].
+ font := font onDevice:device.
+ aGC basicFont:font.
+ reverse ifTrue:[
+ aGC paint:bgPaint on:color.
+ opaque := true.
+ ] ifFalse:[
+ 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" )
+ ].
+ ].
- wasItalic ~~ italic ifTrue:[
- italic ifFalse:[
- "/ going from italic to non-italic; leave some space for the shear
- x := x + (font width " // 2" )
- ].
- ].
+ (opaque and:[etchColor isNil]) ifTrue:[
+ aGC displayOpaqueString:string from:pos to:endPos x:x y:y.
+ ] ifFalse:[
+ etchColor notNil ifTrue:[
+ opaque ifTrue:[
+ "/ sigh - must draw the background rectangle;
+ "/ its easier (and faster) to draw the string twice here ...
+ aGC displayOpaqueString:string from:pos to:endPos x:x y:y.
+ ].
+ savedFgPaint := aGC paint.
+ aGC paint:etchColor.
+ aGC displayString:string from:pos to:endPos x:x+1 y:y+1.
+ aGC paint:savedFgPaint.
+ ].
+ aGC displayString:string from:pos to:endPos x:x y:y.
+ ].
+ l := font widthOf:string from:pos to:endPos.
- (opaque and:[etchColor isNil]) ifTrue:[
- aGC displayOpaqueString:string from:pos to:endPos x:x y:y.
- ] ifFalse:[
- etchColor notNil ifTrue:[
- opaque ifTrue:[
- "/ sigh - must draw the background rectangle;
- "/ its easier (and faster) to draw the string twice here ...
- aGC displayOpaqueString:string from:pos to:endPos x:x y:y.
- ].
- savedFgPaint := aGC paint.
- aGC paint:etchColor.
- aGC displayString:string from:pos to:endPos x:x+1 y:y+1.
- aGC paint:savedFgPaint.
- ].
- aGC displayString:string from:pos to:endPos x:x y:y.
- ].
- l := font widthOf:string from:pos to:endPos.
+ underline ifTrue:[
+ ulPaint notNil ifTrue:[aGC paint:ulPaint].
+ yL := y+1.
+ aGC displayLineFromX:x y:yL toX:x+l-1 y:yL
+ ].
+ (overline ? false) ifTrue:[ "MB:added v"
+ ulPaint notNil ifTrue:[aGC paint:ulPaint].
+ yL := y-(font heightOf: string) + 2.
+ aGC displayLineFromX:x y:yL toX:x+l-1 y:yL
+ ]. "MB:added ^"
+ underwave ifTrue:[
+ ulPaint notNil ifTrue:[aGC paint:ulPaint].
+ yL := y+1.
+ aGC displayHorizontalWavelineFromX:x y:yL toX:x+l-1
+ ].
+ strikeout ifTrue:[
+ strikePaint notNil ifTrue:[aGC paint:strikePaint].
+ yL := y-(font ascent//2).
+ aGC displayLineFromX:x y:yL toX:x+l-1 y:yL
+ ].
- underline ifTrue:[
- ulPaint notNil ifTrue:[aGC paint:ulPaint].
- yL := y+1.
- aGC displayLineFromX:x y:yL toX:x+l-1 y:yL
- ].
- underwave ifTrue:[
- ulPaint notNil ifTrue:[aGC paint:ulPaint].
- yL := y+1.
- aGC displayHorizontalWavelineFromX:x y:yL toX:x+l-1
- ].
- strikeout ifTrue:[
- strikePaint notNil ifTrue:[aGC paint:strikePaint].
- yL := y-(font ascent//2).
- aGC displayLineFromX:x y:yL toX:x+l-1 y:yL
- ].
-
- x := x + l.
- pos := endPos + 1
+ x := x + l.
+ pos := endPos + 1
].
aGC basicFont:savedFont.
@@ -872,6 +879,12 @@
"Modified: 10.7.1996 / 12:07:51 / cg"
!
+allBoldOverline
+ "make all characters overline"
+
+ self emphasizeAllWith:#boldOverline
+!
+
allItalic
"make all characters italic"
@@ -885,6 +898,12 @@
"Modified: 10.7.1996 / 12:07:51 / cg"
!
+allOverline
+ "make all characters overline"
+
+ self emphasizeAllWith:#overline
+!
+
allStrikedOut
"strikeOut all characters"
@@ -1518,7 +1537,7 @@
!Text class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.95 2008-11-13 15:20:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.96 2009-02-11 15:25:11 cg Exp $'
! !
Text initialize!