// get the index for the needed glyph
final char ch = text.charAt(i);
final int index = encTable.getTableFormat().getGlyphIndex(ch);
if (ch != ' ') {
final Glyph g = glyphTable.getGlyph(index);
final GlyphRenderer renderer = renderCache.getRenderer(g,
ascent);
final Dimension d;
d = renderer.createGlyphRaster(alphaRaster, fontSize);
final Point2D minLoc = renderer.getMinLocation(fontSize);
final int dstX = x + (int) minLoc.getX();
final int dstY = y - d.height + (int) minLoc.getY();
surface.drawAlphaRaster(alphaRaster, tx, 0, 0, dstX, dstY,
d.width, d.height, color);