fixed #isFixedFont
authorMichael Beyl <mb@exept.de>
Wed, 24 Jul 2002 15:43:38 +0200
changeset 3664 85de01ef2853
parent 3663 d40999d6cd1e
child 3665 88c6d39e3da4
fixed #isFixedFont
BitmapFont.st
CompoundFont.st
--- a/BitmapFont.st	Tue Jul 23 22:33:41 2002 +0200
+++ b/BitmapFont.st	Wed Jul 24 15:43:38 2002 +0200
@@ -478,6 +478,16 @@
     "return true if all of the fonts characters are equal in
      width."
 
+    |w|
+
+    characterBitmaps do:[:glyph | |wHere|
+                                glyph notNil ifTrue:[
+                                    wHere := glyph width.  
+                                    w isNil 
+                                        ifTrue:[ w := wHere ]
+                                        ifFalse:[ w ~~ wHere ifTrue:[^ false]]
+                                ]
+                        ].
     ^ true
 !
 
@@ -549,5 +559,5 @@
 !BitmapFont class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/BitmapFont.st,v 1.5 2002-07-23 20:31:40 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/BitmapFont.st,v 1.6 2002-07-24 13:43:28 mb Exp $'
 ! !
--- a/CompoundFont.st	Tue Jul 23 22:33:41 2002 +0200
+++ b/CompoundFont.st	Wed Jul 24 15:43:38 2002 +0200
@@ -309,12 +309,16 @@
     "return true, if this is a fixed pitch font (i.e. all characters
      are of the same width)"
 
+    |w|
+
     baseFont isFixedWidth ifFalse:[^ false].
+    w := baseFont width.
+
     characterToFontMapping keysAndValuesDo:[:char :font |
-        font isFixedWidth ifFalse:[^ false].    
+        font isFixedWidth ifFalse:[^ false].
+        font width ~~ w ifTrue:[^ false].
     ].
     ^ true
-
 !
 
 maxAscent
@@ -365,5 +369,5 @@
 !CompoundFont class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/CompoundFont.st,v 1.5 2002-07-23 20:32:10 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/CompoundFont.st,v 1.6 2002-07-24 13:43:38 mb Exp $'
 ! !