Interface CharacterWidthFunction
-
- All Known Implementing Classes:
DefaultCharacterWidthFunction
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface CharacterWidthFunction
A function that takes a character(represented by its UTF-16 codepoint) and aStyleand returns the characters width as anint.Should return
-1if the character width is unknown to this function- Since:
- 1.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default floathandleMissing(int codepoint, net.kyori.adventure.text.format.Style style)Should be called inwidthOf(int, Style)when a non-supported codepoint is given.floatwidthOf(int codepoint, net.kyori.adventure.text.format.Style style)Gets the width for the given character(represented by its UTF-16 codepoint).
-
-
-
Method Detail
-
widthOf
float widthOf(int codepoint, net.kyori.adventure.text.format.Style style)Gets the width for the given character(represented by its UTF-16 codepoint).chars will automatically be converted to codepoints.- Since:
- 1.0.0
-
handleMissing
default float handleMissing(int codepoint, net.kyori.adventure.text.format.Style style)Should be called inwidthOf(int, Style)when a non-supported codepoint is given.- Returns:
- a
- Since:
- 1.1.0
-
-