Package com.itextpdf.tool.xml.css
Class FontSizeTranslator
- java.lang.Object
-
- com.itextpdf.tool.xml.css.FontSizeTranslator
-
public class FontSizeTranslator extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static float
DEFAULT_FONT_SIZE
private static FontSizeTranslator
myself
private static CssUtils
utils
-
Constructor Summary
Constructors Constructor Description FontSizeTranslator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description float
getFontSize(Tag tag)
Retrieves the pt font size fromTag.getCSS()
withCSS.Property.FONT_SIZE
or returns default 12ptstatic FontSizeTranslator
getInstance()
float
translateFontSize(Tag tag)
Returns the css value of the style font-size in a pt-value.
-
-
-
Field Detail
-
DEFAULT_FONT_SIZE
public static final float DEFAULT_FONT_SIZE
- See Also:
- Constant Field Values
-
utils
private static CssUtils utils
-
myself
private static FontSizeTranslator myself
-
-
Method Detail
-
getInstance
public static FontSizeTranslator getInstance()
- Returns:
- Singleton instance of FontSizeTranslater.
-
translateFontSize
public float translateFontSize(Tag tag)
Returns the css value of the style font-size in a pt-value. Possible font-size values:- a constant in px, in, cm, mm, pc, em or ex,
- xx-small,
- x-small,
- small,
- medium,
- large,
- x-large,
- xx-large,
- smaller (than tag's parent size),
- larger (than tag's parent size),
- a percentage (e.g font-size:250%) of tag's parent size,
- Parameters:
tag
- to get the font size of.- Returns:
- float font size of the content of the tag in pt.
-
getFontSize
public float getFontSize(Tag tag)
Retrieves the pt font size fromTag.getCSS()
withCSS.Property.FONT_SIZE
or returns default 12pt- Parameters:
tag
- the tag to get the font-size from.- Returns:
- the font size
-
-