org.apache.fop.pdf

## Class PDFFontDescriptor

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.pdf.PDFDictionary
    - - org.apache.fop.pdf.PDFFontDescriptor

- All Implemented Interfaces:
    PDFWritable
  Direct Known Subclasses:
    PDFCIDFontDescriptor

      public class PDFFontDescriptor
      extends PDFDictionary

  Class representing a font descriptor (/FontDescriptor object).

  Font descriptors are specified on page 222 and onwards of the PDF 1.3 spec.

- - ### Field Summary

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

      `entries, order`

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

      `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFFontDescriptor(String basefont, int ascent, int descent, int capHeight, int flags, PDFRectangle fontBBox, int italicAngle, int stemV)` Create the /FontDescriptor object

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AbstractPDFStream` | `getCIDSet()`
    `AbstractPDFStream` | `getFontFile()`
    `void` | `setCIDSet(AbstractPDFStream cidSet)` Sets the CIDSet stream for this font descriptor.
    `void` | `setFontFile(FontType subtype, AbstractPDFStream fontfile)` Set the optional font file stream
    `void` | `setMetrics(int avgWidth, int maxWidth, int missingWidth, int leading, int stemH, int xHeight)` Set the optional metrics.

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

      `containsKey, get, getChildren, getChildren, keySet, output, put, put, remove, writeDictionary`

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

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

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

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

- - ### Constructor Detail

    - #### PDFFontDescriptor

          public PDFFontDescriptor(String basefont,
                                   int ascent,
                                   int descent,
                                   int capHeight,
                                   int flags,
                                   PDFRectangle fontBBox,
                                   int italicAngle,
                                   int stemV)

      Create the /FontDescriptor object
      Parameters:
        `ascent` - the maximum height above the baseline
        `descent` - the maximum depth below the baseline
        `capHeight` - height of the capital letters
        `flags` - various characteristics of the font
        `fontBBox` - the bounding box for the described font
        `basefont` - the base font name
        `italicAngle` - the angle of the vertical dominant strokes
        `stemV` - the width of the dominant vertical stems of glyphs

  - ### Method Detail

    - #### setMetrics

          public void setMetrics(int avgWidth,
                                 int maxWidth,
                                 int missingWidth,
                                 int leading,
                                 int stemH,
                                 int xHeight)

      Set the optional metrics.
      Parameters:
        `avgWidth` - The average width of characters in this font. The default value is 0.
        `maxWidth` - The maximum width of characters in this font. The default value is 0.
        `missingWidth` - missing width
        `leading` - the desired spacing between lines of text. The default value is 0.
        `stemH` - The vertical width of the dominant horizontal stems of glyphs in the font. The default value is 0.
        `xHeight` - The y-coordinate of the top of flat non-ascending lowercase letters, measured from the baseline. The default value is 0.

    - #### setFontFile

          public void setFontFile(FontType subtype,
                                  AbstractPDFStream fontfile)

      Set the optional font file stream
      Parameters:
        `subtype` - the font type defined in the font stream
        `fontfile` - the stream containing an embedded font

    - #### getFontFile

          public AbstractPDFStream getFontFile()

      Returns:
        the FontFile or null if the font is not embedded

    - #### setCIDSet

          public void setCIDSet(AbstractPDFStream cidSet)

      Sets the CIDSet stream for this font descriptor. (Optional)
      Parameters:
        `cidSet` - the CIDSet stream

    - #### getCIDSet

          public AbstractPDFStream getCIDSet()

      Returns:
        the CIDSet stream or null if not applicable

Copyright © 2023 Apache Software Foundation. All rights reserved.