checkin from browser
authorClaus Gittinger <cg@exept.de>
Wed, 25 Feb 2004 23:47:51 +0100
changeset 4039 e4a7687582d6
parent 4038 538491244f6f
child 4040 53895a8ecd71
checkin from browser
BitmapFont.st
--- a/BitmapFont.st	Tue Feb 24 20:04:03 2004 +0100
+++ b/BitmapFont.st	Wed Feb 25 23:47:51 2004 +0100
@@ -145,6 +145,53 @@
     top extent:200@200.
     top open.
                                                                 [exEnd]
+
+  another clock display:
+                                                                [exBegin]
+    |glyphs f label|
+
+    glyphs := Array new:256.
+    glyphs 
+        at:($0 asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/led0.xpm').
+    glyphs 
+        at:($1 asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/led1.xpm').
+    glyphs 
+        at:($2 asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/led2.xpm').
+    glyphs 
+        at:($3 asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/led3.xpm').
+    glyphs 
+        at:($4 asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/led4.xpm').
+    glyphs 
+        at:($5 asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/led5.xpm').
+    glyphs 
+        at:($6 asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/led6.xpm').
+    glyphs 
+        at:($7 asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/led7.xpm').
+    glyphs 
+        at:($8 asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/led8.xpm').
+    glyphs 
+        at:($9 asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/led9.xpm').
+    glyphs 
+        at:($: asciiValue + 1) 
+        put:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_numbers/ledCol.xpm').
+
+    f := BitmapFont new glyphs:glyphs.
+
+    label := Label new label:(Time now printString).
+    label font:f.
+    label open
+                                                                [exEnd]
+
 "
 ! !
 
@@ -353,10 +400,12 @@
 
     maxWidth := maxHeight := 0. 
     aGlyphArray do:[:glyph | glyph notNil ifTrue:[
-                                 maxWidth := maxWidth max:glyph width.
-                                 maxHeight := maxHeight max:glyph height.
+                                 maxWidth := maxWidth max:(glyph width).
+                                 maxHeight := maxHeight max:(glyph height).
                              ]
-                   ]
+                   ].
+    ascent isNil ifTrue:[ascent := maxHeight].
+    descent isNil ifTrue:[descent := 0].
 !
 
 setAscent:aNumber
@@ -453,7 +502,7 @@
 descent
     "return the descent - the number of pixels below the baseLine"
 
-    ^ descent
+    ^ descent ? 0
 !
 
 descentOn:aDevice
@@ -503,7 +552,7 @@
      character"
 
     ascent isNil ifTrue:[
-        ascent := (self maxHeight - descent) max:0
+        ascent := (self maxHeight - self descent) max:0
     ].
     ^ ascent.
 !
@@ -522,7 +571,7 @@
     "return the maximum height; thats the height of the highest
      character"
 
-    ^ maxHeight
+    ^ maxHeight ? 0
 !
 
 maxWidth 
@@ -572,5 +621,5 @@
 !BitmapFont class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/BitmapFont.st,v 1.8 2002-07-24 18:48:36 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/BitmapFont.st,v 1.9 2004-02-25 22:47:51 cg Exp $'
 ! !