public final Res res;
public int max_ascent;
public int max_descent;
- boolean latinCharsPreloaded = true; ///< true if a request to preload ASCII 32-127 has begun
+ boolean latinCharsPreloaded = false; ///< true if a request to preload ASCII 32-127 has begun
Glyph[] glyphs = new Glyph[65535];
public static class Glyph {
if (g.p == null) {
glyphsToBeRendered.prepend(g);
encounteredUnrenderedGlyph = true;
- } else {
+ } else if (!encounteredUnrenderedGlyph) {
if (pb != null && g.p != null)
pb.drawPictureAlphaOnly(g.p, x + width, y + g.font.max_ascent - g.baseline, cx1, cy1, cx2, cy2, textcolor);
width += g.advance;
}
}
- if (encounteredUnrenderedGlyph && callback != null) Scheduler.add(new Scheduler.Task() { public void perform() {
- for(int i=0; i<text.length(); i++) {
- Glyph g = glyphs[text.charAt(i)];
- if (g == null || g.p == null) { Scheduler.add(this); return; }
- }
- callback.perform();
- }});
- if (!latinCharsPreloaded) for(int i=32; i<128; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+ if (encounteredUnrenderedGlyph && callback != null) Scheduler.add(new Scheduler.Task() {
+ public void perform() throws Exception{
+ for(int i=0; i<text.length(); i++) {
+ Glyph g = glyphs[text.charAt(i)];
+ if (g == null || g.p == null) { Scheduler.add(this); return; }
+ }
+ callback.perform();
+ }});
+ if (!latinCharsPreloaded) {
+ for(int i=48; i<57; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+ for(int i=32; i<47; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+ for(int i=57; i<128; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+ }
if (!latinCharsPreloaded || encounteredUnrenderedGlyph) Scheduler.add(glyphRenderingTask);
latinCharsPreloaded = true;
+ if (encounteredUnrenderedGlyph) return -1;
return ((((long)width) << 32) | (long)(height & 0xffffffffL));
}