Package solar.squares.pixelwidth
Interface PixelWidthSource
-
- All Known Subinterfaces:
ContextualPixelWidthSource<CX>
public interface PixelWidthSourceA source able to return the width of text with the usage ofCharacterWidthFunctions.- Since:
- 1.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static @NotNull PixelWidthSourcepixelWidth()A pixel width source calculating width.static @NotNull PixelWidthSourcepixelWidth(@NotNull net.kyori.adventure.text.flattener.ComponentFlattener flattener)A pixel width source calculating width using the provided flattener.static @NotNull PixelWidthSourcepixelWidth(@NotNull net.kyori.adventure.text.flattener.ComponentFlattener flattener, @NotNull CharacterWidthFunction characterWidthFunction)A pixel width source calculating width using the provided flattener and character width function.static @NotNull PixelWidthSourcepixelWidth(@NotNull CharacterWidthFunction characterWidthFunction)A pixel width source calculating width using the provided character width function.floatwidth(char character, @NotNull net.kyori.adventure.text.format.Style style)Calculates the pixel width of a character without any context.floatwidth(int codepoint, @NotNull net.kyori.adventure.text.format.Style style)Calculates the pixel width of a character represented by a codepoint without any context.floatwidth(@NotNull String string, @NotNull net.kyori.adventure.text.format.Style style)Calculates the pixel width of a string without any context.floatwidth(@NotNull net.kyori.adventure.text.Component component)Calculates the pixel width of a component without any context.
-
-
-
Method Detail
-
pixelWidth
@NotNull static @NotNull PixelWidthSource pixelWidth()
A pixel width source calculating width. Returns a static instance.- Returns:
- a pixel width source
- Since:
- 1.0.0
-
pixelWidth
@NotNull static @NotNull PixelWidthSource pixelWidth(@NotNull @NotNull net.kyori.adventure.text.flattener.ComponentFlattener flattener)
A pixel width source calculating width using the provided flattener.- Parameters:
flattener- used to turn components into linear text- Returns:
- a pixel width source
- Since:
- 1.0.0
-
pixelWidth
@NotNull static @NotNull PixelWidthSource pixelWidth(@NotNull @NotNull CharacterWidthFunction characterWidthFunction)
A pixel width source calculating width using the provided character width function.- Parameters:
characterWidthFunction- used to get width values for each character- Returns:
- a pixel width source
- Since:
- 1.0.0
-
pixelWidth
@NotNull static @NotNull PixelWidthSource pixelWidth(@NotNull @NotNull net.kyori.adventure.text.flattener.ComponentFlattener flattener, @NotNull @NotNull CharacterWidthFunction characterWidthFunction)
A pixel width source calculating width using the provided flattener and character width function.- Parameters:
flattener- used to turn components into linear textcharacterWidthFunction- used to get width values for each character- Returns:
- a pixel width source
- Since:
- 1.0.0
-
width
float width(@NotNull @NotNull net.kyori.adventure.text.Component component)Calculates the pixel width of a component without any context.- Parameters:
component- a component- Returns:
- the pixel width of the component
- Since:
- 1.0.0
-
width
float width(@NotNull @NotNull String string, @NotNull @NotNull net.kyori.adventure.text.format.Style style)Calculates the pixel width of a string without any context.- Parameters:
string- a stringstyle- the style of the string- Returns:
- the pixel width of the string
- Since:
- 1.0.0
-
width
float width(char character, @NotNull @NotNull net.kyori.adventure.text.format.Style style)Calculates the pixel width of a character without any context.- Parameters:
character- a characterstyle- the style of the character- Returns:
- the pixel width of the character
- Since:
- 1.0.0
-
width
float width(int codepoint, @NotNull @NotNull net.kyori.adventure.text.format.Style style)Calculates the pixel width of a character represented by a codepoint without any context.- Parameters:
codepoint- a codepoint representing a characterstyle- the style of the character- Returns:
- the pixel width of the character
- Since:
- 1.0.0
-
-