Class PDFCIDFont

  • All Implemented Interfaces:
    PDFWritable

    public class PDFCIDFont
    extends PDFObject
    Class representing a "character identifier" font (p 210 and onwards).
    • Constructor Detail

      • PDFCIDFont

        public PDFCIDFont​(java.lang.String basefont,
                          CIDFontType cidtype,
                          int dw,
                          int[] w,
                          java.lang.String registry,
                          java.lang.String ordering,
                          int supplement,
                          PDFCIDFontDescriptor descriptor)
        Create the /Font object
        Parameters:
        basefont - Name of the basefont
        cidtype - CID type
        dw - default width
        w - array of character widths
        registry - name of the issuer
        ordering - Unique name of the font
        supplement - Supplement number
        descriptor - CID font descriptor
      • PDFCIDFont

        public PDFCIDFont​(java.lang.String basefont,
                          CIDFontType cidtype,
                          int dw,
                          int[] w,
                          PDFCIDSystemInfo systemInfo,
                          PDFCIDFontDescriptor descriptor)
        Create the /Font object
        Parameters:
        basefont - Name of the basefont
        cidtype - CID type
        dw - default width
        w - array of character widths
        systemInfo - CID system info
        descriptor - CID font descriptor
      • PDFCIDFont

        public PDFCIDFont​(java.lang.String basefont,
                          CIDFontType cidtype,
                          int dw,
                          PDFWArray w,
                          PDFCIDSystemInfo systemInfo,
                          PDFCIDFontDescriptor descriptor)
        Create the /Font object
        Parameters:
        basefont - Name of the basefont
        cidtype - CID type
        dw - default width
        w - array of character widths
        systemInfo - CID system info
        descriptor - CID font descriptor
    • Method Detail

      • setDW

        public void setDW​(int dw)
        Set the /DW attribute
        Parameters:
        dw - the default width
      • setW

        public void setW​(PDFWArray w)
        Set the /W array
        Parameters:
        w - the width array
      • setDW2

        public void setDW2​(int[] dw2)
        Set the (two elements) /DW2 array
        Parameters:
        dw2 - the default metrics for vertical writing
      • setDW2

        public void setDW2​(int posY,
                           int displacementY)
        Set the two elements of the /DW2 array
        Parameters:
        posY - position vector
        displacementY - displacement vector
      • setCMAP

        public void setCMAP​(PDFCMap cmap)
        Set the CMap used as /ToUnicode cmap
        Parameters:
        cmap - character map
      • setW2

        public void setW2​(PDFWArray w2)
        Set the /W2 array
        Parameters:
        w2 - array of metrics for vertical writing
      • setCIDMap

        public void setCIDMap​(PDFStream map)
        Set the /CIDToGIDMap (to be used only for CIDFontType2)
        Parameters:
        map - mapping information
      • setCIDMapIdentity

        public void setCIDMapIdentity()
        Set the /CIDToGIDMap (to be used only for CIDFontType2) to "Identity"
      • getPDFNameForCIDFontType

        protected java.lang.String getPDFNameForCIDFontType​(CIDFontType cidFontType)
        Returns the PDF name for a certain CID font type.
        Parameters:
        cidFontType - CID font type
        Returns:
        corresponding PDF name
      • toPDFString

        public java.lang.String toPDFString()
        This method returns a String representation of the PDF object. The result is normally converted/encoded to a byte array by toPDF(). Only use this method to implement the serialization if the object can be fully represented as text. If the PDF representation of the object contains binary content use toPDF() or output(OutputStream) instead. This applies to any object potentially containing a string object because string object are encrypted and therefore need to be binary.
        Overrides:
        toPDFString in class PDFObject
        Returns:
        String the String representation
      • toPDF

        public byte[] toPDF()
        Encodes the object as a byte array for output to a PDF file.
        Overrides:
        toPDF in class PDFObject
        Returns:
        PDF string