Font.st
changeset 5981 100d92bb2b39
parent 5907 ad7449037a9e
child 5990 13498d2ba36b
--- a/Font.st	Mon Jan 07 16:49:45 2013 +0100
+++ b/Font.st	Mon Jan 07 16:50:23 2013 +0100
@@ -870,6 +870,8 @@
      CAVEAT:
         currently only constant height fonts are supported."
 
+    |sum|
+
     device isNil ifTrue:[
         self errorNoDevice.
         ^ 0
@@ -877,8 +879,24 @@
     replacementFont notNil ifTrue:[
         ^ replacementFont heightOf:textOrString
     ].
+    device supportsVariableHeightFonts ifFalse:[
+        ^ descent + ascent
+    ].
 
-    ^ descent + ascent
+    (textOrString isString) ifTrue:[
+        ^ device heightOf:textOrString string inFont:fontId
+    ].
+    (textOrString isCharacter) ifTrue:[
+        ^ device heightOf:textOrString asString inFont:fontId
+    ].
+
+    sum := 0.
+    textOrString do:[:lineString |
+        lineString isString ifTrue:[
+            sum := sum + (device heightOf:lineString asString inFont:fontId).
+        ]
+    ].
+    ^ sum
 
     "Created: 12.5.1996 / 11:05:00 / cg"
 !
@@ -1239,11 +1257,12 @@
 !Font class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.127 2012-04-25 19:05:49 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.128 2013-01-07 15:50:23 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.127 2012-04-25 19:05:49 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.128 2013-01-07 15:50:23 stefan Exp $'
 ! !
 
+
 Font initialize!