adams.core.io
Class PdfFont

java.lang.Object
  extended by adams.core.io.PdfFont
All Implemented Interfaces:
CloneHandler<PdfFont>, Serializable

public class PdfFont
extends Object
implements Serializable, CloneHandler<PdfFont>

A helper class for PDF fonts.

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
static String BOLD
          the string for BOLD.
static String COURIER
          the string for Courier.
static String HELVETICA
          the string for Helvetica.
static String ITALIC
          the string for ITALIC.
protected  com.itextpdf.text.Font m_Font
          the actual PDF font.
protected  int m_FontFace
          the font face.
protected  int m_FontFamily
          the font family.
protected  float m_Size
          the font size.
static String NORMAL
          the string for NORMAL.
static char SEPARATOR
          the separator.
static String STRIKETHRU
          the string for STRIKETHRU.
static String SYMBOL
          the string for Symbol.
static String TIMES_ROMAN
          the string for Times Roman.
static String UNDERLINE
          the string for UNDERLINE.
static String ZAPFDINGBATS
          the string for ZapfDingBats.
 
Constructor Summary
PdfFont()
          Initializes a default font.
PdfFont(int family, int face, float size)
          Initializes the font with the given values.
PdfFont(String fontStr)
          Parses the given string.
PdfFont(String family, int face, float size)
          Initializes the font with the given values.
PdfFont(String family, String face, float size)
          Initializes the font with the given values.
 
Method Summary
 PdfFont getClone()
          Returns a clone of the object.
 int getFontFace()
          Returns the font face.
static int getFontFace(String name)
          Turns the font style name into the constant of the font style.
 String[] getFontFaces()
          Generates a list of font faces.
static String[] getFontFaces(com.itextpdf.text.Font font)
          Generates a list of font style names from the given font setup.
 int getFontFamily()
          Turns the font family into the String constant of the font family.
static String getFontFamily(com.itextpdf.text.Font font)
          Turns the font family into the String constant of the font family.
static String getFontFamily(int family)
          Turns the font family into the String constant of the font family.
static int getFontFamily(String name)
          Turns the font family name into the constant of the font family.
static com.itextpdf.text.Font.FontFamily getFontFamilyEnum(int family)
          Turns the font family into the enum of the font family.
 String getFontFamilyName()
          Turns the font family into the String constant of the font family.
 float getSize()
          Returns the font size.
 com.itextpdf.text.Font toFont()
          Turns the font object into the PDF font.
 com.itextpdf.text.Font toFont(Color color)
          Turns the font object into the PDF font.
 Font toJavaFont()
          Returns the closest Java font.
 String toString()
          Returns the font as string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SEPARATOR

public static final char SEPARATOR
the separator.

See Also:
Constant Field Values

NORMAL

public static final String NORMAL
the string for NORMAL.

See Also:
Constant Field Values

BOLD

public static final String BOLD
the string for BOLD.

See Also:
Constant Field Values

ITALIC

public static final String ITALIC
the string for ITALIC.

See Also:
Constant Field Values

STRIKETHRU

public static final String STRIKETHRU
the string for STRIKETHRU.

See Also:
Constant Field Values

UNDERLINE

public static final String UNDERLINE
the string for UNDERLINE.

See Also:
Constant Field Values

COURIER

public static final String COURIER
the string for Courier.

See Also:
Constant Field Values

HELVETICA

public static final String HELVETICA
the string for Helvetica.

See Also:
Constant Field Values

SYMBOL

public static final String SYMBOL
the string for Symbol.

See Also:
Constant Field Values

TIMES_ROMAN

public static final String TIMES_ROMAN
the string for Times Roman.

See Also:
Constant Field Values

ZAPFDINGBATS

public static final String ZAPFDINGBATS
the string for ZapfDingBats.

See Also:
Constant Field Values

m_FontFamily

protected int m_FontFamily
the font family.


m_FontFace

protected int m_FontFace
the font face.


m_Size

protected float m_Size
the font size.


m_Font

protected transient com.itextpdf.text.Font m_Font
the actual PDF font.

Constructor Detail

PdfFont

public PdfFont()
Initializes a default font.


PdfFont

public PdfFont(String family,
               String face,
               float size)
Initializes the font with the given values.

Parameters:
family - the font family (helvetica, etc)
face - the font face (bold, etc)
size - the size of the font

PdfFont

public PdfFont(String family,
               int face,
               float size)
Initializes the font with the given values.

Parameters:
family - the font family (helvetica, etc)
face - the font face (bold, etc)
size - the size of the font

PdfFont

public PdfFont(int family,
               int face,
               float size)
Initializes the font with the given values.

Parameters:
family - the font family (helvetica, etc)
face - the font face (bold, etc)
size - the size of the font

PdfFont

public PdfFont(String fontStr)
Parses the given string.

Parameters:
fontStr - the string to parse
Method Detail

getFontFamily

public int getFontFamily()
Turns the font family into the String constant of the font family.

Returns:
the font family

getFontFamilyName

public String getFontFamilyName()
Turns the font family into the String constant of the font family.

Returns:
the font family name

getFontFace

public int getFontFace()
Returns the font face.

Returns:
the font face

getFontFaces

public String[] getFontFaces()
Generates a list of font faces.

Returns:
the list of font faces

getSize

public float getSize()
Returns the font size.

Returns:
the font size

getClone

public PdfFont getClone()
Returns a clone of the object.

Specified by:
getClone in interface CloneHandler<PdfFont>
Returns:
the clone

toString

public String toString()
Returns the font as string.

Overrides:
toString in class Object
Returns:
the string representation

toFont

public com.itextpdf.text.Font toFont()
Turns the font object into the PDF font.

Returns:
the font

toFont

public com.itextpdf.text.Font toFont(Color color)
Turns the font object into the PDF font.

Parameters:
color - the color to use
Returns:
the font

toJavaFont

public Font toJavaFont()
Returns the closest Java font.

Returns:
the closest java font

getFontFamily

public static int getFontFamily(String name)
Turns the font family name into the constant of the font family.

Parameters:
name - the font family name
Returns:
the font family identifier

getFontFamily

public static String getFontFamily(com.itextpdf.text.Font font)
Turns the font family into the String constant of the font family.

Parameters:
font - the font to analyze
Returns:
the font family name

getFontFamilyEnum

public static com.itextpdf.text.Font.FontFamily getFontFamilyEnum(int family)
Turns the font family into the enum of the font family.

Parameters:
family - the family to analyze
Returns:
the font family enum

getFontFamily

public static String getFontFamily(int family)
Turns the font family into the String constant of the font family.

Parameters:
family - the family to analyze
Returns:
the font family name

getFontFace

public static int getFontFace(String name)
Turns the font style name into the constant of the font style.

Parameters:
name - the font style name
Returns:
the font style identifier

getFontFaces

public static String[] getFontFaces(com.itextpdf.text.Font font)
Generates a list of font style names from the given font setup.

Parameters:
font - the font to analyze
Returns:
the list of font names


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.