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 Name ASCENT
           
static Name AVG_WIDTH
           
static Name CAP_HEIGHT
           
static Name DESCENT
           
static Name FLAGS
           
static Name FONT_BBOX
           
static Name FONT_FAMILY
           
static Name FONT_FILE
           
static Name FONT_FILE_2
           
static Name FONT_FILE_3
           
static Name FONT_FILE_3_CID_FONT_TYPE_0
           
static Name FONT_FILE_3_CID_FONT_TYPE_0C
           
static Name FONT_FILE_3_CID_FONT_TYPE_2
           
static Name FONT_FILE_3_OPEN_TYPE
           
static Name FONT_FILE_3_TYPE_1C
           
static Name FONT_NAME
           
static Name FONT_WEIGHT
           
static Name ITALIC_ANGLE
           
static Name LEADING
           
static Name MAX_WIDTH
           
static Name MISSING_Stretch
           
static Name MISSING_WIDTH
           
static Name STEM_H
           
static Name STEM_V
           
static Name TYPE
           
static Name X_HEIGHT
           
 
Fields inherited from class org.icepdf.core.pobjects.Dictionary
entries, FORM_TYPE_KEY, inited, isDeleted, isNew, LENGTH_KEY, library, SUBTYPE_KEY, TYPE_KEY
 
Constructor Summary
FontDescriptor(Library l, java.util.HashMap 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, 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

TYPE

public static final Name TYPE

FONT_NAME

public static final Name FONT_NAME

FONT_FAMILY

public static final Name FONT_FAMILY

MISSING_Stretch

public static final Name MISSING_Stretch

FONT_WEIGHT

public static final Name FONT_WEIGHT

FLAGS

public static final Name FLAGS

FONT_BBOX

public static final Name FONT_BBOX

ITALIC_ANGLE

public static final Name ITALIC_ANGLE

ASCENT

public static final Name ASCENT

DESCENT

public static final Name DESCENT

LEADING

public static final Name LEADING

CAP_HEIGHT

public static final Name CAP_HEIGHT

X_HEIGHT

public static final Name X_HEIGHT

STEM_V

public static final Name STEM_V

STEM_H

public static final Name STEM_H

AVG_WIDTH

public static final Name AVG_WIDTH

MAX_WIDTH

public static final Name MAX_WIDTH

MISSING_WIDTH

public static final Name MISSING_WIDTH

FONT_FILE

public static final Name FONT_FILE

FONT_FILE_2

public static final Name FONT_FILE_2

FONT_FILE_3

public static final Name FONT_FILE_3

FONT_FILE_3_TYPE_1C

public static final Name FONT_FILE_3_TYPE_1C

FONT_FILE_3_CID_FONT_TYPE_0

public static final Name FONT_FILE_3_CID_FONT_TYPE_0

FONT_FILE_3_CID_FONT_TYPE_2

public static final Name FONT_FILE_3_CID_FONT_TYPE_2

FONT_FILE_3_CID_FONT_TYPE_0C

public static final Name FONT_FILE_3_CID_FONT_TYPE_0C

FONT_FILE_3_OPEN_TYPE

public static final Name FONT_FILE_3_OPEN_TYPE
Constructor Detail

FontDescriptor

public FontDescriptor(Library l,
                      java.util.HashMap 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.