Class PdfFont

  • All Implemented Interfaces:
    java.lang.Comparable<PdfFont>

    class PdfFont
    extends java.lang.Object
    implements java.lang.Comparable<PdfFont>
    PdfFont is the Pdf Font object.

    Limitation: in this class only base 14 Type 1 fonts (courier, courier bold, courier oblique, courier boldoblique, helvetica, helvetica bold, helvetica oblique, helvetica boldoblique, symbol, times roman, times bold, times italic, times bolditalic, zapfdingbats) and their standard encoding (standard, MacRoman, (MacExpert,) WinAnsi) are supported.
    This object is described in the 'Portable Document Format Reference Manual version 1.3' section 7.7 (page 198-203).

    See Also:
    PdfName, PdfDictionary, BadPdfFormatException
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private BaseFont font
      the font metrics.
      protected float hScale  
      private float size
      the size.
    • Constructor Summary

      Constructors 
      Constructor Description
      PdfFont​(BaseFont bf, float size)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(PdfFont pdfFont)
      Compares this PdfFont with another
      (package private) static PdfFont getDefaultFont()  
      (package private) BaseFont getFont()  
      (package private) float getHorizontalScaling()
      Getter for the horizontal scaling.
      (package private) void setHorizontalScaling​(float hScale)  
      (package private) float size()
      Returns the size of this font.
      (package private) float width()
      Returns the approximative width of 1 character of this font.
      (package private) float width​(int character)
      Returns the width of a certain character of this font.
      (package private) float width​(java.lang.String s)  
      • Methods inherited from class java.lang.Object

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

      • font

        private BaseFont font
        the font metrics.
      • size

        private float size
        the size.
      • hScale

        protected float hScale
    • Constructor Detail

      • PdfFont

        PdfFont​(BaseFont bf,
                float size)
    • Method Detail

      • compareTo

        public int compareTo​(PdfFont pdfFont)
        Compares this PdfFont with another
        Specified by:
        compareTo in interface java.lang.Comparable<PdfFont>
        Parameters:
        pdfFont - the other PdfFont
        Returns:
        a value
      • size

        float size()
        Returns the size of this font.
        Returns:
        a size
      • width

        float width()
        Returns the approximative width of 1 character of this font.
        Returns:
        a width in Text Space
      • width

        float width​(int character)
        Returns the width of a certain character of this font.
        Parameters:
        character - a certain character
        Returns:
        a width in Text Space
      • width

        float width​(java.lang.String s)
      • getDefaultFont

        static PdfFont getDefaultFont()
      • setHorizontalScaling

        void setHorizontalScaling​(float hScale)
      • getHorizontalScaling

        float getHorizontalScaling()
        Getter for the horizontal scaling.
        Since:
        iText 5.1.0