* Draws the text.
*/
public void drawContent(Graphics g, int dx, int dy) {
// System.out.println("drawing tfw: "+text);
Style style = element.getComputedStyle();
Font font = style.getFont();
int textColor = style.getValue(Style.COLOR);
if (isFocused() && !element.isFocused()) {
element.setFocused();
}
boolean focus = element.isFocused();
if (indices == null) {
if (focus) {
Skin.get().fillFocusRect(g, dx, dy,
font.stringWidth(text), font.getHeight());
}
g.setColor(textColor);
g.setFont(font);
g.drawString(text, dx, dy, Graphics.TOP | Graphics.LEFT);
} else {
int y = dy + firstLineYOffset;
int clipY = g.getClipY();
int clipH = g.getClipHeight();
int fh = font.getHeight();
for (int i = 0; i < indices.length; i += 3) {
if (clipY < y + fh && y < clipY + clipH) {
int start = indices[i];
int len = indices[i + 1];
if (focus) {
Skin.get().fillFocusRect(g, dx + indices[i + 2], y,
font.substringWidth(text, start, len), font.getHeight());
}
g.setColor(textColor);
g.setFont(font);
g.drawSubstring(text, start, len, dx + indices[i + 2], y, Graphics.TOP | Graphics.LEFT);
}
y += fh;
if (i == 0) {
y += mainYOffset;
}
if (i == indices.length - 6) {
y += lastLineYOffset;
}
}
}
if (HtmlWidget.debug == this) {
g.setColor(0x00ff00);
g.drawRect(dx, dy, getWidth() - 1, getHeight() - 1);
if (getLineCount() > 1) {
int fh = font.getHeight();
int y = dy;
g.setColor(0x0ff0000);
g.drawLine(dx, y, dx, y + firstLineYOffset);
y += firstLineYOffset;
for (int i = 0; i < indices.length; i += 3) {
g.setColor(0x0000ff);
g.drawRect(dx + indices[i + 2], y,
font.substringWidth(text, indices[i], indices[i + 1]), fh - 1);
y += fh;
if (i == 0) {
g.setColor(0x0ff0000);
g.drawLine(dx + 2, y, dx + 2, y + mainYOffset);
y += mainYOffset;