public class

Text

extends Element
java.lang.Object
   ↳ casmi.graphics.element.Element
     ↳ casmi.graphics.element.Text

Class Overview

Text class. Wrap JOGL and make it easy to use.

Summary

[Expand]
Inherited Fields
From class casmi.graphics.element.Element
Public Constructors
Text()
Creates a new Text object.
Text(String text)
Creates a new Text object using letters to be displayed.
Text(String text, Font font)
Creates a new Text object using letters to be displayed, and Font.
Text(String text, double x, double y)
Creates a new Text object using letters to be displayed, x,y-coordinate.
Text(String text, Font font, double x, double y)
Creates a new Text object using letters to be displayed, x,y-coordinate and Font.
Text(String text, double x, double y, double z)
Creates a new Text object using letters to be displayed, x,y,z-coordinate.
Text(String text, Font font, double x, double y, double z)
Creates a new Text object using letters to be displayed, x,y,z-coordinate and Font.
Public Methods
final TextAlign getAlign()
Returns the current alignment for drawing text.
final double getAscent()
Returns ascent of the current font at its current size.
final double getAscent(int line)
Returns ascent of the current font at its current size and line.
final double getDescent()
Returns descent of the current font at its current size.
final double getDescent(int line)
Returns descent of the current font at its current size and line.
final Font getFont()
Returns the Font of this Text.
final double getHeight(int line)
Returns letter's height of the current font at its current size and line.
final double getHeight()
Returns letter's height of the current font at its current size.
final TextLayout getLayout()
Returns the TextLayout of this Text.
final TextLayout getLayout(int line)
Returns the TextLayout of the i line.
double getLeading()
Returns the leading of this letters.
int getLine()
TextRenderer getRenderer()
Returns the TextRenderer of this Text.
String getText()
Returns the letters of this Text.
final double getWidth(int line)
Returns letter's width of the current font at its current size and line.
final double getWidth()
Returns letter's width of the current font at its current size.
boolean isEnableTexture()
Check texture is enable or not.
void render(GL2 gl, GLU glu, int width, int height, boolean selection)
void reset(GL2 gl)
void setAlign(TextAlign align)
Sets the current alignment for drawing text.
final void setFont(Font font)
Sets the Font of this Text.
void setLeading(double leading)
void setText(String str)
Sets the letters of this Text.
Protected Methods
String[] getArrayText()
void setArrayText(String str)
[Expand]
Inherited Methods
From class casmi.graphics.element.Element
From class java.lang.Object
From interface casmi.graphics.object.Renderable
From interface casmi.graphics.object.Resettable

Public Constructors

public Text ()

Creates a new Text object.

public Text (String text)

Creates a new Text object using letters to be displayed.

Parameters
text The letters to be displayed.

public Text (String text, Font font)

Creates a new Text object using letters to be displayed, and Font.

Parameters
text The letters to be displayed.
font The font of text.

public Text (String text, double x, double y)

Creates a new Text object using letters to be displayed, x,y-coordinate.

Parameters
text The letters to be displayed.
x The x-coordinate of text.
y The y-coordinate of text.

public Text (String text, Font font, double x, double y)

Creates a new Text object using letters to be displayed, x,y-coordinate and Font.

Parameters
text The letters to be displayed.
font The font of text.
x The x-coordinate of text.
y The y-coordinate of text.

public Text (String text, double x, double y, double z)

Creates a new Text object using letters to be displayed, x,y,z-coordinate.

Parameters
text The letters to be displayed.
x The x-coordinate of text.
y The y-coordinate of text.
z The z-coordinate of text.

public Text (String text, Font font, double x, double y, double z)

Creates a new Text object using letters to be displayed, x,y,z-coordinate and Font.

Parameters
text The letters to be displayed.
font The font of text.
x The x-coordinate of text.
y The y-coordinate of text.
z The z-coordinate of text.

Public Methods

public final TextAlign getAlign ()

Returns the current alignment for drawing text. The parameters LEFT, CENTER, and RIGHT set the display characteristics of the letters in relation to the values for the x and y parameters of the text() function.

Returns
  • The TextAlign of the text.

public final double getAscent ()

Returns ascent of the current font at its current size.

Returns
  • The ascent of text.

public final double getAscent (int line)

Returns ascent of the current font at its current size and line.

Parameters
line The number of lines.
Returns
  • The ascent of text.

public final double getDescent ()

Returns descent of the current font at its current size.

Returns
  • The descent of text.

public final double getDescent (int line)

Returns descent of the current font at its current size and line.

Parameters
line The number of lines.
Returns
  • The descent of text.

public final Font getFont ()

Returns the Font of this Text.

Returns
  • The Font of the Text.

public final double getHeight (int line)

Returns letter's height of the current font at its current size and line.

Parameters
line The number of lines.
Returns
  • The letter's height.
Throws
GLException If the textRenderer is not valid; calls the reset method and creates a new textRenderer.

public final double getHeight ()

Returns letter's height of the current font at its current size.

Returns
  • The letter's height.

public final TextLayout getLayout ()

Returns the TextLayout of this Text.

Returns
  • The TextLayout of this Text.

public final TextLayout getLayout (int line)

Returns the TextLayout of the i line.

Parameters
line The number of lines.
Returns
  • The TextLayout of the i line.

public double getLeading ()

Returns the leading of this letters.

Returns
  • The leading of this Text.

public int getLine ()

public TextRenderer getRenderer ()

Returns the TextRenderer of this Text.

Returns
  • The TextRenderer of this Text.

public String getText ()

Returns the letters of this Text.

Returns
  • The letters of this Text.

public final double getWidth (int line)

Returns letter's width of the current font at its current size and line.

Parameters
line The number of lines.
Returns
  • The letter's width.
Throws
GLException If the textRenderer is not valid; calls the reset method and creates a new textRenderer.

public final double getWidth ()

Returns letter's width of the current font at its current size.

Returns
  • The letter's width.

public boolean isEnableTexture ()

Check texture is enable or not.

public void render (GL2 gl, GLU glu, int width, int height, boolean selection)

public void reset (GL2 gl)

public void setAlign (TextAlign align)

Sets the current alignment for drawing text. The parameters LEFT, CENTER, and RIGHT set the display characteristics of the letters in relation to the values for the x and y parameters of the text() function.

Parameters
align Either LEFT, CENTER or LIGHT.

public final void setFont (Font font)

Sets the Font of this Text.

Parameters
font The Font of the Text.

public void setLeading (double leading)

public void setText (String str)

Sets the letters of this Text.

Parameters
str The letters to be displayed.

Protected Methods

protected String[] getArrayText ()

protected void setArrayText (String str)