Interface IShapingTextWrapperMutator<Self extends IShapingTextWrapperMutator<Self>>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Self breakAnywhereIfNeeded​(boolean breakAnywhereIfNeeded)
      Whether to break lines at any character if necessary, regardless of whether a line break is allowed.
      Self ellipsis​(String ellipsis)
      When set to a non-empty string and max height is set, then, if the text is too long to fit, appends the given ellipsis string to the end of the last line.
      Self intrinsicLineHeight()
      Sets the height of each line to the intrinsic height as requested by the font.
      Self lineHeight​(double lineHeight)
      Sets the height of each line, relative to the font size.
      Self maxHeight​(double maxHeight)
      Sets the maximum height in units of font size for the wrapped text.
      Self maxLines​(int maxLines)
      Sets the maximum number of lines for the wrapped text.
      Self maxWidth​(double maxWidth)
      Sets the maximum width in units of font size for the wrapped text.
      Self trimLines​(boolean trimLines)
      Whether to trim spaces from the beginning and end of each line.
    • Method Detail

      • breakAnywhereIfNeeded

        Self breakAnywhereIfNeeded​(boolean breakAnywhereIfNeeded)
        Whether to break lines at any character if necessary, regardless of whether a line break is allowed. When true and an unbreakable word is too long to fit on a line (see maxWidth(double) max width), the word will be broken after the last character that fits on the line. When false, the output will contain an overlong line that exceed the maximum width. Defaults to true.
        Parameters:
        breakAnywhereIfNeeded - Whether to break lines at any character.
        Returns:
        This builder for chaining method calls.
      • ellipsis

        Self ellipsis​(String ellipsis)
        When set to a non-empty string and max height is set, then, if the text is too long to fit, appends the given ellipsis string to the end of the last line. This may remove a few more additional characters, so that the ellipsis fits on the line. The ellipsis string is counted towards the computed width of the last line. When set to an empty string, no ellipsis is appended and the last line simply gets cut off. Defaults to no ellipsis.
        Parameters:
        ellipsis - The ellipsis string to append to the last line if it is too long, e.g. "..." or "…".
        Returns:
        This builder for chaining method calls.
      • intrinsicLineHeight

        Self intrinsicLineHeight()
        Sets the height of each line to the intrinsic height as requested by the font.
        Returns:
        This builder for chaining method calls.
      • lineHeight

        Self lineHeight​(double lineHeight)
        Sets the height of each line, relative to the font size. A value of 1.0 means that the line height is equal to the font size. A value of 1.5 means that the line height is 150% of the font size. Defaults to the intrinsic line height of the font file.
        Parameters:
        lineHeight - The height of each line, relative to the font size.
        Returns:
        This builder for chaining method calls.
      • maxHeight

        Self maxHeight​(double maxHeight)
        Sets the maximum height in units of font size for the wrapped text. Lines that exceed this height will be omitted. Defaults to no limit (infinity).
        Parameters:
        maxHeight - The maximum height in units of font size.
        Returns:
        This builder for chaining method calls.
      • maxLines

        Self maxLines​(int maxLines)
        Sets the maximum number of lines for the wrapped text. If the text exceeds this number of lines, it will be omitted. Defaults to no limit (max value).

        When both max lines and max height are set, the text will be cut off at the smaller of the two limits. For example, if max lines is set to 3 and max height is set to 60, the text will be cut off at 3 lines, even if the height of those 3 lines is less than 60.

        Parameters:
        maxLines - The maximum number of lines.
        Returns:
        This builder for chaining method calls.
      • maxWidth

        Self maxWidth​(double maxWidth)
        Sets the maximum width in units of font size for the wrapped text. If a line exceeds this width, it will be wrapped, i.e. a line break will be inserted. Defaults to no limit (infinity).
        Parameters:
        maxWidth - The maximum width in units of font size.
        Returns:
        This builder for chaining method calls.
      • trimLines

        Self trimLines​(boolean trimLines)
        Whether to trim spaces from the beginning and end of each line. Defaults to true.
        Parameters:
        trimLines - Whether to trim spaces from the beginning and end of each line.
        Returns:
        This builder for chaining method calls.