- 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 (!encounteredUnrenderedGlyph) return ((((long)width) << 32) | (long)(height & 0xffffffffL));
-
- if (callback != null) Scheduler.add(new Scheduler.Task() {
- public void perform() throws IOException, JSExn {
- // FEATURE this isn't terribly efficient... perhaps the task should go on the last glyph?
- for(int i=0; i<text.length(); i++) {
- Glyph g = glyphs[text.charAt(i)];
- if (g == null || !g.isLoaded) { Scheduler.add(this); return; }
- }
- callback.perform();
- }});
-