Module tvbrowser
Package util.misc

Class TextLineBreakerStringWidth

  • Direct Known Subclasses:
    TextLineBreakerFontWidth

    public class TextLineBreakerStringWidth
    extends java.lang.Object
    Breaks a text into lines.
    Author:
    Til Schneider, www.murfman.de
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ELLIPSIS
      ellipsis used for shortened titles and descriptions
      unicode character representing "..."
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String[] breakLines​(java.io.Reader textReader, int width)
      Break a Text into separate Lines
      java.lang.String[] breakLines​(java.io.Reader textReader, int width, int maxLines)
      Break a Text into separate Lines
      int getStringWidth​(java.lang.String str)
      Get the Width of a String
      static void resetHyphenator()
      to be used by Settings.handleChangedSettings()
      void setMinusWidth​(int minusWidth)
      Set the Width of a Minus Character
      void setSpaceWidth​(int spaceWidth)
      Set the Width of a Space Character
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ELLIPSIS

        public static final java.lang.String ELLIPSIS
        ellipsis used for shortened titles and descriptions
        unicode character representing "..."
        See Also:
        Constant Field Values
    • Constructor Detail

      • TextLineBreakerStringWidth

        public TextLineBreakerStringWidth()
        Create the LineBreaker
    • Method Detail

      • setSpaceWidth

        public void setSpaceWidth​(int spaceWidth)
        Set the Width of a Space Character
        Parameters:
        spaceWidth - new Space-Width
      • setMinusWidth

        public void setMinusWidth​(int minusWidth)
        Set the Width of a Minus Character
        Parameters:
        minusWidth - new Minus-Width
      • breakLines

        public java.lang.String[] breakLines​(java.io.Reader textReader,
                                             int width)
                                      throws java.io.IOException
        Break a Text into separate Lines
        Parameters:
        textReader - Text to separate
        width - Max-Width of each Line
        Returns:
        Text split in separate Lines
        Throws:
        java.io.IOException - Thrown if an IO operation went wrong.
      • breakLines

        public java.lang.String[] breakLines​(java.io.Reader textReader,
                                             int width,
                                             int maxLines)
                                      throws java.io.IOException
        Break a Text into separate Lines
        Parameters:
        textReader - Text to separate
        width - Max-Width of each Line
        maxLines - Max. amount of Lines
        Returns:
        Text split in separate Lines
        Throws:
        java.io.IOException - Thrown if an IO operation went wrong.
      • getStringWidth

        public int getStringWidth​(java.lang.String str)
        Get the Width of a String
        Parameters:
        str - get Width of this String
        Returns:
        Width of this String
      • resetHyphenator

        public static void resetHyphenator()
        to be used by Settings.handleChangedSettings()