- void renderText(int x, int y, int w, int h, DoubleBuffer buf) {
- /*
- if ((textcolor & 0xFF000000) == 0x00000000) return;
- buf.setClip(x, y, w + x, h + y);
-
- buf.drawString(font(), text, x + hpad, y + vpad + Platform.getMaxAscent(font()) - 1, textcolor);
- buf.setClip(0, 0, buf.getWidth(), buf.getHeight());
- int i=0; while(i<font().length() && !Character.isDigit(font().charAt(i))) i++;
-
- if (font().lastIndexOf('d') > i) {
- for(int j = x + hpad; j < x + hpad + textdim(0); j += 2)
- buf.fillRect(j, y + vpad + (xwf == null ? Platform.getMaxAscent(font()) : xwf.getMaxAscent()) + 2,
- j + 1, y + vpad + (xwf == null ? Platform.getMaxAscent(font()) : xwf.getMaxAscent()) + 2 + 1,
- textcolor);
-
- } else if (font().lastIndexOf('u') > i) {
- buf.fillRect(x + hpad,
- y + vpad + (xwf == null ? Platform.getMaxAscent(font()) : xwf.getMaxAscent()) + 2,
- x + hpad + textdim(0),
- y + vpad + (xwf == null ? Platform.getMaxAscent(font()) : xwf.getMaxAscent()) + 2 + 1,
- textcolor);
+ void renderText(int x, int y, int clipx, int clipy, int clipw, int cliph, PixelBuffer buf) {
+ for(int i=0; i<text.length(); i++) {
+ // FIXME: clipping
+ char c = text.charAt(i);
+ Glyph g = Glyph.getGlyph(font, fontsize, c);
+ buf.drawPicture(g.p,
+ x + hpad,
+ y + vpad + g.max_ascent - g.baseline,
+ x + hpad + g.p.getWidth(),
+ y + vpad + g.max_ascent - g.baseline + g.p.getHeight(),
+ 0, 0,
+ g.p.getWidth(), g.p.getHeight());
+ x += g.advance;