|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.opengl.gui.text.TextFactory
com.threerings.opengl.gui.text.StringTextFactory
public class StringTextFactory
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)
| Nested Class Summary | |
|---|---|
protected static class |
StringTextFactory.GlowKey
|
protected static class |
StringTextFactory.StyleRun
|
| Field Summary | |
|---|---|
protected boolean |
_antialias
|
protected Map<TextAttribute,Font> |
_attrs
|
protected Map<StringTextFactory.GlowKey,BufferedImage> |
_cachedGlowBGs
|
protected Map<StringTextFactory.GlowKey,BufferedImage> |
_cachedGlowFGs
|
protected StringTextFactory.GlowKey |
_gkey
|
protected int |
_height
|
protected static boolean |
_isMacOS
|
protected BufferedImage |
_stub
|
protected static char |
BOLD
|
protected static char |
COLOR
|
protected static char |
ITALIC
|
protected static char |
NONE
|
protected static char |
STRIKE
|
protected static char |
UNDERLINE
|
| 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 | |
|---|---|
protected int |
computeWidth(char c)
Helper function. |
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. |
protected Text |
createText(String origText,
TextLayout layout,
Color4f color,
int effect,
int effectSize,
Color4f effectColor,
int length,
boolean useAdvance)
Helper function. |
protected BufferedImage |
getGlowBackground(char c,
int height,
Color4f color,
int effectSize)
Helper function. |
protected BufferedImage |
getGlowForeground(char c,
int height,
Color4f color,
int effectSize)
Helper function. |
int |
getHeight()
Returns the height of our text. |
protected AttributedString |
parseStyledText(String text,
Map<TextAttribute,Font> attrs,
String[] bare,
boolean style)
Parses our simple styled text formatting codes and creates an attributed string to render them. |
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 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean _antialias
protected int _height
protected BufferedImage _stub
protected Map<TextAttribute,Font> _attrs
protected Map<StringTextFactory.GlowKey,BufferedImage> _cachedGlowBGs
protected Map<StringTextFactory.GlowKey,BufferedImage> _cachedGlowFGs
protected StringTextFactory.GlowKey _gkey
protected static boolean _isMacOS
protected static final char NONE
protected static final char BOLD
protected static final char ITALIC
protected static final char UNDERLINE
protected static final char STRIKE
protected static final char COLOR
| Constructor Detail |
|---|
public StringTextFactory(Font font,
boolean antialias)
| Method Detail |
|---|
public int getHeight()
TextFactory
getHeight in class TextFactory
public Text createText(String text,
Color4f color,
int effect,
int effectSize,
Color4f effectColor,
boolean useAdvance)
TextFactory
createText in class TextFactoryuseAdvance - 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).
public Text[] wrapText(String text,
Color4f color,
int effect,
int effectSize,
Color4f effectColor,
int maxWidth)
TextFactory
wrapText in class TextFactory
protected Text createText(String origText,
TextLayout layout,
Color4f color,
int effect,
int effectSize,
Color4f effectColor,
int length,
boolean useAdvance)
protected BufferedImage getGlowBackground(char c,
int height,
Color4f color,
int effectSize)
protected BufferedImage getGlowForeground(char c,
int height,
Color4f color,
int effectSize)
protected int computeWidth(char c)
protected AttributedString parseStyledText(String text,
Map<TextAttribute,Font> attrs,
String[] bare,
boolean style)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||