Fix obsolete methods
authorStefan Vogel <sv@exept.de>
Wed, 15 May 2002 09:55:13 +0200
changeset 3628 ddeeaa203e86
parent 3627 eefbbc5c3d04
child 3629 9d06228191a6
Fix obsolete methods
Font.st
--- a/Font.st	Tue May 14 15:40:03 2002 +0200
+++ b/Font.st	Wed May 15 09:55:13 2002 +0200
@@ -358,21 +358,68 @@
 
 !Font methodsFor:'getting a device font'!
 
-on:aDevice
+onDevice:aDevice
     "create a new Font representing the same font as
      myself on aDevice; if one already exists, return the one."
 
-    "/ send out a warning: #on: is typically used to create views
-    "/ operating on a model.
-    "/ Please use #onDevice: to avoid confusion.
+    |newFont rep|
+
+    "if I am already assigned to that device ..."
+    (device == aDevice) ifTrue:[^ self].
+
+    aDevice isNil ifTrue:[^ self].
+        
+    "first look if not already there"
+    aDevice deviceFonts do:[:aFont |
+        (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 onDevice:aDevice ifAbsent:nil.
+    newFont isNil ifTrue:[
+        "oops did not work - (device has no such font)"
 
-    <resource:#obsolete>
+        aDevice isOpen ifFalse:[
+            "/ the display device is not connected
+            "/ (or has a broken connection).
+            self error:'trying to get font from closed display:', aDevice printString.
+            ^ self.
+        ].
+
+        rep := self replacementFontOnDevice:aDevice.
+        device isNil ifTrue:[
+            device := aDevice.
+            replacementFont := rep.
+            aDevice registerFont:self.
+            ^ self
+        ].
 
-    self obsoleteMethodWarning:'use #onDevice:'.
-    ^ self onDevice:aDevice
+        newFont := (self class basicNew)
+                     setFamily:family face:face style:style size:size encoding:encoding device:aDevice.
+        newFont setReplacementFont:rep.
+        aDevice registerFont:newFont.
+        ^ newFont
+    ].
+
+    ^ newFont
+
+    "
+     Font family:'foo' size:17
+    "
+
+    "Modified: 14.4.1997 / 18:22:31 / cg"
 !
 
-on:aDevice ifAbsent:exceptionBlock 
+onDevice:aDevice ifAbsent:exceptionBlock 
     "create a new Font representing the same font as
      myself on aDevice. This does NOT try to look for existing
      or replacement fonts (i.e. can be used to get physical fonts)."
@@ -411,68 +458,7 @@
     ^ newFont
 !
 
-onDevice:aDevice
-    "create a new Font representing the same font as
-     myself on aDevice; if one already exists, return the one."
-
-    |newFont rep|
-
-    "if I am already assigned to that device ..."
-    (device == aDevice) ifTrue:[^ self].
-
-    aDevice isNil ifTrue:[^ self].
-        
-    "first look if not already there"
-    aDevice deviceFonts do:[:aFont |
-        (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)"
-
-        aDevice isOpen ifFalse:[
-            "/ the display device is not connected
-            "/ (or has a broken connection).
-            self error:'trying to get font from closed display:', aDevice printString.
-            ^ self.
-        ].
-
-        rep := self replacementFontOn:aDevice.
-        device isNil ifTrue:[
-            device := aDevice.
-            replacementFont := rep.
-            aDevice registerFont:self.
-            ^ self
-        ].
-
-        newFont := (self class basicNew)
-                     setFamily:family face:face style:style size:size encoding:encoding device:aDevice.
-        newFont setReplacementFont:rep.
-        aDevice registerFont:newFont.
-        ^ newFont
-    ].
-
-    ^ newFont
-
-    "
-     Font family:'foo' size:17
-    "
-
-    "Modified: 14.4.1997 / 18:22:31 / cg"
-!
-
-replacementFontOn:aDevice
+replacementFontOnDevice:aDevice
     "return a replacement font for the receiver - this is needed, if
      an image is restored on another type of display, or one which has
      a different set of fonts."
@@ -1095,6 +1081,6 @@
 !Font class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.82 2002-05-06 06:03:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.83 2002-05-15 07:55:13 stefan Exp $'
 ! !
 Font initialize!