double (char[] text, int offset, int length, double x, Graphics2D g) { int start = offset; double startX = x; for (int i = offset; i < offset + length; i++) { if (text[i] != '\t') continue; if (i > start) { x += getStringWidth(g, text, start, i - start); } x = nextTabStop(g, x); start = i + 1; } if (offset + length > start) { x += getStringWidth(g, text, start, offset + length - start); } return x - startX; }