public class FormattedTextSpecs extends Object
Modifier and Type | Field and Description |
---|---|
Color |
backgroundColor |
int[] |
calculatedPositions
If this is not null these will be the calculated positions of each character in a String.
|
char[] |
charsToDraw |
int |
displayLineHeight
This is the height of the line (in pixels) that the formatted text will be displayed in.
|
int |
displayLineWidth
This is the width of the line (in pixels) that the formatted text will be displayed in.
|
int |
extraSpaceUsed
The extra space used by other formatters.
|
int |
firstCharPosition
The position (in pixels) of the leftmost character on the line when displayed.
|
boolean |
isFormatted
This is used by getWidthAndPositions().
|
int |
leftMargin
Space to put before the first character on the line.
|
static int |
LINE_FLAG_CANCEL_ALIGNMENTS |
int |
lineFlags
This can be one of the LINE_FLAG_XXXX values.
|
FontMetrics |
metrics
Metrics for the text.
|
int |
numCharsToDraw |
int |
options
There are currently no options defined.
|
int |
rightMargin
The position (in pixels) of the leftmost character on the line when displayed.
|
int |
tabCharacterWidth
If this is greater than 0, it is taken to be the number of characters wide a Tab stop
will be.
|
int |
tabPixelWidth
If this is greater than 0, it is taken to be the number of pixels wide a Tab stop
will be.
|
Constructor and Description |
---|
FormattedTextSpecs() |
Modifier and Type | Method and Description |
---|---|
protected int[] |
adjustPositions(int startFrom,
int change)
Adjust the positions of the characters as currently specified by calculatedPositions.
|
int[] |
changeAndAdjustPositions(int[] newPositions,
int startFrom,
int length) |
static int |
getTabWidth(FormattedTextSpecs fts,
FontMetrics fm)
Return the tabWidth in pixels.
|
static int |
getWidthAndPositions(char[] chars,
int start,
int count,
FormattedTextSpecs fts,
FontMetrics fm,
boolean alwaysFormatted)
Calculate the positions of each character in the String.
|
static int |
getWidthAndPositions(String s,
FormattedTextSpecs fts,
FontMetrics fm,
boolean alwaysFormatted)
Calculate the positions of each character in the String.
|
int[] |
insertSpace(int beforeCharacter,
int space) |
int |
widthOf(int startFrom,
int length) |
public int options
public int tabCharacterWidth
tabPixelWidth
public int tabPixelWidth
tabCharacterWidth
public int[] calculatedPositions
public FontMetrics metrics
public boolean isFormatted
public int firstCharPosition
public int leftMargin
public int rightMargin
public int extraSpaceUsed
public int displayLineWidth
public int displayLineHeight
public char[] charsToDraw
public int numCharsToDraw
public static int LINE_FLAG_CANCEL_ALIGNMENTS
public int lineFlags
public Color backgroundColor
public static int getTabWidth(FormattedTextSpecs fts, FontMetrics fm)
public static int getWidthAndPositions(String s, FormattedTextSpecs fts, FontMetrics fm, boolean alwaysFormatted)
s
- The string to check.fts
- The FormattedTextSpecs for the calculation.fm
- The FontMetrics being used.alwaysFormatted
- if this is true consider it to always be formatted.public static int getWidthAndPositions(char[] chars, int start, int count, FormattedTextSpecs fts, FontMetrics fm, boolean alwaysFormatted)
s
- The string to check.fts
- The FormattedTextSpecs for the calculation.fm
- The FontMetrics being used.alwaysFormatted
- if this is true consider it to always be formatted.protected int[] adjustPositions(int startFrom, int change)
startFrom
- The character to start adjusting from.change
- The amount to adjust the position.public int[] insertSpace(int beforeCharacter, int space)
public int[] changeAndAdjustPositions(int[] newPositions, int startFrom, int length)
public int widthOf(int startFrom, int length)