X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fgraphics%2FFont.java;h=9d012e479e147243400401666bc8d644c16b8747;hb=d848b6fbc24b4a11715253052b11d4ebe165555c;hp=99c9bdc4e422ea76c6059bb7e249fec485202085;hpb=05d23fde131a7d19b378c632c6cc6b7924d8ab4d;p=org.ibex.core.git diff --git a/src/org/ibex/graphics/Font.java b/src/org/ibex/graphics/Font.java index 99c9bdc..9d012e4 100644 --- a/src/org/ibex/graphics/Font.java +++ b/src/org/ibex/graphics/Font.java @@ -17,8 +17,6 @@ public class Font { private Font(JS stream, int pointsize) { this.stream = stream; this.pointsize = pointsize; } - private static boolean glyphRenderingTaskIsScheduled = false; - public final int pointsize; ///< the size of the font public final JS stream; ///< the stream from which this font was loaded public int max_ascent; ///< the maximum ascent, in pixels @@ -46,9 +44,8 @@ public class Font { // Statics ////////////////////////////////////////////////////////////////////// - static final Hashtable glyphsToBeCached = new Hashtable(); - static final Hashtable glyphsToBeDisplayed = new Hashtable(); - // HACK: replace with Cache + static final Queue toBeRasterized = new Queue(300); + static final Queue toBeDisplayed = new Queue(300); private static Basket.Map fonts = new Basket.Hash(); public static Font getFont(JS stream, int pointsize) { Basket.Map m = (Basket.Map)fonts.get(stream); @@ -72,13 +69,9 @@ public class Font { int cx1, int cy1, int cx2, int cy2, int bg) { int width = 0, height = 0; if (!latinCharsPreloaded) { // preload the Latin-1 charset with low priority (we'll probably want it) - for(int i=48; i<57; i++) if (glyphs[i]==null) glyphsToBeCached.put(glyphs[i]=Platform.createGlyph(this, (char)i),""); - for(int i=32; i<47; i++) if (glyphs[i]==null) glyphsToBeCached.put(glyphs[i]=Platform.createGlyph(this, (char)i),""); - for(int i=57; i<128; i++) if (glyphs[i]==null) glyphsToBeCached.put(glyphs[i]=Platform.createGlyph(this, (char)i),""); - if (!glyphRenderingTaskIsScheduled) { - Platform.Scheduler.add(glyphRenderingTask); - glyphRenderingTaskIsScheduled = true; - } + for(int i=48; i<57; i++) if(glyphs[i]==null) toBeRasterized.append(glyphs[i]=Platform.createGlyph(this, (char)i)); + for(int i=32; i<47; i++) if(glyphs[i]==null) toBeRasterized.append(glyphs[i]=Platform.createGlyph(this, (char)i)); + for(int i=57; i<128; i++) if(glyphs[i]==null) toBeRasterized.append(glyphs[i]=Platform.createGlyph(this, (char)i)); latinCharsPreloaded = true; } for(int i=0; i