Interface PixelWidthSource

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      static @NotNull PixelWidthSource pixelWidth()
      A pixel width source calculating width.
      static @NotNull PixelWidthSource pixelWidth​(@NotNull net.kyori.adventure.text.flattener.ComponentFlattener flattener)
      A pixel width source calculating width using the provided flattener.
      static @NotNull PixelWidthSource pixelWidth​(@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 PixelWidthSource pixelWidth​(@NotNull CharacterWidthFunction characterWidthFunction)
      A pixel width source calculating width using the provided character width function.
      float width​(char character, @NotNull net.kyori.adventure.text.format.Style style)
      Calculates the pixel width of a character without any context.
      float width​(int codepoint, @NotNull net.kyori.adventure.text.format.Style style)
      Calculates the pixel width of a character represented by a codepoint without any context.
      float width​(@NotNull String string, @NotNull net.kyori.adventure.text.format.Style style)
      Calculates the pixel width of a string without any context.
      float width​(@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 text
        characterWidthFunction - 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 string
        style - 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 character
        style - 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 character
        style - the style of the character
        Returns:
        the pixel width of the character
        Since:
        1.0.0