org.apache.fop.pdf

## Class PDFCIDFont

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.pdf.PDFCIDFont

- All Implemented Interfaces:
    PDFWritable

      public class PDFCIDFont
      extends PDFObject

  Class representing a "character identifier" font (p 210 and onwards).

- - ### Field Summary

    - ### Fields inherited from class org.apache.fop.pdf.PDFObject

      `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFCIDFont(String basefont, CIDFontType cidtype, int dw, int[] w, PDFCIDSystemInfo systemInfo, PDFCIDFontDescriptor descriptor)` Create the /Font object
    `PDFCIDFont(String basefont, CIDFontType cidtype, int dw, int[] w, String registry, String ordering, int supplement, PDFCIDFontDescriptor descriptor)` Create the /Font object
    `PDFCIDFont(String basefont, CIDFontType cidtype, int dw, PDFWArray w, PDFCIDSystemInfo systemInfo, PDFCIDFontDescriptor descriptor)` Create the /Font object

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `getChildren(Set<PDFObject> children)`
    `protected String` | `getPDFNameForCIDFontType(CIDFontType cidFontType)` Returns the PDF name for a certain CID font type.
    `void` | `setCIDMap(PDFStream map)` Set the /CIDToGIDMap (to be used only for CIDFontType2)
    `void` | `setCIDMapIdentity()` Set the /CIDToGIDMap (to be used only for CIDFontType2) to "Identity"
    `void` | `setCMAP(PDFCMap cmap)` Set the CMap used as /ToUnicode cmap
    `void` | `setDW(int dw)` Set the /DW attribute
    `void` | `setDW2(int[] dw2)` Set the (two elements) /DW2 array
    `void` | `setDW2(int posY, int displacementY)` Set the two elements of the /DW2 array
    `void` | `setW(PDFWArray w)` Set the /W array
    `void` | `setW2(PDFWArray w2)` Set the /W2 array
    `byte[]` | `toPDF()` Encodes the object as a byte array for output to a PDF file.
    `String` | `toPDFString()` This method returns a String representation of the PDF object.

    - ### Methods inherited from class org.apache.fop.pdf.PDFObject

      `contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, output, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PDFCIDFont

          public PDFCIDFont(String basefont,
                            CIDFontType cidtype,
                            int dw,
                            int[] w,
                            String registry,
                            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(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(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 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 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

    - #### getChildren

          public void getChildren(Set<PDFObject> children)

      Overrides:
        `getChildren` in class `PDFObject`

Copyright © 2023 Apache Software Foundation. All rights reserved.