/** * Draw the given char array using the current font and color in the x,y coordinates. The font is * drawn from the top position and not the baseline. * * @param data the array of characters to be drawn * @param offset the start offset in the data * @param length the number of characters to be drawn * @param x the x coordinate of the baseline of the text * @param y the y coordinate of the baseline of the text */ public void drawChars(char[] data, int offset, int length, int x, int y) { if (!(current instanceof CustomFont)) { drawString(new String(data, offset, length), x, y); } else { CustomFont f = (CustomFont) current; f.drawChars(this, data, offset, length, x, y); } }
/** * Draw the given char using the current font and color in the x,y coordinates. The font is drawn * from the top position and not the baseline. * * @param character - the character to be drawn * @param x the x coordinate of the baseline of the text * @param y the y coordinate of the baseline of the text */ public void drawChar(char character, int x, int y) { drawString("" + character, x, y); }
/** * Draws a string using baseline coordinates. * * @param str The string to be drawn. * @param x The x-coordinate of the start of left edge of the text block. * @param y The y-coordinate of the baseline of the text. * @param textDecoration Text decoration bitmask (See Style's TEXT_DECORATION_* constants) * @see #drawString(java.lang.String, int, int, int) */ public void drawStringBaseline(String str, int x, int y, int textDecoration) { drawString(str, x, y - current.getAscent(), textDecoration); }
/** * Draw a string using the current font and color in the x,y coordinates. The font is drawn from * the top position and not the baseline. * * @param str the string to be drawn. * @param x the x coordinate. * @param y the y coordinate. */ public void drawString(String str, int x, int y) { drawString(str, x, y, 0); }
/** * Draws a string using baseline coordinates. * * @param str The string to be drawn. * @param x The x-coordinate of the start of left edge of the text block. * @param y The y-coordinate of the baseline of the text. * @see #drawString(java.lang.String, int, int) */ public void drawStringBaseline(String str, int x, int y) { drawString(str, x, y - current.getAscent()); }