/** encapsulates a single font (a set of Glyphs) */
public class Font {
- private Font(Stream stream, int pointsize) { this.stream = stream; this.pointsize = pointsize; }
+ 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 Stream stream; ///< the stream from which this font was loaded
+ public final JS 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
static final Hashtable glyphsToBeCached = new Hashtable();
static final Hashtable glyphsToBeDisplayed = new Hashtable();
private static Cache fontCache = new Cache(100);
- public static Font getFont(Stream stream, int pointsize) {
+ public static Font getFont(JS 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;
// FEATURE: use streams, not memoryfont's
// FEATURE: kerning pairs
private static final Runtime rt;
- private static Stream loadedStream;
+ private static JS loadedStream;
private static int loadedStreamAddr;
static {
private static void rtCheck() { if(rt.getState() != Runtime.PAUSED) throw new Error("Freetype exited " + rt.exitStatus()); }
- private static void loadFontByteStream(Stream res) {
+ private static void loadFontByteStream(JS res) {
if(loadedStream == res) return;
try {
- Log.info(Font.class, "loading font " + res);
+ Log.info(Font.class, "loading font " + JS.debugToString(res));
InputStream is = Stream.getInputStream(res);
byte[] fontstream = InputStreamToByteArray.convert(is);
rt.free(loadedStreamAddr);