Class ITextFont


  • public class ITextFont
    extends java.lang.Object
    iText wrapper object for font.
    Version:
    $Id: ITextFont.java 1438269 2013-01-24 23:47:50Z olamy $
    Author:
    Vincent Siveton
    See Also:
    Font
    • Constructor Summary

      Constructors 
      Constructor Description
      ITextFont()
      Default constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addBold()
      Add bold style to the current style
      void addItalic()
      Add italic style to the current style
      void addUnderlined()
      Add italic style to the current style
      static com.lowagie.text.Font getFont​(int style, float size, java.awt.Color color)
      Convenience method to get a defined font depending the wanted style and size.
      java.lang.String getFontColorBlue()
      Return the font color blue
      java.lang.String getFontColorGreen()
      Return the font color green
      java.lang.String getFontColorRed()
      Return the font color red
      java.lang.String getFontName()
      Return the font name
      java.lang.String getFontSize()
      Return the font name
      java.lang.String getFontStyle()
      Return the font style
      static com.lowagie.text.Font getMonoSpacedFont​(int style, float size, java.awt.Color color)
      Convenience method to get a defined MonoSpaced font depending the wanted style and size.
      static int getSectionFontSize​(int sectionNumber)
      Get a section font size depending the section number.
      void removeBold()
      Remove bold style to the current style
      void removeItalic()
      Remove italic style to the current style
      void removeUnderlined()
      Remove italic style to the current style
      void setColor​(java.awt.Color color)
      Set a new font color
      void setMonoSpaced​(boolean monoSpaced)
      Add monospaced style to the current style
      void setSize​(float size)
      Set a new font color
      • Methods inherited from class java.lang.Object

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

      • NORMAL

        public static final java.lang.String NORMAL
        A normal font style
        See Also:
        Constant Field Values
      • ITALIC

        public static final java.lang.String ITALIC
        A italic font style
        See Also:
        Constant Field Values
      • UNDERLINE

        public static final java.lang.String UNDERLINE
        An underline font style
        See Also:
        Constant Field Values
      • DEFAULT_FONT_NAME

        public static final java.lang.String DEFAULT_FONT_NAME
        A default font name
        See Also:
        Constant Field Values
      • DEFAULT_FONT_SIZE

        public static final float DEFAULT_FONT_SIZE
        A default font size
        See Also:
        Constant Field Values
      • DEFAULT_FONT_STYLE

        public static final java.lang.String DEFAULT_FONT_STYLE
        A default font style
        See Also:
        Constant Field Values
      • DEFAULT_FONT_COLOR_RED

        public static final int DEFAULT_FONT_COLOR_RED
        A default Black color definition
      • DEFAULT_FONT_COLOR_GREEN

        public static final int DEFAULT_FONT_COLOR_GREEN
        A default Black color definition
      • DEFAULT_FONT_COLOR_BLUE

        public static final int DEFAULT_FONT_COLOR_BLUE
        A default Black color definition
    • Constructor Detail

      • ITextFont

        public ITextFont()
        Default constructor
    • Method Detail

      • addBold

        public void addBold()
        Add bold style to the current style
      • removeBold

        public void removeBold()
        Remove bold style to the current style
      • addItalic

        public void addItalic()
        Add italic style to the current style
      • removeItalic

        public void removeItalic()
        Remove italic style to the current style
      • addUnderlined

        public void addUnderlined()
        Add italic style to the current style
      • removeUnderlined

        public void removeUnderlined()
        Remove italic style to the current style
      • setMonoSpaced

        public void setMonoSpaced​(boolean monoSpaced)
        Add monospaced style to the current style
        Parameters:
        monoSpaced - true for monospaced style
      • setColor

        public void setColor​(java.awt.Color color)
        Set a new font color
        Parameters:
        color - a new color
      • setSize

        public void setSize​(float size)
        Set a new font color
        Parameters:
        size - a new size
      • getFontName

        public java.lang.String getFontName()
        Return the font name
        Returns:
        the font name
      • getFontStyle

        public java.lang.String getFontStyle()
        Return the font style
        Returns:
        the font style
      • getFontSize

        public java.lang.String getFontSize()
        Return the font name
        Returns:
        the font name
      • getFontColorBlue

        public java.lang.String getFontColorBlue()
        Return the font color blue
        Returns:
        the font color blue
      • getFontColorGreen

        public java.lang.String getFontColorGreen()
        Return the font color green
        Returns:
        the font color green
      • getFontColorRed

        public java.lang.String getFontColorRed()
        Return the font color red
        Returns:
        the font color red
      • getSectionFontSize

        public static int getSectionFontSize​(int sectionNumber)
        Get a section font size depending the section number.
        0
        Chapter: font size = 24
        1
        Section 1: font size = 22
        2
        Section 2: font size = 20
        3
        Section 3: font size = 18
        4
        Section 4: font size = 16
        5 ot otherwise
        Section 5: font size = 14
        Parameters:
        sectionNumber - a section number
        Returns:
        a font size.
      • getMonoSpacedFont

        public static com.lowagie.text.Font getMonoSpacedFont​(int style,
                                                              float size,
                                                              java.awt.Color color)
        Convenience method to get a defined MonoSpaced font depending the wanted style and size.
        Parameters:
        style - the font style.
        size - the font size.
        color - the font color.
        Returns:
        a font the font.
      • getFont

        public static com.lowagie.text.Font getFont​(int style,
                                                    float size,
                                                    java.awt.Color color)
        Convenience method to get a defined font depending the wanted style and size.
        Parameters:
        style - the font style.
        size - the font size.
        color - the font color.
        Returns:
        a font the font.