public final class JMEFontUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.lang.String |
elipsis
The string added to the end of truncated text to indicate that the entire
value is not shown.
|
javax.microedition.lcdui.Font |
font
The Font which this instance operates on
|
Modifier and Type | Method and Description |
---|---|
int |
charWidth(char c)
Find the width of the character in the specified Font.
|
static JMEFontUtils |
getFontUtils(javax.microedition.lcdui.Font font,
java.lang.String elipsis)
Get an instance for the specified Font and, for those routines that need
it, elipsis (line ending addition such as '...' to indicate that the line
was truncated)
|
java.util.Vector |
splitToLines(java.lang.String text,
int maxWidth)
Split a string in to several lines of text which will display within a
maximum width.
|
java.util.Vector |
splitToLines(java.util.Vector vector,
java.lang.String text,
int maxWidth,
boolean useKerning)
Split a string in to several lines of text which will display within a
maximum width.
|
int |
stringWidth(java.lang.String str)
Return the approximate (within a few pixels) width of a
String when rendered in the specified
Font . |
java.lang.String |
truncate(java.lang.String str,
int maxWidth,
boolean useKerning)
Truncates the string to fit the maxWidth.
|
public final javax.microedition.lcdui.Font font
public final java.lang.String elipsis
public static JMEFontUtils getFontUtils(javax.microedition.lcdui.Font font, java.lang.String elipsis)
font
- elipsis
- public int stringWidth(java.lang.String str)
String
when rendered in the specified
Font
.
Note that since nearby characters are not known, this width does not take
into account possible kerning of this character when placed next to
others in a line of text. For most purposes this is acceptable, and the
advantage of using this method vs the more precise
Font.stringWidth()
method is that this returns values which
are good enough for most purposes much more quickly.str
- public int charWidth(char c)
c
- public java.lang.String truncate(java.lang.String str, int maxWidth, boolean useKerning)
str
- maxWidth
- useKerning
- public java.util.Vector splitToLines(java.lang.String text, int maxWidth)
text
- maxWidth
- public java.util.Vector splitToLines(java.util.Vector vector, java.lang.String text, int maxWidth, boolean useKerning)
' '
and -
are considered as a line break position.vector
- - The existing vector to which the lines should be appendedtext
- maxWidth
- useKerning
-