Font.st
changeset 441 91c3ba82098f
parent 438 03e433e2be99
child 442 eb4ee58f5f0a
--- a/Font.st	Fri Feb 23 03:24:18 1996 +0100
+++ b/Font.st	Fri Feb 23 17:14:16 1996 +0100
@@ -233,12 +233,18 @@
      and therefore use the replacementFont. Should never be called
      for non-replacement fonts."
 
+    |prevFont|
+
     replacementFont isNil ifTrue:[
-	'FONT: oops should not happen' errorPrintNL.
-	^ self
+        'FONT: oops - no replacementFont. should not happen' errorPrintNL.
+        ^ self
     ].
-    aGC font:replacementFont.
-    aGC displayOpaqueString:aString from:index1 to:index2 x:x y:y
+    prevFont := aGC font.
+    aGC setFont:replacementFont.
+    aGC displayOpaqueString:aString from:index1 to:index2 x:x y:y.
+    aGC setFont:prevFont
+
+    "Modified: 23.2.1996 / 17:01:27 / cg"
 !
 
 displayOpaqueString:aString x:x y:y in:aGC
@@ -246,12 +252,18 @@
      and therefore use the replacementFont. Should never be called
      for non-replacement fonts."
 
+    |prevFont|
+
     replacementFont isNil ifTrue:[
-	'FONT: oops should not happen' errorPrintNL.
-	^ self
+        'FONT: oops - no replacementFont. should not happen' errorPrintNL.
+        ^ self
     ].
-    aGC font:replacementFont.
-    aGC displayOpaqueString:aString x:x y:y
+    prevFont := aGC font.
+    aGC setFont:replacementFont.
+    aGC displayOpaqueString:aString x:x y:y.
+    aGC setFont:prevFont.
+
+    "Modified: 23.2.1996 / 17:01:35 / cg"
 !
 
 displayString:aString from:index1 to:index2 x:x y:y in:aGC
@@ -259,12 +271,18 @@
      and therefore use the replacementFont. Should never be called
      for non-replacement fonts."
 
+    |prevFont|
+
     replacementFont isNil ifTrue:[
-	'FONT: oops should not happen' errorPrintNL.
-	^ self
+        'FONT: oops - no replacementFont. should not happen' errorPrintNL.
+        ^ self
     ].
-    aGC font:replacementFont.
-    aGC displayString:aString from:index1 to:index2 x:x y:y
+    prevFont := aGC font.
+    aGC setFont:replacementFont.
+    aGC displayString:aString from:index1 to:index2 x:x y:y.
+    aGC setFont:prevFont.
+
+    "Modified: 23.2.1996 / 17:01:40 / cg"
 !
 
 displayString:aString x:x y:y in:aGC
@@ -272,12 +290,18 @@
      and therefore use the replacementFont. Should never be called
      for non-replacement fonts."
 
+    |prevFont|
+
     replacementFont isNil ifTrue:[
-	'FONT: oops should not happen' errorPrintNL.
-	^ self
+        'FONT: oops - no replacementFont. should not happen' errorPrintNL.
+        ^ self
     ].
-    aGC font:replacementFont.
-    aGC displayString:aString x:x y:y
+    prevFont := aGC font.
+    aGC setFont:replacementFont.
+    aGC displayString:aString x:x y:y.
+    aGC setFont:prevFont.
+
+    "Modified: 23.2.1996 / 17:01:46 / cg"
 ! !
 
 !Font methodsFor:'getting a device font'!
@@ -293,40 +317,46 @@
 
     "first look if not already there"
     Lobby do:[:aFont |
-	(aDevice == aFont device) ifTrue:[
-	    (size == aFont size) ifTrue:[
-		(family = aFont family) ifTrue:[
-		    (face = aFont face) ifTrue:[
-			(style = aFont style) ifTrue:[
-			    (encoding isNil or:[encoding == aFont encoding]) ifTrue:[
-				^ aFont
-			    ]
-			]
-		    ]
-		]
-	    ]
-	]
+        (aDevice == aFont device) ifTrue:[
+            (size == aFont size) ifTrue:[
+                (family = aFont family) ifTrue:[
+                    (face = aFont face) ifTrue:[
+                        (style = aFont style) ifTrue:[
+                            (encoding isNil or:[encoding == aFont encoding]) ifTrue:[
+                                ^ aFont
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        ]
     ].
 
     newFont := self on:aDevice ifAbsent:nil.
     newFont isNil ifTrue:[
-	"oops did not work - (device has no such font)"
+        "oops did not work - (device has no such font)"
 
-	rep := self replacementFontOn:aDevice.
-	device isNil ifTrue:[
-	    device := aDevice.
-	    replacementFont := rep.
-	    Lobby registerChange:self.
-	    ^ self
-	].
-	newFont := (self class basicNew)
-		     setFamily:family face:face style:style size:size encoding:encoding device:aDevice.
-	newFont setReplacementFont:rep.
-	Lobby register:newFont.
-	^ newFont
+        rep := self replacementFontOn:aDevice.
+        device isNil ifTrue:[
+            device := aDevice.
+            replacementFont := rep.
+            Lobby registerChange:self.
+            ^ self
+        ].
+        newFont := (self class basicNew)
+                     setFamily:family face:face style:style size:size encoding:encoding device:aDevice.
+        newFont setReplacementFont:rep.
+        Lobby register:newFont.
+        ^ newFont
     ].
 
     ^ newFont
+
+    "
+     Font family:'foo' size:17
+    "
+
+    "Modified: 23.2.1996 / 16:30:06 / cg"
 !
 
 on:aDevice ifAbsent:exceptionBlock 
@@ -775,6 +805,6 @@
 !Font class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.31 1996-02-23 02:22:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.32 1996-02-23 16:14:16 cg Exp $'
 ! !
 Font initialize!