|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jmex.bui.text.BTextFactory
com.jmex.bui.text.AWTTextFactory
public class AWTTextFactory
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 |
AWTTextFactory.GlowKey
|
protected static class |
AWTTextFactory.StyleRun
|
| Field Summary | |
|---|---|
protected boolean |
_antialias
|
protected Map<TextAttribute,Font> |
_attrs
|
protected Map<AWTTextFactory.GlowKey,BufferedImage> |
_cachedGlowBGs
|
protected Map<AWTTextFactory.GlowKey,BufferedImage> |
_cachedGlowFGs
|
protected AWTTextFactory.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.jmex.bui.BConstants |
|---|
BOTTOM, CENTER, DEFAULT_SIZE, DEFAULT_SPACING, GLOW, HORIZONTAL, LEFT, NORMAL, OUTLINE, OVERLAPPING, PLAIN, RIGHT, SHADOW, TOP, VERTICAL |
| Constructor Summary | |
|---|---|
AWTTextFactory(Font font,
boolean antialias)
Creates an AWT text factory with the supplied font. |
|
| Method Summary | |
|---|---|
protected int |
computeWidth(char c)
Helper function. |
BText |
createText(String text,
ColorRGBA color,
int effect,
int effectSize,
ColorRGBA 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 BText |
createText(String origText,
TextLayout layout,
ColorRGBA color,
int effect,
int effectSize,
ColorRGBA effectColor,
int length,
boolean useAdvance)
Helper function. |
protected BufferedImage |
getGlowBackground(char c,
int height,
ColorRGBA color,
int effectSize)
Helper function. |
protected BufferedImage |
getGlowForeground(char c,
int height,
ColorRGBA 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. |
BText[] |
wrapText(String text,
ColorRGBA color,
int effect,
int effectSize,
ColorRGBA effectColor,
int maxWidth)
Wraps a string into a set of text objects that do not exceed the specified width. |
| Methods inherited from class com.jmex.bui.text.BTextFactory |
|---|
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<AWTTextFactory.GlowKey,BufferedImage> _cachedGlowBGs
protected Map<AWTTextFactory.GlowKey,BufferedImage> _cachedGlowFGs
protected AWTTextFactory.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 AWTTextFactory(Font font,
boolean antialias)
| Method Detail |
|---|
public int getHeight()
BTextFactory
getHeight in class BTextFactory
public BText createText(String text,
ColorRGBA color,
int effect,
int effectSize,
ColorRGBA effectColor,
boolean useAdvance)
BTextFactory
createText in class BTextFactoryuseAdvance - 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 BText[] wrapText(String text,
ColorRGBA color,
int effect,
int effectSize,
ColorRGBA effectColor,
int maxWidth)
BTextFactory
wrapText in class BTextFactory
protected BText createText(String origText,
TextLayout layout,
ColorRGBA color,
int effect,
int effectSize,
ColorRGBA effectColor,
int length,
boolean useAdvance)
protected BufferedImage getGlowBackground(char c,
int height,
ColorRGBA color,
int effectSize)
protected BufferedImage getGlowForeground(char c,
int height,
ColorRGBA 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 | ||||||||