@Environment(value=CLIENT) class TextHandler.LineBreakingVisitor extends Object implements CharacterVisitor
Modifier and Type | Field and Description |
---|---|
private int |
count |
private int |
endIndex |
private Style |
endStyle |
private int |
lastSpaceBreak |
private Style |
lastSpaceStyle |
private float |
maxWidth |
private boolean |
nonEmpty |
private int |
startOffset |
private float |
totalWidth |
Constructor and Description |
---|
LineBreakingVisitor(float maxWidth) |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(int index,
Style style,
int codePoint)
Visits a single character.
|
private boolean |
breakLine(int finishIndex,
Style finishStyle) |
int |
getEndingIndex() |
Style |
getEndingStyle() |
private boolean |
hasLineBreak() |
void |
offset(int extraOffset) |
private final float maxWidth
private int endIndex
private Style endStyle
private boolean nonEmpty
private float totalWidth
private int lastSpaceBreak
private Style lastSpaceStyle
private int count
private int startOffset
public boolean accept(int index, Style style, int codePoint)
Multiple surrogate characters are converted into one single codePoint
when passed into this method.
accept
in interface CharacterVisitor
index
- the current index of the characterstyle
- the style of the character, containing formatting and font informationcodePoint
- the code point of the charactertrue
to continue visiting other characters, or false
to terminate the visitprivate boolean breakLine(int finishIndex, Style finishStyle)
private boolean hasLineBreak()
public int getEndingIndex()
public Style getEndingStyle()
public void offset(int extraOffset)