org.pdfbox.pdmodel.font

Class PDFontDescriptor

Known Direct Subclasses:
PDFontDescriptorAFM, PDFontDescriptorDictionary

public abstract class PDFontDescriptor
extends java.lang.Object

This class represents an interface to the font description. This will depend on the font type for the actual implementation. If it is a AFM/cmap/or embedded font.
Version:
$Revision: 1.2 $
Author:
Ben Litchfield

Method Summary

abstract float
getAscent()
This will get the ascent for the font.
abstract float
getAverageWidth()
This will get the average width for the font.
abstract float
getCapHeight()
This will get the CapHeight for the font.
abstract String
getCharSet()
This will get the character set for the font.
abstract float
getDescent()
This will get the descent for the font.
abstract int
getFlags()
This will get the font flags.
abstract PDRectangle
getFontBoundingBox()
This will get the fonts bouding box.
abstract String
getFontFamily()
A string representing the preferred font family.
abstract String
getFontName()
Get the font name.
abstract String
getFontStretch()
A string representing the preferred font stretch.
abstract float
getFontWeight()
The weight of the font.
abstract float
getItalicAngle()
This will get the italic angle for the font.
abstract float
getLeading()
This will get the leading for the font.
abstract float
getMaxWidth()
This will get the max width for the font.
abstract float
getStemH()
This will get the stemH for the font.
abstract float
getStemV()
This will get the stemV for the font.
abstract float
getXHeight()
This will get the x height for the font.
boolean
isAllCap()
A convenience method that checks the flag bit.
boolean
isFixedPitch()
A convenience method that checks the flag bit.
boolean
isForceBold()
A convenience method that checks the flag bit.
boolean
isItalic()
A convenience method that checks the flag bit.
boolean
isNonSymbolic()
A convenience method that checks the flag bit.
boolean
isScript()
A convenience method that checks the flag bit.
boolean
isSerif()
A convenience method that checks the flag bit.
boolean
isSmallCap()
A convenience method that checks the flag bit.
boolean
isSymbolic()
A convenience method that checks the flag bit.
void
setAllCap(boolean flag)
A convenience method that sets the flag bit.
abstract void
setAscent(float ascent)
This will set the ascent for the font.
abstract void
setAverageWidth(float averageWidth)
This will set the average width for the font.
abstract void
setCapHeight(float capHeight)
This will set the cap height for the font.
abstract void
setCharacterSet(String charSet)
This will set the character set for the font.
abstract void
setDescent(float descent)
This will set the descent for the font.
void
setFixedPitch(boolean flag)
A convenience method that sets the flag bit.
abstract void
setFlags(int flags)
This will set the font flags.
abstract void
setFontBoundingBox(PDRectangle rect)
Set the fonts bounding box.
abstract void
setFontFamily(String fontFamily)
This will set the font family.
abstract void
setFontName(String fontName)
This will set the font name.
abstract void
setFontStretch(String fontStretch)
This will set the font stretch.
abstract void
setFontWeight(float fontWeight)
Set the weight of the font.
void
setForceBold(boolean flag)
A convenience method that sets the flag bit.
void
setItalic(boolean flag)
A convenience method that sets the flag bit.
abstract void
setItalicAngle(float angle)
This will set the italic angle for the font.
abstract void
setLeading(float leading)
This will set the leading for the font.
abstract void
setMaxWidth(float maxWidth)
This will set the max width for the font.
void
setNonSymbolic(boolean flag)
A convenience method that sets the flag bit.
void
setScript(boolean flag)
A convenience method that sets the flag bit.
void
setSerif(boolean flag)
A convenience method that sets the flag bit.
void
setSmallCap(boolean flag)
A convenience method that sets the flag bit.
abstract void
setStemH(float stemH)
This will set the stem H for the font.
abstract void
setStemV(float stemV)
This will set the stem V for the font.
void
setSymbolic(boolean flag)
A convenience method that sets the flag bit.
abstract void
setXHeight(float xHeight)
This will set the x height for the font.

Method Details

getAscent

public abstract float getAscent()
This will get the ascent for the font.
Returns:
The ascent.

getAverageWidth

public abstract float getAverageWidth()
            throws IOException
This will get the average width for the font. This is part of the definition in the font description. If it is not present then PDFBox will make an attempt to calculate it.
Returns:
The average width value.

getCapHeight

public abstract float getCapHeight()
This will get the CapHeight for the font.
Returns:
The cap height.

getCharSet

public abstract String getCharSet()
This will get the character set for the font.
Returns:
The character set value.

getDescent

public abstract float getDescent()
This will get the descent for the font.
Returns:
The descent.

getFlags

public abstract int getFlags()
This will get the font flags.
Returns:
The font flags.

getFontBoundingBox

public abstract PDRectangle getFontBoundingBox()
This will get the fonts bouding box.
Returns:
The fonts bouding box.

getFontFamily

public abstract String getFontFamily()
A string representing the preferred font family.
Returns:
The font family.

getFontName

public abstract String getFontName()
Get the font name.
Returns:
The name of the font.

getFontStretch

public abstract String getFontStretch()
A string representing the preferred font stretch. According to the PDF Spec: The font stretch value; it must be one of the following (ordered from narrowest to widest): UltraCondensed, ExtraCondensed, Condensed, SemiCondensed, Normal, SemiExpanded, Expanded, ExtraExpanded or UltraExpanded.
Returns:
The font stretch.

getFontWeight

public abstract float getFontWeight()
The weight of the font. According to the PDF spec "possible values are 100, 200, 300, 400, 500, 600, 700, 800 or 900" Where a higher number is more weight and appears to be more bold.
Returns:
The font weight.

getItalicAngle

public abstract float getItalicAngle()
This will get the italic angle for the font.
Returns:
The italic angle.

getLeading

public abstract float getLeading()
This will get the leading for the font.
Returns:
The leading.

getMaxWidth

public abstract float getMaxWidth()
This will get the max width for the font.
Returns:
The max width value.

getStemH

public abstract float getStemH()
This will get the stemH for the font.
Returns:
The stem h value.

getStemV

public abstract float getStemV()
This will get the stemV for the font.
Returns:
The stem v value.

getXHeight

public abstract float getXHeight()
This will get the x height for the font.
Returns:
The x height.

isAllCap

public boolean isAllCap()
A convenience method that checks the flag bit.
Returns:
The flag value.

isFixedPitch

public boolean isFixedPitch()
A convenience method that checks the flag bit.
Returns:
The flag value.

isForceBold

public boolean isForceBold()
A convenience method that checks the flag bit.
Returns:
The flag value.

isItalic

public boolean isItalic()
A convenience method that checks the flag bit.
Returns:
The flag value.

isNonSymbolic

public boolean isNonSymbolic()
A convenience method that checks the flag bit.
Returns:
The flag value.

isScript

public boolean isScript()
A convenience method that checks the flag bit.
Returns:
The flag value.

isSerif

public boolean isSerif()
A convenience method that checks the flag bit.
Returns:
The flag value.

isSmallCap

public boolean isSmallCap()
A convenience method that checks the flag bit.
Returns:
The flag value.

isSymbolic

public boolean isSymbolic()
A convenience method that checks the flag bit.
Returns:
The flag value.

setAllCap

public void setAllCap(boolean flag)
A convenience method that sets the flag bit.
Parameters:
flag - The flag value.

setAscent

public abstract void setAscent(float ascent)
This will set the ascent for the font.
Parameters:
ascent - The new ascent for the font.

setAverageWidth

public abstract void setAverageWidth(float averageWidth)
This will set the average width for the font.
Parameters:
averageWidth - The new average width for the font.

setCapHeight

public abstract void setCapHeight(float capHeight)
This will set the cap height for the font.
Parameters:
capHeight - The new cap height for the font.

setCharacterSet

public abstract void setCharacterSet(String charSet)
This will set the character set for the font.
Parameters:
charSet - The new character set for the font.

setDescent

public abstract void setDescent(float descent)
This will set the descent for the font.
Parameters:
descent - The new descent for the font.

setFixedPitch

public void setFixedPitch(boolean flag)
A convenience method that sets the flag bit.
Parameters:
flag - The flag value.

setFlags

public abstract void setFlags(int flags)
This will set the font flags.
Parameters:
flags - The new font flags.

setFontBoundingBox

public abstract void setFontBoundingBox(PDRectangle rect)
Set the fonts bounding box.
Parameters:
rect - The new bouding box.

setFontFamily

public abstract void setFontFamily(String fontFamily)
This will set the font family.
Parameters:
fontFamily - The font family.

setFontName

public abstract void setFontName(String fontName)
This will set the font name.
Parameters:
fontName - The new name for the font.

setFontStretch

public abstract void setFontStretch(String fontStretch)
This will set the font stretch.
Parameters:
fontStretch - The font stretch

setFontWeight

public abstract void setFontWeight(float fontWeight)
Set the weight of the font.
Parameters:
fontWeight - The new weight of the font.

setForceBold

public void setForceBold(boolean flag)
A convenience method that sets the flag bit.
Parameters:
flag - The flag value.

setItalic

public void setItalic(boolean flag)
A convenience method that sets the flag bit.
Parameters:
flag - The flag value.

setItalicAngle

public abstract void setItalicAngle(float angle)
This will set the italic angle for the font.
Parameters:
angle - The new italic angle for the font.

setLeading

public abstract void setLeading(float leading)
This will set the leading for the font.
Parameters:
leading - The new leading for the font.

setMaxWidth

public abstract void setMaxWidth(float maxWidth)
This will set the max width for the font.
Parameters:
maxWidth - The new max width for the font.

setNonSymbolic

public void setNonSymbolic(boolean flag)
A convenience method that sets the flag bit.
Parameters:
flag - The flag value.

setScript

public void setScript(boolean flag)
A convenience method that sets the flag bit.
Parameters:
flag - The flag value.

setSerif

public void setSerif(boolean flag)
A convenience method that sets the flag bit.
Parameters:
flag - The flag value.

setSmallCap

public void setSmallCap(boolean flag)
A convenience method that sets the flag bit.
Parameters:
flag - The flag value.

setStemH

public abstract void setStemH(float stemH)
This will set the stem H for the font.
Parameters:
stemH - The new stem h for the font.

setStemV

public abstract void setStemV(float stemV)
This will set the stem V for the font.
Parameters:
stemV - The new stem v for the font.

setSymbolic

public void setSymbolic(boolean flag)
A convenience method that sets the flag bit.
Parameters:
flag - The flag value.

setXHeight

public abstract void setXHeight(float xHeight)
This will set the x height for the font.
Parameters:
xHeight - The new x height for the font.