Package cz.vutbr.fit.layout.model
Class TextStyle
- java.lang.Object
-
- cz.vutbr.fit.layout.model.TextStyle
-
- Direct Known Subclasses:
CSSTextStyle
public class TextStyle extends Object
This class represent the statistics about text style of a content rectangle.- Author:
- burgetr
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getContentLength()
Returns the total number of elements used for compute the averages from sums.float
getFontSize()
Obtains an average font size in the are in pixels.float
getFontSizeSum()
Returns the sum of all elements the average style is computed from.float
getFontStyle()
Obtains the average font style. 0 means no text in italics, 1 means all the text in italics.float
getFontStyleSum()
Returns the sum of all elements the average style is computed from.float
getFontWeight()
Obtains the average font style. 0 means no text is bold, 1 means all the text is bold.float
getFontWeightSum()
Returns the sum of all elements the average style is computed from.float
getLineThrough()
Obtains the amount of line-through text. 0 means no underlined text, 1 means all the text is underlined.float
getLineThroughSum()
Returns the sum of all elements the average style is computed from.float
getUnderline()
Obtains the amount of underlined text. 0 means no underlined text, 1 means all the text is underlined.float
getUnderlineSum()
Returns the sum of all elements the average style is computed from.void
reset()
Resets the average values to zeroes.void
setContentLength(int contentLength)
void
setFontSizeSum(float fontSizeSum)
void
setFontStyleSum(float fontStyleSum)
void
setFontWeightSum(float fontWeightSum)
void
setLineThroughSum(float lineThroughSum)
void
setUnderlineSum(float underlineSum)
void
updateAverages(TextStyle other)
Updates the average values when a new content rect is added or joined.
-
-
-
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.
-
-