fop 0.94

org.apache.fop.pdf
Class PDFFont

java.lang.Object
  extended by org.apache.fop.pdf.PDFObject
      extended by org.apache.fop.pdf.PDFFont
All Implemented Interfaces:
PDFWritable
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  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")
protected  FontType subtype
          the font's subtype (as defined by the constants FontType: TYPE0, TYPE1, MMTYPE1, TYPE3, TRUETYPE)
 
Fields inherited from class org.apache.fop.pdf.PDFObject
DATE_FORMAT, log
 
Constructor Summary
PDFFont(java.lang.String fontname, FontType subtype, java.lang.String basefont, java.lang.Object encoding)
          create the /Font object
 
Method Summary
static PDFFont createFont(java.lang.String fontname, FontType subtype, java.lang.String basefont, java.lang.Object encoding)
          factory method with the basic parameters
static PDFFont createFont(java.lang.String fontname, FontType 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 target)
          This method is called to receive the specifics for the font's subtype.
 java.lang.String getName()
          get the internal name used for this font
protected  java.lang.String getPDFNameForFontType(FontType fontType)
          Returns the PDF name for a certain font type.
 java.lang.String toPDFString()
          This method returns a String representation of the PDF object.
protected  void validate()
          Validates the PDF object prior to serialization.
 
Methods inherited from class org.apache.fop.pdf.PDFObject
encode, encodeString, encodeText, formatDateTime, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, hasObjectNumber, makeReference, output, referencePDF, setDocument, setObjectNumber, toInlinePDFString, toPDF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fontname

protected java.lang.String fontname
the internal name for the font (eg "F1")


subtype

protected FontType subtype
the font's subtype (as defined by the constants FontType: 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(java.lang.String fontname,
               FontType subtype,
               java.lang.String basefont,
               java.lang.Object encoding)
create the /Font object

Parameters:
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
Method Detail

createFont

public static PDFFont createFont(java.lang.String fontname,
                                 FontType subtype,
                                 java.lang.String basefont,
                                 java.lang.Object encoding)
factory method with the basic parameters

Parameters:
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
Returns:
the generated PDFFont object

createFont

public static PDFFont createFont(java.lang.String fontname,
                                 FontType 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:
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
Returns:
the generated PDFFont object

getName

public java.lang.String getName()
get the internal name used for this font

Returns:
the internal name

getPDFNameForFontType

protected java.lang.String getPDFNameForFontType(FontType fontType)
Returns the PDF name for a certain font type.

Parameters:
fontType - font type
Returns:
String corresponding PDF name

validate

protected void validate()
Validates the PDF object prior to serialization.


toPDFString

public java.lang.String toPDFString()
Description copied from class: PDFObject
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.

Overrides:
toPDFString in class PDFObject
Returns:
String the String representation
See Also:
PDFObject.toPDFString()

fillInPDF

protected void fillInPDF(java.lang.StringBuffer target)
This method is called to receive the specifics for the font's subtype.

The given buffer already contains the fields common to all font types.

Parameters:
target - the buffer to be completed with the type specific fields

fop 0.94

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.