com.threerings.opengl.gui.text
Class StringTextFactory

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

public class StringTextFactory
extends TextFactory

Formats text by using the AWT to render runs of text into a bitmap and then texturing a quad with the result. This text factory handles a simple styled text syntax:

 @=b(this text would be bold)
 @=i(this text would be italic)
 @=s(this text would be striked-through)
 @=u(this text would be underlined)
 @=bi(this text would be bold and italic)
 @=bi#FFCC99(this text would be bold, italic and pink)
 


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
StringTextFactory(Font font, boolean antialias)
          Creates a string 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.
 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

StringTextFactory

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

Method Detail

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.