X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fgraphics%2FFont.java;h=70451a36ed0f2adca6f05501612e4aa9d47676ba;hp=8b804390f16cf628966e4213bf9d6204cb249ad9;hb=HEAD;hpb=1de73c721bbd73f275ba85de292463cdd8a0fbc0 diff --git a/src/org/ibex/graphics/Font.java b/src/org/ibex/graphics/Font.java index 8b80439..70451a3 100644 --- a/src/org/ibex/graphics/Font.java +++ b/src/org/ibex/graphics/Font.java @@ -7,7 +7,6 @@ import org.ibex.util.*; import java.io.*; import java.util.Hashtable; import org.ibex.js.*; -import org.ibex.core.*; import org.ibex.nestedvm.*; import org.ibex.plat.*; import org.ibex.nestedvm.Runtime; @@ -18,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 @@ -47,15 +44,14 @@ public class Font { // Statics ////////////////////////////////////////////////////////////////////// - static final Hashtable glyphsToBeCached = new Hashtable(); - static final Hashtable glyphsToBeDisplayed = new Hashtable(); - // HACK: replace with Cache - private static Basket.Map fonts = new Basket.HashMap(); + 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); Font ret = null; if (m != null) ret = (Font)m.get(new Integer(pointsize)); - else fonts.put(stream, m = new Basket.HashMap()); + else fonts.put(stream, m = new Basket.Hash()); if (ret == null) m.put(new Integer(pointsize), ret = new Font(stream, pointsize)); return ret; } @@ -67,35 +63,42 @@ public class Font { * Rasterize the glyphs of text. * @returns (width<<32)|height */ - public long rasterizeGlyphs(String text, PixelBuffer pb, int textcolor, int x, int y, int cx1, int cy1, int cx2, int cy2) { - return rasterizeGlyphs(text, pb, textcolor, x, y, cx1, cy1, cx2, cy2, 0); } - public long rasterizeGlyphs(String text, PixelBuffer pb, int textcolor, int x, int y, - int cx1, int cy1, int cx2, int cy2, int bg) { + public String rasterizeGlyphs(String text) { + StringBuffer path = new StringBuffer(text.length() * 50); + for(int i=0; i