2003/10/28 10:10:17
[org.ibex.core.git] / src / org / xwt / Glyph.java
index fdde61d..425cfd2 100644 (file)
@@ -2,6 +2,7 @@
 package org.xwt;
 import org.xwt.translators.*;
 import org.xwt.util.*;
+import org.xwt.js.*;
 
 public class Glyph {
     public char c;
@@ -18,14 +19,14 @@ public class Glyph {
         Glyph ret = (Glyph)glyphCache.get(res, new Integer((((int)c) << 16) | pointsize));
         if (ret != null) return ret;
 
+        ThreadMessage.fakeBackground = true;
         // FEATURE: be smarter here
-        if (c < 256)
-            Font.renderGlyphs(res, pointsize, 0, 255, glyphCache);
-        else
-            Font.renderGlyphs(res, pointsize, (int)c, (int)c, glyphCache);
+        if (c >= 32 && c < 127) Freetype.renderGlyphs(res, pointsize, 32, 126, glyphCache);
+        else Freetype.renderGlyphs(res, pointsize, (int)c, (int)c, glyphCache);
+        ThreadMessage.fakeBackground = false;
 
         ret = (Glyph)glyphCache.get(res, new Integer((((int)c) << 16) | pointsize));
         if (ret != null) return ret;
-        throw new RuntimeException("renderGlyphs didn't create the glyph we wanted");
+        throw new JS.Exn("error rendering glyph " + c + "; glyph is null");
     }
 }