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 a Style and returns the characters width as an int.

    Should return -1 if the character width is unknown to this function

    Since:
    1.0.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      float widthOf​(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