/** encapsulates a single font (a set of Glyphs) */
public class Font {
- private Font(Res res, int pointsize) { this.res = res; this.pointsize = pointsize; }
+ private Font(Stream res, int pointsize) { this.res = res; this.pointsize = pointsize; }
private static boolean glyphRenderingTaskIsScheduled = false;
public final int pointsize; ///< the size of the font
- public final Res res; ///< the resource from which this font was loaded
+ public final Stream res; ///< the resource 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
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(Res res, int pointsize) {
+ 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));
return ret;
Glyph g = (Glyph)glyphsToBeRendered.remove(false);
if (g == null) { glyphRenderingTaskIsScheduled = false; return; }
if (g.isLoaded) { perform(); /* tailcall to the next glyph */ return; }
- Log.info(Glyph.class, "rendering glyph " + g.c);
+ //Log.info(Glyph.class, "rendering glyph " + g.c);
try { freetype.renderGlyph(g); } catch (IOException e) { Log.info(Freetype.class, e); }
g.isLoaded = true;
Scheduler.add(this); // keep ourselves in the queue until there are no glyphs to render