gnu.jpdf
Class PDFFont

java.lang.Object
  extended by gnu.jpdf.PDFObject
      extended by gnu.jpdf.PDFFont
All Implemented Interfaces:
java.io.Serializable

public class PDFFont
extends PDFObject
implements java.io.Serializable

This class defines a font within a PDF document.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class gnu.jpdf.PDFObject
objser, pdfDocument
 
Constructor Summary
protected PDFFont()
          This constructs a default PDFFont.
  PDFFont(java.lang.String name, java.lang.String type, java.lang.String font, int style)
          Constructs a PDFFont.
 
Method Summary
protected  boolean equals(java.lang.String type, java.lang.String font, int style)
          This is used by the PDF and PDFPage classes to compare font names
 java.lang.String getFont()
           
 java.lang.String getName()
          This is the most common method to use.
 int getStyle()
           
 java.lang.String getType()
          Returns the PDF Type of this object
 void write(java.io.OutputStream os)
          Writes the object to the output stream.
 
Methods inherited from class gnu.jpdf.PDFObject
getPDFDocument, getSerialID, toArray, toString, writeEnd, writeStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDFFont

protected PDFFont()
This constructs a default PDFFont. In this case Helvetica


PDFFont

public PDFFont(java.lang.String name,
               java.lang.String type,
               java.lang.String font,
               int style)
Constructs a PDFFont. This will attempt to map the font from a known Java font name to that in PDF, defaulting to Helvetica if not possible.

Parameters:
name - The document name, ie /F1
type - The pdf type, ie /Type1
font - The font name, ie Helvetica
style - The java.awt.Font style, ie: Font.PLAIN
Method Detail

getName

public java.lang.String getName()
This is the most common method to use.

Returns:
the Font name within the PDF document.

getType

public java.lang.String getType()
Description copied from class: PDFObject
Returns the PDF Type of this object

Overrides:
getType in class PDFObject
Returns:
the Font's PDF type

getFont

public java.lang.String getFont()
Returns:
The PDF Font name

getStyle

public int getStyle()
Returns:
the font style.
See Also:
Font

write

public void write(java.io.OutputStream os)
           throws java.io.IOException
Description copied from class: PDFObject

Writes the object to the output stream. This method must be overidden.

Note: It should not write any other objects, even if they are it's Kids, as they will be written by the calling routine.

Specified by:
write in class PDFObject
Parameters:
os - OutputStream to send the object to
Throws:
java.io.IOException - on error

equals

protected boolean equals(java.lang.String type,
                         java.lang.String font,
                         int style)
This is used by the PDF and PDFPage classes to compare font names

Parameters:
type - The pdf type, ie /Type1
font - The font name, ie Helvetica
style - The java.awt.Font style, ie: Font.PLAIN
Returns:
true if this object is identical to this font's spec