Class TextStyle

  • Direct Known Subclasses:
    CSSTextStyle

    public class TextStyle
    extends Object
    This class represent the statistics about text style of a content rectangle.
    Author:
    burgetr
    • Constructor Detail

      • TextStyle

        public TextStyle()
      • TextStyle

        public TextStyle​(TextStyle src)
    • Method Detail

      • getFontSize

        public float getFontSize()
        Obtains an average font size in the are in pixels.
        Returns:
        the average font pixel size
      • getFontWeight

        public float getFontWeight()
        Obtains the average font style. 0 means no text is bold, 1 means all the text is bold.
        Returns:
        a value in the range 0..1
      • getFontStyle

        public float getFontStyle()
        Obtains the average font style. 0 means no text in italics, 1 means all the text in italics.
        Returns:
        a value in the range 0..1
      • getUnderline

        public float getUnderline()
        Obtains the amount of underlined text. 0 means no underlined text, 1 means all the text is underlined.
        Returns:
        a value in the range 0..1
      • getLineThrough

        public float getLineThrough()
        Obtains the amount of line-through text. 0 means no underlined text, 1 means all the text is underlined.
        Returns:
        a value in the range 0..1
      • getFontSizeSum

        public float getFontSizeSum()
        Returns the sum of all elements the average style is computed from.
        Returns:
        the style sum
      • setFontSizeSum

        public void setFontSizeSum​(float fontSizeSum)
      • getFontWeightSum

        public float getFontWeightSum()
        Returns the sum of all elements the average style is computed from.
        Returns:
        the style sum
      • setFontWeightSum

        public void setFontWeightSum​(float fontWeightSum)
      • getFontStyleSum

        public float getFontStyleSum()
        Returns the sum of all elements the average style is computed from.
        Returns:
        the style sum
      • setFontStyleSum

        public void setFontStyleSum​(float fontStyleSum)
      • getUnderlineSum

        public float getUnderlineSum()
        Returns the sum of all elements the average style is computed from.
        Returns:
        the style sum
      • setUnderlineSum

        public void setUnderlineSum​(float underlineSum)
      • getLineThroughSum

        public float getLineThroughSum()
        Returns the sum of all elements the average style is computed from.
        Returns:
        the style sum
      • setLineThroughSum

        public void setLineThroughSum​(float lineThroughSum)
      • getContentLength

        public int getContentLength()
        Returns the total number of elements used for compute the averages from sums.
        Returns:
        the total number of elements.
      • setContentLength

        public void setContentLength​(int contentLength)
      • updateAverages

        public void updateAverages​(TextStyle other)
        Updates the average values when a new content rect is added or joined.
        Parameters:
        other - the other text style
      • reset

        public void reset()
        Resets the average values to zeroes.