org.apache.fop.pdf

Class PDFFont

Implemented Interfaces:
PDFWritable
Known Direct Subclasses:
PDFFontNonBase14, PDFFontType0

public class PDFFont
extends PDFDictionary

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

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

entries, order

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

DATE_FORMAT, log

Constructor Summary

PDFFont(String fontname, FontType subtype, String basefont, Object encoding)
create the /Font object

Method Summary

static PDFFont
createFont(String fontname, FontType subtype, String basefont, Object encoding)
factory method with the basic parameters
PDFName
getBaseFont()
Returns the name of the BaseFont.
String
getName()
Get the internal name used for this font.
protected PDFName
getPDFNameForFontType(FontType fontType)
Returns the PDF name for a certain font type.
protected int
output(OutputStream stream)
void
setEncoding(String encoding)
Sets the Encoding value of the font.
void
setEncoding(PDFEncoding encoding)
Sets the Encoding value of the font.
protected void
validate()
Validates the PDF object prior to serialization.

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

get, output, put, put, writeDictionary

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

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

Constructor Details

PDFFont

public PDFFont(String fontname,
               FontType subtype,
               String basefont,
               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 Details

createFont

public static PDFFont createFont(String fontname,
                                 FontType subtype,
                                 String basefont,
                                 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

getBaseFont

public PDFName getBaseFont()
Returns the name of the BaseFont.
Returns:
the BaseFont

getName

public String getName()
Get the internal name used for this font.
Returns:
the internal name

getPDFNameForFontType

protected PDFName getPDFNameForFontType(FontType fontType)
Returns the PDF name for a certain font type.
Parameters:
fontType - font type
Returns:
String corresponding PDF name

output

protected int output(OutputStream stream)
            throws IOException
Overrides:
output in interface PDFDictionary

setEncoding

public void setEncoding(String encoding)
Sets the Encoding value of the font.
Parameters:
encoding - the encoding

setEncoding

public void setEncoding(PDFEncoding encoding)
Sets the Encoding value of the font.
Parameters:
encoding - the encoding

validate

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

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