2003/11/22 06:44:38
[org.ibex.core.git] / src / org / xwt / Font.java
index 2eef1f1..0de8204 100644 (file)
@@ -59,7 +59,7 @@ public class Font {
         for(int i=0; i<text.length(); i++) {
             final char c = text.charAt(i);
             Glyph g = glyphs[c];
-            if (g == null) glyphsToBeRendered.prepend(g = new Glyph(c, this));    // prepend so they are high priority
+            if (g == null) glyphsToBeRendered.prepend(g = glyphs[c] = new Glyph(c, this));    // prepend so they are high priority
             if (g.p == null) {
                 glyphsToBeRendered.prepend(g);
                 encounteredUnrenderedGlyph = true;
@@ -70,7 +70,7 @@ public class Font {
                 height = java.lang.Math.max(height, max_ascent + max_descent);
             }
         }
-        
+
         if (encounteredUnrenderedGlyph && callback != null) Scheduler.add(new Scheduler.Task() { public void perform() {
             for(int i=0; i<text.length(); i++) {
                 Glyph g = glyphs[text.charAt(i)];
@@ -78,14 +78,18 @@ public class Font {
             }
             callback.perform();
         }});
-    
-        if (!latinCharsPreloaded) for(int i=32; i<128; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+        if (!latinCharsPreloaded) {
+            for(int i=48; i<57; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+            for(int i=32; i<47; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+            for(int i=57; i<128; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+        }
         if (!latinCharsPreloaded || encounteredUnrenderedGlyph) Scheduler.add(glyphRenderingTask);
         latinCharsPreloaded = true;
-        return encounteredUnrenderedGlyph ? -1 : (((long)width << 16) | (long)height);
+        if (encounteredUnrenderedGlyph) return -1;
+        return ((((long)width) << 32) | (long)(height & 0xffffffffL));
     }
 
-    public int textwidth(String s) { return (int)(textsize(s) >>> 16L); }
+    public int textwidth(String s) { return (int)((textsize(s) >>> 32) & 0xffffffff); }
     public int textheight(String s) { return (int)(textsize(s) & 0xffffffffL); }
     public long textsize(String s) {
         Long l = (Long)sizeCache.get(s);