--- a/Font.st Sat Apr 20 23:24:12 1996 +0200
+++ b/Font.st Sat Apr 20 23:27:31 1996 +0200
@@ -162,14 +162,18 @@
!
update:something
+ "sent early during restart - flush any leftover device handles"
+
(something == #earlyRestart) ifTrue:[
- "
- this is sent by ObjectMemory when restarting from
- an image. All device specific information (especially device
- handles) are now invalid and have to be flushed
- "
- self flushDeviceFontsFor:nil
+ "
+ this is sent by ObjectMemory when restarting from
+ an image. All device specific information (especially device
+ handles) are now invalid and have to be flushed
+ "
+ self flushDeviceFontsFor:nil
]
+
+ "Modified: 20.4.1996 / 23:22:23 / cg"
! !
!Font class methodsFor:'instance creation'!
@@ -452,28 +456,38 @@
!
shallowCopyForFinalization
+ "redefined to return a lightweight copy
+ - all we need is the device handle"
+
|aCopy|
aCopy := self class basicNew.
aCopy setDevice:device fontId:fontId.
^ aCopy
+
+ "Modified: 20.4.1996 / 23:23:04 / cg"
! !
!Font methodsFor:'printing & storing'!
printOn:aStream
+ "append a printed representation of the receiver to aStream.
+ Redefined to print more about the fonts name"
+
face isNil ifTrue:[
- family isNil ifTrue:[
- aStream nextPutAll:('a replacement-Font').
- ^ self
- ].
- aStream nextPutAll:('a ' , family , '-Font').
- ^ self.
+ family isNil ifTrue:[
+ aStream nextPutAll:('a replacement-Font').
+ ^ self
+ ].
+ aStream nextPutAll:('a ' , family , '-Font').
+ ^ self.
].
aStream nextPutAll:('a ' , family , '-' ,
- face , '-' ,
- style , '-' ,
- size printString , '-Font')
+ face , '-' ,
+ style , '-' ,
+ size printString , '-Font')
+
+ "Modified: 20.4.1996 / 23:25:11 / cg"
!
storeOn:aStream
@@ -493,6 +507,8 @@
!
userFriendlyName
+ "return a user-friendly printed representation of the receiver"
+
|nm|
nm := family.
@@ -515,12 +531,14 @@
Button defaultFont userFriendlyName
"
- "Modified: 24.2.1996 / 22:14:20 / cg"
+ "Modified: 20.4.1996 / 23:25:36 / cg"
! !
!Font methodsFor:'private'!
getFontInfos
+ "ask the device about all of my actual attributes"
+
replacementFont isNil ifTrue:[
encoding := device encodingOf:fontId.
ascent := device ascentOf:fontId.
@@ -545,39 +563,63 @@
].
isFixedWidth := minWidth == maxWidth
- "Modified: 23.2.1996 / 00:46:04 / cg"
+ "Modified: 20.4.1996 / 23:26:13 / cg"
!
restored
+ "flush device handles when restored"
+
device := nil.
fontId := nil.
replacementFont := nil
+
+ "Modified: 20.4.1996 / 23:26:26 / cg"
!
setDevice:aDevice
+ "set the device handle"
+
device := aDevice
+
+ "Modified: 20.4.1996 / 23:26:35 / cg"
!
setDevice:aDevice fontId:aFontId
+ "set the device and font handles"
+
device := aDevice.
fontId := aFontId
+
+ "Modified: 20.4.1996 / 23:26:43 / cg"
!
setFamily:familyString face:faceString style:styleString size:sizeNum encoding:encodingSym device:aDevice
+ "set my instance attributes"
+
family := familyString.
face := faceString.
style := styleString.
size := sizeNum.
encoding := encodingSym.
device := aDevice
+
+ "Modified: 20.4.1996 / 23:26:56 / cg"
!
setFontId:aFontId
+ "set my font handle"
+
fontId := aFontId
+
+ "Modified: 20.4.1996 / 23:27:05 / cg"
!
setReplacementFont:aFont
+ "set my replacement font"
+
replacementFont := aFont
+
+ "Modified: 20.4.1996 / 23:27:16 / cg"
! !
!Font methodsFor:'queries'!
@@ -841,6 +883,6 @@
!Font class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.37 1996-04-13 19:16:20 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.38 1996-04-20 21:27:31 cg Exp $'
! !
Font initialize!