--- a/Font.st Wed Aug 18 20:22:57 1999 +0200
+++ b/Font.st Wed Aug 18 21:13:05 1999 +0200
@@ -349,6 +349,54 @@
"create a new Font representing the same font as
myself on aDevice; if one already exists, return the one."
+"/ self obsoleteMethodWarning:'use onDevice:'.
+ ^ self onDevice:aDevice
+
+!
+
+on: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)."
+
+ |newFont id|
+
+ "ask that device for the font"
+ id := aDevice getFontWithFamily:family face:face style:style size:size encoding:encoding.
+ id isNil ifTrue:[
+ "oops did not work - (device has no such font)"
+
+ ^ exceptionBlock value
+ ].
+
+ "receiver was not associated - do it now"
+ device isNil ifTrue:[
+ device := aDevice.
+ fontId := id.
+
+ self getFontInfos.
+ aDevice registerFont:self.
+ ^ self
+ ].
+
+ "receiver was already associated to another device - need a new font"
+ newFont := (self class basicNew)
+ setFamily:family
+ face:face
+ style:style
+ size:size
+ encoding:encoding
+ device:aDevice.
+ newFont setFontId:id.
+ newFont getFontInfos.
+ aDevice registerFont:newFont.
+ ^ 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 ..."
@@ -404,44 +452,6 @@
"Modified: 14.4.1997 / 18:22:31 / cg"
!
-on: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)."
-
- |newFont id|
-
- "ask that device for the font"
- id := aDevice getFontWithFamily:family face:face style:style size:size encoding:encoding.
- id isNil ifTrue:[
- "oops did not work - (device has no such font)"
-
- ^ exceptionBlock value
- ].
-
- "receiver was not associated - do it now"
- device isNil ifTrue:[
- device := aDevice.
- fontId := id.
-
- self getFontInfos.
- aDevice registerFont:self.
- ^ self
- ].
-
- "receiver was already associated to another device - need a new font"
- newFont := (self class basicNew) setFamily:family
- face:face
- style:style
- size:size
- encoding:encoding
- device:aDevice.
- newFont setFontId:id.
- newFont getFontInfos.
- aDevice registerFont:newFont.
- ^ newFont
-!
-
replacementFontOn: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
@@ -479,15 +489,11 @@
!Font methodsFor:'instance release'!
-shallowCopyForFinalization
+executor
"redefined to return a lightweight copy
- all we need is the device handle"
- |aCopy|
-
- aCopy := DeviceFontHandle basicNew.
- aCopy setDevice:device fontId:fontId.
- ^ aCopy
+ ^ DeviceFontHandle basicNew setDevice:device fontId:fontId.
"Modified: / 20.4.1996 / 23:23:04 / cg"
"Modified: / 3.2.1999 / 16:13:10 / stefan"
@@ -1093,6 +1099,6 @@
!Font class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.70 1999-08-18 18:22:02 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.71 1999-08-18 19:13:05 cg Exp $'
! !
Font initialize!