@Environment(value=CLIENT) public class TextHandler extends Object
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
TextHandler.class_5345 |
(package private) class |
TextHandler.LineBreakingVisitor |
(package private) static class |
TextHandler.LineWrappingCollector |
static interface |
TextHandler.LineWrappingConsumer
A consumer of the line-breaking information.
|
(package private) class |
TextHandler.WidthLimitingVisitor |
static interface |
TextHandler.WidthRetriever
A retriever of character width.
|
| Modifier and Type | Field and Description |
|---|---|
private TextHandler.WidthRetriever |
widthRetriever |
| Constructor and Description |
|---|
TextHandler(TextHandler.WidthRetriever widthRetriever) |
| Modifier and Type | Method and Description |
|---|---|
int |
getTrimmedLength(String text,
int maxWidth,
Style style)
Returns the length of a string when it is trimmed to be at most
maxWidth wide. |
float |
getWidth(class_5348 class_5348)
Returns the width of a text.
|
float |
getWidth(String text)
Returns the width of a string.
|
static int |
moveCursorByWords(String text,
int offset,
int cursor,
boolean consumeSpaceOrBreak) |
Style |
trimToWidth(class_5348 class_5348,
int maxWidth)
Trim a text to be at most
maxWidth wide. |
class_5348 |
trimToWidth(class_5348 class_5348,
int width,
Style style) |
String |
trimToWidth(String text,
int maxWidth,
Style style)
Trim a string to be at most
maxWidth wide. |
String |
trimToWidthBackwards(String text,
int maxWidth,
Style style)
Trim a string from right to left to be at most
maxWidth wide. |
List<class_5348> |
wrapLines(class_5348 class_5348,
int maxWidth,
Style style) |
List<class_5348> |
wrapLines(String text,
int maxWidth,
Style style) |
void |
wrapLines(String text,
int maxWidth,
Style style,
boolean retainTrailingWordSplit,
TextHandler.LineWrappingConsumer consumer) |
private final TextHandler.WidthRetriever widthRetriever
public TextHandler(TextHandler.WidthRetriever widthRetriever)
public float getWidth(class_5348 class_5348)
public int getTrimmedLength(String text, int maxWidth, Style style)
maxWidth wide.text - the string to trimmaxWidth - the max width of the trimmed stringstyle - the style of the trimmed stringpublic String trimToWidth(String text, int maxWidth, Style style)
maxWidth wide.text - the string to trimmaxWidth - the max width of the trimmed stringstyle - the style of the trimmed stringpublic String trimToWidthBackwards(String text, int maxWidth, Style style)
maxWidth wide.text - the string to trimmaxWidth - the max width of the trimmed stringstyle - the style of the trimmed string@Nullable public Style trimToWidth(class_5348 class_5348, int maxWidth)
maxWidth wide.maxWidth - the max width of the trimmed textpublic class_5348 trimToWidth(class_5348 class_5348, int width, Style style)
public static int moveCursorByWords(String text, int offset, int cursor, boolean consumeSpaceOrBreak)
public void wrapLines(String text, int maxWidth, Style style, boolean retainTrailingWordSplit, TextHandler.LineWrappingConsumer consumer)
public List<class_5348> wrapLines(String text, int maxWidth, Style style)
public List<class_5348> wrapLines(class_5348 class_5348, int maxWidth, Style style)