com.jme.renderer.jogl
Class JOGLFont

java.lang.Object
  extended by com.jme.renderer.jogl.JOGLFont

public class JOGLFont
extends java.lang.Object

Font2D maintains display lists for each ASCII character defined by an image. Font2D assumes that the texture is 256x256 and that the characters are 16 pixels high by 16 pixels wide. The order of the characters is also important:

After the font is loaded, it can be used with a call to print. The Font2D class is also printed in Ortho mode and billboarded, as well as depth buffering turned off. This means that the font will be placed at a two dimensional coordinate that corresponds to screen coordinates. The users is assumed to set a TextureState to the Text Geometry calling this class.

Version:
$Id: JOGLFont.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Mark Powell, Steve Vaughan - JOGL port
See Also:
Text, TextureState

Field Summary
static int ITALICS
          Sets the style of the font to italics.
static int NORMAL
          Sets the style of the font to normal.
 
Constructor Summary
JOGLFont()
          Constructor instantiates a new JOGLFont object.
 
Method Summary
 void buildDisplayList()
          buildDisplayList sets up the 256 display lists that are used to render each font character.
 void deleteFont()
          deleteFont deletes the current display list of font objects.
 void print(Renderer r, float x, float y, Vector3f scale, java.lang.StringBuffer text, int set)
          print renders the specified string to a given (x,y) location.
 void setColor(ColorRGBA color)
          setColor sets the RGBA values to render the font as.
 java.lang.String toString()
          toString returns the string representation of this font object in the Format:

jme.geometry.hud.text.Font2D@1c282a1
Color: {RGBA COLOR}
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NORMAL

public static final int NORMAL
Sets the style of the font to normal.

See Also:
Constant Field Values

ITALICS

public static final int ITALICS
Sets the style of the font to italics.

See Also:
Constant Field Values
Constructor Detail

JOGLFont

public JOGLFont()
Constructor instantiates a new JOGLFont object. The initial color is set to white.

Method Detail

deleteFont

public void deleteFont()
deleteFont deletes the current display list of font objects. The font will be useless until a call to buildDisplayLists is made.


setColor

public void setColor(ColorRGBA color)
setColor sets the RGBA values to render the font as. By default the color is white with no transparency.

Parameters:
color - the color to set.

print

public void print(Renderer r,
                  float x,
                  float y,
                  Vector3f scale,
                  java.lang.StringBuffer text,
                  int set)
print renders the specified string to a given (x,y) location. The x, y location is in terms of screen coordinates. There are currently two sets of fonts supported: NORMAL and ITALICS.

Parameters:
r -
x - the x screen location to start the string render.
y - the y screen location to start the string render.
text - the String to render.
set - the mode of font: NORMAL or ITALICS.

buildDisplayList

public void buildDisplayList()
buildDisplayList sets up the 256 display lists that are used to render each font character. Each list quad is 16x16, as defined by the font image size.


toString

public java.lang.String toString()
toString returns the string representation of this font object in the Format:

jme.geometry.hud.text.Font2D@1c282a1
Color: {RGBA COLOR}

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this object.