com.threerings.opengl.gui.text
Class CharacterTextFactory

java.lang.Object
  extended by com.threerings.opengl.gui.text.TextFactory
      extended by com.threerings.opengl.gui.text.CharacterTextFactory
All Implemented Interfaces:
UIConstants

public class CharacterTextFactory
extends TextFactory
implements UIConstants

Formats text by rendering individual characters into a set of shared textures, then returning Text instances that render groups of quads, one for each character.


Field Summary
 
Fields inherited from interface com.threerings.opengl.gui.UIConstants
BOTTOM, CENTER, DEFAULT_SIZE, DEFAULT_SPACING, GLOW, HORIZONTAL, LEFT, NORMAL, OUTLINE, OVERLAPPING, PLAIN, RIGHT, SHADOW, TOP, VERTICAL
 
Constructor Summary
CharacterTextFactory(Font font, boolean antialias)
          Creates a character text factory with the supplied font.
 
Method Summary
 Text createText(String text, Color4f color, int effect, int effectSize, Color4f effectColor, boolean useAdvance)
          Creates a text instance using our the font configuration associated with this text factory and the foreground color, text effect and text effect color specified.
 int getHeight()
          Returns the height of our text.
static CharacterTextFactory getInstance(Font font, boolean antialias)
          Returns a shared factory instance.
 void render(Renderer renderer, String text, int x, int y, Color4f color)
          Renders a string directly, without creating a text object.
 Text[] wrapText(String text, Color4f color, int effect, int effectSize, Color4f effectColor, int maxWidth)
          Wraps a string into a set of text objects that do not exceed the specified width.
 
Methods inherited from class com.threerings.opengl.gui.text.TextFactory
createText
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharacterTextFactory

public CharacterTextFactory(Font font,
                            boolean antialias)
Creates a character text factory with the supplied font.

Method Detail

getInstance

public static CharacterTextFactory getInstance(Font font,
                                               boolean antialias)
Returns a shared factory instance.


render

public void render(Renderer renderer,
                   String text,
                   int x,
                   int y,
                   Color4f color)
Renders a string directly, without creating a text object.


getHeight

public int getHeight()
Description copied from class: TextFactory
Returns the height of our text.

Specified by:
getHeight in class TextFactory

createText

public Text createText(String text,
                       Color4f color,
                       int effect,
                       int effectSize,
                       Color4f effectColor,
                       boolean useAdvance)
Description copied from class: TextFactory
Creates a text instance using our the font configuration associated with this text factory and the foreground color, text effect and text effect color specified.

Specified by:
createText in class TextFactory
useAdvance - if true, the advance to the next insertion point will be included in the bounds of the created text (this is needed by editable text displays).

wrapText

public Text[] wrapText(String text,
                       Color4f color,
                       int effect,
                       int effectSize,
                       Color4f effectColor,
                       int maxWidth)
Description copied from class: TextFactory
Wraps a string into a set of text objects that do not exceed the specified width.

Specified by:
wrapText in class TextFactory


Copyright © 2011. All Rights Reserved.