Kerning problems when drawing text character by character
- by shekel
I'm trying to draw strings character by character to add lighting effects to shapes composed of text.
while (i != line.length()) {
c = line.substring(i, i + 1);
cWidth = g.getFontMetrics().stringWidth(c);
g.drawString(c, xx += cWidth, yy);
i++;
}
The problem is, the width of a character isn't the actual distance it's drawn from another character when those two characters are printed as a string. Is there any way to get the correct distance in graphics2d?