Class PDCIDFont

    • Constructor Detail

      • PDCIDFont

        public PDCIDFont()
        Constructor.
      • PDCIDFont

        public PDCIDFont​(COSDictionary fontDictionary)
        Constructor.
        Parameters:
        fontDictionary - The font dictionary according to the PDF specification.
    • Method Detail

      • getFontBoundingBox

        public PDRectangle getFontBoundingBox()
                                       throws java.io.IOException
        This will get the fonts bouding box.
        Overrides:
        getFontBoundingBox in class PDSimpleFont
        Returns:
        The fonts bouding box.
        Throws:
        java.io.IOException - If there is an error getting the font bounding box.
      • getDefaultWidth

        public long getDefaultWidth()
        This will get the default width. The default value for the default width is 1000.
        Returns:
        The default width for the glyphs in this font.
      • setDefaultWidth

        public void setDefaultWidth​(long dw)
        This will set the default width for the glyphs of this font.
        Parameters:
        dw - The default width.
      • getFontWidth

        public float getFontWidth​(byte[] c,
                                  int offset,
                                  int length)
                           throws java.io.IOException
        This will get the font width for a character.
        Overrides:
        getFontWidth in class PDSimpleFont
        Parameters:
        c - The character code to get the width for.
        offset - The offset into the array.
        length - The length of the data.
        Returns:
        The width is in 1000 unit of text space, ie 333 or 777
        Throws:
        java.io.IOException - If an error occurs while parsing.
      • getFontHeight

        public float getFontHeight​(byte[] c,
                                   int offset,
                                   int length)
                            throws java.io.IOException
        This will get the font height for a character.
        Overrides:
        getFontHeight in class PDSimpleFont
        Parameters:
        c - The character code to get the height for.
        offset - The offset into the array.
        length - The length of the data.
        Returns:
        The width is in 1000 unit of text space, ie 333 or 777
        Throws:
        java.io.IOException - If an error occurs while parsing.
      • getAverageFontWidth

        public float getAverageFontWidth()
                                  throws java.io.IOException
        This will get the average font width for all characters.
        Overrides:
        getAverageFontWidth in class PDSimpleFont
        Returns:
        The width is in 1000 unit of text space, ie 333 or 777
        Throws:
        java.io.IOException - If an error occurs while parsing.
      • getFontWidth

        public float getFontWidth​(int charCode)
        Determines the width of the given character.
        Overrides:
        getFontWidth in class PDFont
        Parameters:
        charCode - the code of the given character
        Returns:
        the width of the character
      • determineEncoding

        protected void determineEncoding()
        Description copied from class: PDSimpleFont
        Determines the encoding for the font. This method as to be overwritten, as there are different possibilities to define a mapping.
        Overrides:
        determineEncoding in class PDSimpleFont
      • encode

        public java.lang.String encode​(byte[] c,
                                       int offset,
                                       int length)
                                throws java.io.IOException
        Description copied from class: PDFont
        This will perform the encoding of a character if needed.
        Overrides:
        encode in class PDFont
        Parameters:
        c - The character to encode.
        offset - The offset into the array to get the data
        length - The number of bytes to read.
        Returns:
        The value of the encoded character.
        Throws:
        java.io.IOException - If there is an error during the encoding.
      • clear

        public void clear()
        Description copied from class: PDFont
        Calling this will release all cached information.
        Overrides:
        clear in class PDFont