Package net.minecraft.client.font
Class TextHandler
java.lang.Object
net.minecraft.client.font.TextHandler
@Environment(CLIENT) public class TextHandler extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classTextHandler.LineBreakingVisitor(package private) static classTextHandler.LineWrappingCollectorstatic interfaceTextHandler.LineWrappingConsumerA consumer of the line-breaking information.(package private) static classTextHandler.StyledString(package private) classTextHandler.WidthLimitingVisitorstatic interfaceTextHandler.WidthRetrieverA retriever of character width. -
Field Summary
Fields Modifier and Type Field Description private TextHandler.WidthRetrieverwidthRetriever -
Constructor Summary
Constructors Constructor Description TextHandler(TextHandler.WidthRetriever widthRetriever) -
Method Summary
Modifier and Type Method Description intgetTrimmedLength(String text, int maxWidth, Style style)Returns the length of a string when it is trimmed to be at mostmaxWidthwide.floatgetWidth(String text)Returns the width of a string.floatgetWidth(StringRenderable text)Returns the width of a text.List<StringRenderable>method_29971(StringRenderable stringRenderable, int int2, Style style, StringRenderable stringRenderable2)private StringRenderablemethod_29972(StringRenderable stringRenderable, boolean bool, StringRenderable stringRenderable2)static intmoveCursorByWords(String text, int offset, int cursor, boolean consumeSpaceOrBreak)StringtrimToWidth(String text, int maxWidth, Style style)Trim a string to be at mostmaxWidthwide.StyletrimToWidth(StringRenderable text, int maxWidth)Trim a text to be at mostmaxWidthwide.StringRenderabletrimToWidth(StringRenderable text, int width, Style style)StringtrimToWidthBackwards(String text, int maxWidth, Style style)Trim a string from right to left to be at mostmaxWidthwide.List<StringRenderable>wrapLines(String text, int maxWidth, Style style)voidwrapLines(String text, int maxWidth, Style style, boolean retainTrailingWordSplit, TextHandler.LineWrappingConsumer consumer)List<StringRenderable>wrapLines(StringRenderable stringRenderable, int maxWidth, Style style)
-
Field Details
-
Constructor Details
-
Method Details
-
getWidth
Returns the width of a string. -
getWidth
Returns the width of a text. -
getTrimmedLength
Returns the length of a string when it is trimmed to be at mostmaxWidthwide.- Parameters:
text- the string to trimmaxWidth- the max width of the trimmed stringstyle- the style of the trimmed string
-
trimToWidth
Trim a string to be at mostmaxWidthwide.- Parameters:
text- the string to trimmaxWidth- the max width of the trimmed stringstyle- the style of the trimmed string- Returns:
- the trimmed string
-
trimToWidthBackwards
Trim a string from right to left to be at mostmaxWidthwide.- Parameters:
text- the string to trimmaxWidth- the max width of the trimmed stringstyle- the style of the trimmed string- Returns:
- the trimmed string
-
trimToWidth
Trim a text to be at mostmaxWidthwide.- Parameters:
maxWidth- the max width of the trimmed text- Returns:
- the trimmed text
-
trimToWidth
-
moveCursorByWords
public static int moveCursorByWords(String text, int offset, int cursor, boolean consumeSpaceOrBreak) -
wrapLines
public void wrapLines(String text, int maxWidth, Style style, boolean retainTrailingWordSplit, TextHandler.LineWrappingConsumer consumer) -
wrapLines
-
wrapLines
public List<StringRenderable> wrapLines(StringRenderable stringRenderable, int maxWidth, Style style) -
method_29971
public List<StringRenderable> method_29971(StringRenderable stringRenderable, int int2, Style style, @Nullable StringRenderable stringRenderable2) -
method_29972
private StringRenderable method_29972(StringRenderable stringRenderable, boolean bool, StringRenderable stringRenderable2)
-