- for(int i=0; i<text.length(); i++) {
- final char c = text.charAt(i);
- Glyph g = glyphs[c];
- if (g == null) {
- g = Platform.createGlyph(this, c);
- glyphs[c] = g;
- }
- if (!g.isLoaded) {
- //Log.debug(Font.class, "rasterizeGlyphs encountered unrasterized glyph " + g.c + " of font " + this);
- //System.out.println("rasterizeGlyphs encountered unrasterized glyph " + g.c + " of font " + this);
- glyphsToBeRendered.prepend(g); // even if it's already in the queue, boost its priority
- encounteredUnrenderedGlyph = true;
- } else if (!encounteredUnrenderedGlyph) {
- if (pb != null) pb.drawGlyph(g, x + width, y + g.font.max_ascent - g.baseline, cx1, cy1, cx2, cy2, textcolor);
- width += g.advance;
- height = java.lang.Math.max(height, max_ascent + max_descent);
+ if (!latinCharsPreloaded) { // preload the Latin-1 charset with low priority (we'll probably want it)
+ for(int i=48; i<57; i++) if (glyphs[i]==null) glyphsToBeCached.put(glyphs[i]=Platform.createGlyph(this, (char)i),"");
+ for(int i=32; i<47; i++) if (glyphs[i]==null) glyphsToBeCached.put(glyphs[i]=Platform.createGlyph(this, (char)i),"");
+ for(int i=57; i<128; i++) if (glyphs[i]==null) glyphsToBeCached.put(glyphs[i]=Platform.createGlyph(this, (char)i),"");
+ if (!glyphRenderingTaskIsScheduled) {
+ Scheduler.add(glyphRenderingTask);
+ glyphRenderingTaskIsScheduled = true;