|
|||||||||
| 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 java.util.Map<java.awt.font.TextAttribute,java.awt.Font> |
_attrs
|
protected java.util.Map<AWTTextFactory.GlowKey,java.awt.image.BufferedImage> |
_cachedGlowBGs
|
protected java.util.Map<AWTTextFactory.GlowKey,java.awt.image.BufferedImage> |
_cachedGlowFGs
|
protected AWTTextFactory.GlowKey |
_gkey
|
protected int |
_height
|
protected static boolean |
_isMacOS
|
protected java.awt.image.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 |
|---|
DEFAULT_SIZE, DEFAULT_SPACING |
| Constructor Summary | |
|---|---|
AWTTextFactory(java.awt.Font font,
boolean antialias)
Creates an AWT text factory with the supplied font. |
|
| Method Summary | |
|---|---|
protected int |
computeWidth(char c)
Helper function. |
BText |
createText(java.lang.String text,
com.jme.renderer.ColorRGBA color,
TextEffect effect,
int effectSize,
com.jme.renderer.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(java.lang.String origText,
java.awt.font.TextLayout layout,
com.jme.renderer.ColorRGBA color,
TextEffect effect,
int effectSize,
com.jme.renderer.ColorRGBA effectColor,
int length,
boolean useAdvance)
Helper function. |
protected java.awt.image.BufferedImage |
getGlowBackground(char c,
int height,
com.jme.renderer.ColorRGBA color,
int effectSize)
Helper function. |
protected java.awt.image.BufferedImage |
getGlowForeground(char c,
int height,
com.jme.renderer.ColorRGBA color,
int effectSize)
Helper function. |
int |
getHeight()
Returns the height of our text. |
protected java.text.AttributedString |
parseStyledText(java.lang.String text,
java.util.Map<java.awt.font.TextAttribute,java.awt.Font> attrs,
java.lang.String[] bare,
boolean style)
Parses our simple styled text formatting codes and creates an attributed string to render them. |
BText[] |
wrapText(java.lang.String text,
com.jme.renderer.ColorRGBA color,
TextEffect effect,
int effectSize,
com.jme.renderer.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, wrapText, wrapText |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean _antialias
protected java.util.Map<java.awt.font.TextAttribute,java.awt.Font> _attrs
protected int _height
protected java.awt.image.BufferedImage _stub
protected java.util.Map<AWTTextFactory.GlowKey,java.awt.image.BufferedImage> _cachedGlowBGs
protected java.util.Map<AWTTextFactory.GlowKey,java.awt.image.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(java.awt.Font font,
boolean antialias)
| Method Detail |
|---|
public int getHeight()
BTextFactory
getHeight in class BTextFactory
public BText createText(java.lang.String text,
com.jme.renderer.ColorRGBA color,
TextEffect effect,
int effectSize,
com.jme.renderer.ColorRGBA effectColor,
boolean useAdvance)
BTextFactory
createText in class BTextFactoryuseAdvance - if true, the advance to the next insertion point will be included in the
public BText[] wrapText(java.lang.String text,
com.jme.renderer.ColorRGBA color,
TextEffect effect,
int effectSize,
com.jme.renderer.ColorRGBA effectColor,
int maxWidth)
BTextFactory
wrapText in class BTextFactory
protected BText createText(java.lang.String origText,
java.awt.font.TextLayout layout,
com.jme.renderer.ColorRGBA color,
TextEffect effect,
int effectSize,
com.jme.renderer.ColorRGBA effectColor,
int length,
boolean useAdvance)
protected java.awt.image.BufferedImage getGlowBackground(char c,
int height,
com.jme.renderer.ColorRGBA color,
int effectSize)
protected java.awt.image.BufferedImage getGlowForeground(char c,
int height,
com.jme.renderer.ColorRGBA color,
int effectSize)
protected int computeWidth(char c)
protected java.text.AttributedString parseStyledText(java.lang.String text,
java.util.Map<java.awt.font.TextAttribute,java.awt.Font> attrs,
java.lang.String[] bare,
boolean style)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||