fontMetric stuff changed
authorClaus Gittinger <cg@exept.de>
Wed, 05 Sep 2001 19:28:17 +0200
changeset 3479 e647bc300eba
parent 3478 b9d198097d10
child 3480 541ef52df2b8
fontMetric stuff changed
Font.st
--- a/Font.st	Wed Sep 05 19:27:05 2001 +0200
+++ b/Font.st	Wed Sep 05 19:28:17 2001 +0200
@@ -555,53 +555,25 @@
 
 !Font methodsFor:'private'!
 
-fontMetricsInto:aBlock
-    "evaluate aBlock, passing all of my fontMetrics as arguments"
-
-    device isNil ifTrue:[
-        self errorNoDevice.
-        ^ self
-    ].
-    replacementFont notNil ifTrue:[
-        replacementFont fontMetricsInto:aBlock.
-	^ self
-    ].
-
-    aBlock
-	value:encoding 
-	value:ascent 
-	value:descent 
-	value:maxAscent 
-	value:maxDescent
-	value:minWidth 
-	value:maxWidth 
-	value:width
-!
-
 getFontInfos
     "ask the device about all of my actual attributes"
 
-    |b|
+    |b info|
 
-    b := [
-            :fencoding :favgAscent :favgDescent :fmaxAscent :fmaxDescent
-            :fminWidth :fmaxWidth :favgWidth |
+    replacementFont notNil ifTrue:[
+        replacementFont getFontInfos.
+        ^ self
+    ].
 
-            encoding := fencoding.
-            ascent := favgAscent.
-            descent := favgDescent.
-            maxAscent := fmaxAscent.
-            maxDescent := fmaxDescent.
-            minWidth := fminWidth.
-            maxWidth := fmaxWidth.
-            width := favgWidth
-        ].
-
-    replacementFont isNil ifTrue:[
-	device fontMetricsOf:fontId into:b.
-    ] ifFalse:[
-	replacementFont fontMetricsInto:b
-    ].
+    info := device fontMetricsOf:fontId.
+    encoding := device encodingOf:fontId.
+    ascent := info ascent.
+    descent := info descent.
+    maxAscent := info maxAscent.
+    maxDescent := info maxDescent.
+    minWidth := info minWidth.
+    maxWidth := info maxWidth.
+    width := info averageWidth.
 
     width < minWidth ifTrue:[
         "/ some systems/fonts return a wrong value (0) as width of a space
@@ -1114,6 +1086,6 @@
 !Font class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.77 2001-04-13 16:21:16 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.78 2001-09-05 17:28:17 cg Exp $'
 ! !
 Font initialize!