Class FontSizeTranslator


  • public class FontSizeTranslator
    extends java.lang.Object
    • Constructor Detail

      • FontSizeTranslator

        public FontSizeTranslator()
    • 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 from Tag.getCSS() with CSS.Property.FONT_SIZE or returns default 12pt
        Parameters:
        tag - the tag to get the font-size from.
        Returns:
        the font size