- Glyph g = null;
- if (!glyphsToBeDisplayed.isEmpty()) {
- g = (Glyph)glyphsToBeDisplayed.keys().nextElement();
- glyphsToBeDisplayed.remove(g);
- Log.debug(Font.class, "glyphRenderingTask removed glyph " + g.c + " of font " /*+ g.font*/ + " from glyphsToBeDisplayed");
- }
- else if (!glyphsToBeCached.isEmpty()) {
- g = (Glyph)glyphsToBeCached.keys().nextElement();
- glyphsToBeCached.remove(g);
- Log.debug(Font.class, "glyphRenderingTask removed glyph " + g.c + " of font " /*+ g.font*/ + " from glyphsToBeCached");
- }
- if (g != null) {
- Log.debug(Glyph.class, "rendering glyph " + g);
- try { freetype.renderGlyph(g); } catch (IOException e) { Log.info(Freetype.class, e); }
- Scheduler.add(this); // keep ourselves in the queue until there are no glyphs to render
- glyphRenderingTaskIsScheduled = true;
- }
- else {
- glyphRenderingTaskIsScheduled = false;
- return;
- }
+ // FIXME: this should be a low-priority task
+ glyphRenderingTaskIsScheduled = false;
+ if (glyphsToBeCached.isEmpty()) return;
+ Glyph g = (Glyph)glyphsToBeCached.keys().nextElement();
+ if (g == null) return;
+ glyphsToBeCached.remove(g);
+ Log.debug(Font.class, "glyphRenderingTask rendering " + g.c + " of " + g.font);
+ g.render();
+ Log.debug(Glyph.class, " done rendering glyph " + g.c);
+ glyphRenderingTaskIsScheduled = true;
+ Scheduler.add(this);