## org.apache.fop.pdf
Class PDFFont

    java.lang.Object
      |
      +--org.apache.fop.pdf.PDFObject
            |
            +--org.apache.fop.pdf.PDFFont

Direct Known Subclasses:
  PDFFontNonBase14, PDFFontType0

public class PDFFont
extends PDFObject

class representing a /Font object. A more complete object expressing the base font name and encoding of a font along with an internal name for the font used within streams of content. Fonts are specified on page 198 and onwards of the PDF 1.3 spec.

Field Summary
`protected java.lang.String` `basefont` the base font name (eg "Helvetica")
`protected java.lang.Object` `encoding` the character encoding scheme used by the font.
`protected java.lang.String` `fontname` the internal name for the font (eg "F1")
`static byte` `MMTYPE1` font subtype to be used as parameter to createFont()
`protected byte` `subtype` the font's subtype (as defined by the constants TYPE0, TYPE1, MMTYPE1, TYPE3, TRUETYPE)
`static byte` `TRUETYPE` font subtype to be used as parameter to createFont()
`protected static java.lang.String[]` `TYPE_NAMES` font subtype names as output in the PDF
`static byte` `TYPE0` font subtype to be used as parameter to createFont()
`static byte` `TYPE1` font subtype to be used as parameter to createFont()
`static byte` `TYPE3` font subtype to be used as parameter to createFont()

Fields inherited from class org.apache.fop.pdf.PDFObject
`generation, number`

Constructor Summary
`PDFFont(int number, java.lang.String fontname, byte subtype, java.lang.String basefont, java.lang.Object encoding)` create the /Font object

Method Summary
`static PDFFont` `createFont(int number, java.lang.String fontname, byte subtype, java.lang.String basefont, java.lang.Object encoding)` factory method with the basic parameters
`static PDFFont` `createFont(int number, java.lang.String fontname, byte subtype, java.lang.String basefont, java.lang.Object encoding, int firstChar, int lastChar, PDFArray widths, PDFFontDescriptor descriptor)` factory method with the extended parameters for Type1, MMType1 and TrueType
`protected void` `fillInPDF(java.lang.StringBuffer begin)` fill in the specifics for the font's subtype.
`java.lang.String` `getName()` get the internal name used for this font
`byte[]` `toPDF()` produce the PDF representation for the object

Methods inherited from class org.apache.fop.pdf.PDFObject
`getNumber, output, referencePDF`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TYPE0

    public static final byte TYPE0

  font subtype to be used as parameter to createFont()

### TYPE1

    public static final byte TYPE1

  font subtype to be used as parameter to createFont()

### MMTYPE1

    public static final byte MMTYPE1

  font subtype to be used as parameter to createFont()

### TYPE3

    public static final byte TYPE3

  font subtype to be used as parameter to createFont()

### TRUETYPE

    public static final byte TRUETYPE

  font subtype to be used as parameter to createFont()

### TYPE_NAMES

    protected static final java.lang.String[] TYPE_NAMES

  font subtype names as output in the PDF

### fontname

    protected java.lang.String fontname

  the internal name for the font (eg "F1")

### subtype

    protected byte subtype

  the font's subtype (as defined by the constants TYPE0, TYPE1, MMTYPE1, TYPE3, TRUETYPE)

### basefont

    protected java.lang.String basefont

  the base font name (eg "Helvetica")

### encoding

    protected java.lang.Object encoding

  the character encoding scheme used by the font. It can be a String for standard encodings, or a PDFEncoding for a more complex scheme, or a PDFStream containing a CMap in a Type0 font. If `null` then not written out in the PDF.

Constructor Detail

### PDFFont

    public PDFFont(int number,
                   java.lang.String fontname,
                   byte subtype,
                   java.lang.String basefont,
                   java.lang.Object encoding)

  create the /Font object
  Parameters:
    `number` - the object's number
    `fontname` - the internal name for the font
    `subtype` - the font's subtype
    `basefont` - the base font name
    `encoding` - the character encoding schema used by the font
    `mapping` - the Unicode mapping mechanism

Method Detail

### createFont

    public static PDFFont createFont(int number,
                                     java.lang.String fontname,
                                     byte subtype,
                                     java.lang.String basefont,
                                     java.lang.Object encoding)

  factory method with the basic parameters
  Parameters:
    `number` - the object's number
    `fontname` - the internal name for the font
    `subtype` - the font's subtype
    `basefont` - the base font name
    `encoding` - the character encoding schema used by the font

### createFont

    public static PDFFont createFont(int number,
                                     java.lang.String fontname,
                                     byte subtype,
                                     java.lang.String basefont,
                                     java.lang.Object encoding,
                                     int firstChar,
                                     int lastChar,
                                     PDFArray widths,
                                     PDFFontDescriptor descriptor)

  factory method with the extended parameters for Type1, MMType1 and TrueType
  Parameters:
    `number` - the object's number
    `fontname` - the internal name for the font
    `subtype` - the font's subtype
    `basefont` - the base font name
    `encoding` - the character encoding schema used by the font
    `firstChar` - the first character code in the font
    `lastChar` - the last character code in the font
    `widths` - an array of size (lastChar - firstChar +1)
    `descriptor` - the descriptor for other font's metrics

### getName

    public java.lang.String getName()

  get the internal name used for this font
  Returns:
    the internal name

### toPDF

    public byte[] toPDF()

  produce the PDF representation for the object
  Returns:
    the PDF

### fillInPDF

    protected void fillInPDF(java.lang.StringBuffer begin)

  fill in the specifics for the font's subtype. the given buffer already contains the fields common to all font types.
  Parameters:
    `begin` - the buffer to be completed with the type specific fields

Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.