X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FFont.java;h=ed979b71b39737367fdfd40f3bde007491d94caa;hb=f3cdbd44de64455fbfaba761bfb150928aeb5a2c;hp=bd11c4f0c0b7c91ee5a4b4a4bb5562785fdff90d;hpb=7e9239a7088d4cd772a31a76e1a53e1c681638bc;p=org.ibex.core.git diff --git a/src/org/xwt/Font.java b/src/org/xwt/Font.java index bd11c4f..ed979b7 100644 --- a/src/org/xwt/Font.java +++ b/src/org/xwt/Font.java @@ -6,15 +6,16 @@ import org.xwt.js.*; import java.util.*; import java.io.*; +// FEATURE: this could be cleaner /** encapsulates a single font (a set of Glyphs) */ public class Font { - private Font(Stream res, int pointsize) { this.res = res; this.pointsize = pointsize; } + private Font(Stream 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 Stream res; ///< the resource from which this font was loaded + public final Stream stream; ///< the stream from which this font was loaded public int max_ascent; ///< the maximum ascent, in pixels public int max_descent; ///< the maximum descent, in pixels boolean latinCharsPreloaded = false; ///< true if a request to preload ASCII 32-127 has begun @@ -27,10 +28,9 @@ public class Font { public int baseline; ///< within the alphamask, this is the y-coordinate of the baseline public int advance; ///< amount to increment the x-coordinate public boolean isLoaded = false; ///< true iff the glyph is loaded - public byte[] alphaChannel = null; public int width = -1; ///< the width of the glyph public int height = -1; ///< the height of the glyph - public byte[] data = null; + public byte[] data = null; ///< the alpha channel samples for this font } @@ -39,9 +39,9 @@ public class Font { private static final Freetype freetype = new Freetype(); static final Queue glyphsToBeRendered = new Queue(255); private static Cache fontCache = new Cache(100); - public static Font getFont(Stream res, int pointsize) { - Font ret = (Font)fontCache.get(res, new Integer(pointsize)); - if (ret == null) fontCache.put(res, new Integer(pointsize), ret = new Font(res, pointsize)); + public static Font getFont(Stream stream, int pointsize) { + Font ret = (Font)fontCache.get(stream, new Integer(pointsize)); + if (ret == null) fontCache.put(stream, new Integer(pointsize), ret = new Font(stream, pointsize)); return ret; } @@ -66,13 +66,15 @@ public class Font { for(int i=0; i