org.icepdf.core.pobjects.fonts
Class FontDescriptor

java.lang.Object
  extended by org.icepdf.core.pobjects.Dictionary
      extended by org.icepdf.core.pobjects.fonts.FontDescriptor

public class FontDescriptor
extends Dictionary

This class represents a PDF FontDescriptor. A FontDescriptor object holds extra information about a particular parent Font object. In particular information on font widths, flags, to unicode and embedded font program streams.

See Also:
Font

Field Summary
static java.lang.String ASCENT
           
static java.lang.String AVG_WIDTH
           
static java.lang.String CAP_HEIGHT
           
static java.lang.String DESCENT
           
static java.lang.String FLAGS
           
static java.lang.String FONT_BBOX
           
static java.lang.String FONT_FAMILY
           
static java.lang.String FONT_NAME
           
static java.lang.String FONT_WEIGHT
           
static java.lang.String ITALIC_ANGLE
           
static java.lang.String LEADING
           
static java.lang.String MAX_WIDTH
           
static java.lang.String MISSING_Stretch
           
static java.lang.String MISSING_WIDTH
           
static java.lang.String STEM_H
           
static java.lang.String STEM_V
           
static java.lang.String X_HEIGHT
           
 
Fields inherited from class org.icepdf.core.pobjects.Dictionary
entries, inited, isDeleted, isNew, library, SUBTYPE_KEY, TYPE_KEY
 
Constructor Summary
FontDescriptor(Library l, java.util.Hashtable h)
          Creates a new instance of a FontDescriptor.
 
Method Summary
static FontDescriptor createDescriptor(Library library, AFM afm)
          Utility method for creating a FontDescriptor based on the font metrics of the AFM
 float getAscent()
          Gets the ascent of glyphs in the font.
 float getAverageWidth()
          Gets the average width of glyphs in the font.
 float getDescent()
          Gets the descent of glyphs in the font.
 FontFile getEmbeddedFont()
          Gets the embeddedFont if any.
 int getFlags()
          Gets the font flag value, which is a collection of various characteristics that describe the font.
 PRectangle getFontBBox()
          Gets the fonts bounding box.
 java.lang.String getFontFamily()
          Gets a string specifying the preferred font family name.
 java.lang.String getFontName()
          Returns the PostScript name of the font.
 float getFontWeight()
          Gets the weight (thickness) component of the fully-qualified font name or font specifier.
 float getMaxWidth()
          Gets the maximum width of glyphs in the font.
 float getMissingWidth()
          Gets the width to use for character codes whose widths are not specifed in the font's dictionary.
 void init()
          Initiate the Font Descriptor object.
 java.lang.String toString()
          Return a string representation of the all the FontDescriptor object's parsed attributes.
 
Methods inherited from class org.icepdf.core.pobjects.Dictionary
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, getObject, getPObjectReference, isDeleted, isNew, setDeleted, setNew, setPObjectReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FONT_NAME

public static final java.lang.String FONT_NAME
See Also:
Constant Field Values

FONT_FAMILY

public static final java.lang.String FONT_FAMILY
See Also:
Constant Field Values

MISSING_Stretch

public static final java.lang.String MISSING_Stretch
See Also:
Constant Field Values

FONT_WEIGHT

public static final java.lang.String FONT_WEIGHT
See Also:
Constant Field Values

FLAGS

public static final java.lang.String FLAGS
See Also:
Constant Field Values

FONT_BBOX

public static final java.lang.String FONT_BBOX
See Also:
Constant Field Values

ITALIC_ANGLE

public static final java.lang.String ITALIC_ANGLE
See Also:
Constant Field Values

ASCENT

public static final java.lang.String ASCENT
See Also:
Constant Field Values

DESCENT

public static final java.lang.String DESCENT
See Also:
Constant Field Values

LEADING

public static final java.lang.String LEADING
See Also:
Constant Field Values

CAP_HEIGHT

public static final java.lang.String CAP_HEIGHT
See Also:
Constant Field Values

X_HEIGHT

public static final java.lang.String X_HEIGHT
See Also:
Constant Field Values

STEM_V

public static final java.lang.String STEM_V
See Also:
Constant Field Values

STEM_H

public static final java.lang.String STEM_H
See Also:
Constant Field Values

AVG_WIDTH

public static final java.lang.String AVG_WIDTH
See Also:
Constant Field Values

MAX_WIDTH

public static final java.lang.String MAX_WIDTH
See Also:
Constant Field Values

MISSING_WIDTH

public static final java.lang.String MISSING_WIDTH
See Also:
Constant Field Values
Constructor Detail

FontDescriptor

public FontDescriptor(Library l,
                      java.util.Hashtable h)
Creates a new instance of a FontDescriptor.

Parameters:
l - Libaray of all objects in PDF
h - hash of parsed FontDescriptor attributes
Method Detail

createDescriptor

public static FontDescriptor createDescriptor(Library library,
                                              AFM afm)
Utility method for creating a FontDescriptor based on the font metrics of the AFM

Parameters:
library - document library
afm - adobe font metrics data
Returns:
new instance of a FontDescriptor

getFontName

public java.lang.String getFontName()
Returns the PostScript name of the font.

Returns:
PostScript name of font.

getFontFamily

public java.lang.String getFontFamily()
Gets a string specifying the preferred font family name. For example, the font "Time Bold Italic" would have a font family of Times.

Returns:
preferred font family name.

getFontWeight

public float getFontWeight()
Gets the weight (thickness) component of the fully-qualified font name or font specifier. The default value is zero.

Returns:
the weight of the font name.

getMissingWidth

public float getMissingWidth()
Gets the width to use for character codes whose widths are not specifed in the font's dictionary. The default value is zero.

Returns:
width of non-specified characters.

getAverageWidth

public float getAverageWidth()
Gets the average width of glyphs in the font. The default value is zero.

Returns:
average width of glyphs.

getMaxWidth

public float getMaxWidth()
Gets the maximum width of glyphs in the font. The default value is zero.

Returns:
maximum width of glyphs.

getAscent

public float getAscent()
Gets the ascent of glyphs in the font. The default value is zero.

Returns:
ascent of glyphs.

getDescent

public float getDescent()
Gets the descent of glyphs in the font. The default value is zero.

Returns:
descent of glyphs.

getEmbeddedFont

public FontFile getEmbeddedFont()
Gets the embeddedFont if any.

Returns:
embedded font; null, if there is no valid embedded font.

getFontBBox

public PRectangle getFontBBox()
Gets the fonts bounding box.

Returns:
bounding box in PDF coordinate space.

getFlags

public int getFlags()
Gets the font flag value, which is a collection of various characteristics that describe the font.

Returns:
int value representing the flags; bits must be looked at to get attribute values.

init

public void init()
Initiate the Font Descriptor object. Reads embedded font programs or CMap streams.

Overrides:
init in class Dictionary

toString

public java.lang.String toString()
Return a string representation of the all the FontDescriptor object's parsed attributes.

Overrides:
toString in class Dictionary
Returns:
all of FontDescriptors parsed attributes.