org.apache.fop.pdf
Class PDFFont

java.lang.Object
  extended by org.apache.fop.pdf.PDFObject
      extended by org.apache.fop.pdf.PDFFont
Direct Known Subclasses:
PDFFontNonBase14

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  String basefont
          the base font name (eg "Helvetica")
protected  Object encoding
          the character encoding scheme used by the font.
protected  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 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, String fontname, byte subtype, String basefont, Object encoding)
          create the /Font object
 
Method Summary
static PDFFont createFont(int number, String fontname, byte subtype, String basefont, Object encoding)
          factory method with the basic parameters
static PDFFont createFont(int number, String fontname, byte subtype, String basefont, Object encoding, int firstChar, int lastChar, PDFArray widths, PDFFontDescriptor descriptor)
          factory method with the extended parameters for Type1, MMType1 and TrueType
protected  void fillInPDF(StringBuffer begin)
          fill in the specifics for the font's subtype.
 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()

See Also:
Constant Field Values

TYPE1

public static final byte TYPE1
font subtype to be used as parameter to createFont()

See Also:
Constant Field Values

MMTYPE1

public static final byte MMTYPE1
font subtype to be used as parameter to createFont()

See Also:
Constant Field Values

TYPE3

public static final byte TYPE3
font subtype to be used as parameter to createFont()

See Also:
Constant Field Values

TRUETYPE

public static final byte TRUETYPE
font subtype to be used as parameter to createFont()

See Also:
Constant Field Values

TYPE_NAMES

protected static final String[] TYPE_NAMES
font subtype names as output in the PDF


fontname

protected 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 String basefont
the base font name (eg "Helvetica")


encoding

protected 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,
               String fontname,
               byte subtype,
               String basefont,
               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,
                                 String fontname,
                                 byte subtype,
                                 String basefont,
                                 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,
                                 String fontname,
                                 byte subtype,
                                 String basefont,
                                 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 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(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-2003 Apache Software Foundation. All Rights Reserved.