com.b3dgs.lionengine.drawable
Interface Text


public interface Text

Text works using a Font, a size, a type (Normal, Bold...) and an alignment (Left, Centered, Right). It is also possible to change its foreground color.

See Also:
Alignment

Field Summary
static int BOLD
          Bold text.
static int ITALIC
          Italic text.
static int NORMAL
          Normal text.
 
Method Summary
 void draw(java.awt.Graphics2D g, java.lang.String text, int x, int y, Alignment alignment)
          Renders text on graphic output, to the specified location and alignment.
 int getSize()
          Get the text size in px (8px, 12px...).
 int getStringHeight(java.awt.Graphics2D g, java.lang.String str)
          Get string height size.
 int getStringWidth(java.awt.Graphics2D g, java.lang.String str)
          Get string width size.
 void setColor(java.awt.Color color)
          Set the new text color value.
 

Field Detail

NORMAL

static final int NORMAL
Normal text.

See Also:
Constant Field Values

ITALIC

static final int ITALIC
Italic text.

See Also:
Constant Field Values

BOLD

static final int BOLD
Bold text.

See Also:
Constant Field Values
Method Detail

draw

void draw(java.awt.Graphics2D g,
          java.lang.String text,
          int x,
          int y,
          Alignment alignment)
Renders text on graphic output, to the specified location and alignment.

Parameters:
g - graphic output.
text - text string.
x - horizontal location.
y - vertical location.
alignment - alignement value (LEFT, CENTERED, RIGHT).

setColor

void setColor(java.awt.Color color)
Set the new text color value.

Parameters:
color - color value.

getSize

int getSize()
Get the text size in px (8px, 12px...).

Returns:
text size as integer.

getStringWidth

int getStringWidth(java.awt.Graphics2D g,
                   java.lang.String str)
Get string width size.

Parameters:
g - graphic context.
str - input string.
Returns:
string width size.

getStringHeight

int getStringHeight(java.awt.Graphics2D g,
                    java.lang.String str)
Get string height size.

Parameters:
g - graphic context.
str - input string.
Returns:
string height size.