Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.font

public final Class PDFontDescriptor

extends Object
implements COSObjectable
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.pdmodel.common.COSObjectable
Imports
org.apache.pdfbox.cos.COSArray, .COSDictionary, .COSName, .COSStream, .COSString, org.apache.pdfbox.pdmodel.common.COSObjectable, .PDRectangle, .PDStream

A font descriptor.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private float
private final COSDictionary
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private int
private float

Constructor Summary

AccessConstructor and Description
pack-priv
PDFontDescriptor()

Package-private constructor, for embedding.

public
PDFontDescriptor(COSDictionary
The wrapped COS Dictionary.
desc
)

Creates a PDFontDescriptor from a COS dictionary.

Method Summary

Modifier and TypeMethod and Description
public float

Returns:

The ascent.
getAscent
()

This will get the ascent for the font.

public float

Returns:

The average width value.
getAverageWidth
()

This will get the average width for the font.

public float

Returns:

The cap height.
getCapHeight
()

This will get the CapHeight for the font.

public String

Returns:

The character set value.
getCharSet
()

This will get the character set for the font.

public PDStream

Returns:

A stream containing a CIDSet.
getCIDSet
()

Get the CIDSet stream.

public COSDictionary

Returns:

The cos object that matches this Java object.
getCOSObject
()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS object.

public float

Returns:

The descent.
getDescent
()

This will get the descent for the font.

public int

Returns:

The font flags.
getFlags
()

This will get the font flags.

public PDRectangle

Returns:

The fonts bounding box.
getFontBoundingBox
()

This will get the fonts bounding box.

public String

Returns:

The font family.
getFontFamily
()

A string representing the preferred font family.

public PDStream

Returns:

A stream containing a Type 1 font program.
getFontFile
()

A stream containing a Type 1 font program.

public PDStream

Returns:

A stream containing a true type font program.
getFontFile2
()

A stream containing a true type font program.

public PDStream

Returns:

A stream containing a font program.
getFontFile3
()

A stream containing a font program that is not true type or type 1.

public String

Returns:

The name of the font.
getFontName
()

Get the font name.

public String

Returns:

The stretch of the font.
getFontStretch
()

A string representing the preferred font stretch.

public float

Returns:

The font weight.
getFontWeight
()

The weight of the font.

public float

Returns:

The italic angle.
getItalicAngle
()

This will get the italic angle for the font.

public float

Returns:

The leading.
getLeading
()

This will get the leading for the font.

public float

Returns:

The max width value.
getMaxWidth
()

This will get the max width for the font.

public float

Returns:

The missing width value, or 0 if there is no such dictionary entry.
getMissingWidth
()

This will get the missing width for the font from the /MissingWidth dictionary entry.

public PDPanose

Returns:

A Panose wrapper object.
getPanose
()

Returns the Panose entry of the Style dictionary, if any.

public float

Returns:

The stem h value.
getStemH
()

This will get the stemH for the font.

public float

Returns:

The stem v value.
getStemV
()

This will get the stemV for the font.

public float

Returns:

The x height.
getXHeight
()

This will get the x height for the font.

public boolean

Returns:

true if the missing widths entry is present in the font descriptor
hasMissingWidth
()

Returns true if the missing widths entry is present in the font descriptor.

public boolean

Returns:

true if widths are present in the font descriptor
hasWidths
()

Returns true if widths are present in the font descriptor.

public boolean

Returns:

The flag value.
isAllCap
()

A convenience method that checks the flag bit.

public boolean

Returns:

The flag value.
isFixedPitch
()

A convenience method that checks the flag bit.

private boolean
isFlagBitOn(int bit)

public boolean

Returns:

The flag value.
isForceBold
()

A convenience method that checks the flag bit.

public boolean

Returns:

The flag value.
isItalic
()

A convenience method that checks the flag bit.

public boolean

Returns:

The flag value.
isNonSymbolic
()

A convenience method that checks the flag bit.

public boolean

Returns:

The flag value.
isScript
()

A convenience method that checks the flag bit.

public boolean

Returns:

The flag value.
isSerif
()

A convenience method that checks the flag bit.

public boolean

Returns:

The flag value.
isSmallCap
()

A convenience method that checks the flag bit.

public boolean

Returns:

The flag value.
isSymbolic
()

A convenience method that checks the flag bit.

public void
setAllCap(boolean
The flag value.
flag
)

A convenience method that sets the flag bit.

public void
setAscent(float
The new ascent for the font.
ascent
)

This will set the ascent for the font.

public void
setAverageWidth(float
The new average width for the font.
averageWidth
)

This will set the average width for the font.

public void
setCapHeight(float
The new cap height for the font.
capHeight
)

This will set the cap height for the font.

public void
setCharacterSet(String
The new character set for the font.
charSet
)

This will set the character set for the font.

public void
setCIDSet(PDStream
The font program stream.
stream
)

Set a stream containing a CIDSet.

public void
setDescent(float
The new descent for the font.
descent
)

This will set the descent for the font.

public void
setFixedPitch(boolean
The flag value.
flag
)

A convenience method that sets the flag bit.

private void
setFlagBit(int bit, boolean value)

public void
setFlags(int
The new font flags.
flags
)

This will set the font flags.

public void
setFontBoundingBox(PDRectangle
The new bounding box.
rect
)

Set the fonts bounding box.

public void
setFontFamily(String
The font family.
fontFamily
)

This will set the font family.

public void
setFontFile(PDStream
The type 1 stream.
type1Stream
)

Set the type 1 font program.

public void
setFontFile2(PDStream
The true type stream.
ttfStream
)

Set the true type font program.

public void
setFontFile3(PDStream
The font program stream.
stream
)

Set a stream containing a font program that is not true type or type 1.

public void
setFontName(String
The new name for the font.
fontName
)

This will set the font name.

public void
setFontStretch(String
The new stretch for the font.
fontStretch
)

This will set the font stretch.

public void
setFontWeight(float
The new weight of the font.
fontWeight
)

Set the weight of the font.

public void
setForceBold(boolean
The flag value.
flag
)

A convenience method that sets the flag bit.

public void
setItalic(boolean
The flag value.
flag
)

A convenience method that sets the flag bit.

public void
setItalicAngle(float
The new italic angle for the font.
angle
)

This will set the italic angle for the font.

public void
setLeading(float
The new leading for the font.
leading
)

This will set the leading for the font.

public void
setMaxWidth(float
The new max width for the font.
maxWidth
)

This will set the max width for the font.

public void
setMissingWidth(float
The new missing width for the font.
missingWidth
)

This will set the missing width for the font.

public void
setNonSymbolic(boolean
The flag value.
flag
)

A convenience method that sets the flag bit.

public void
setScript(boolean
The flag value.
flag
)

A convenience method that sets the flag bit.

public void
setSerif(boolean
The flag value.
flag
)

A convenience method that sets the flag bit.

public void
setSmallCap(boolean
The flag value.
flag
)

A convenience method that sets the flag bit.

public void
setStemH(float
The new stem h for the font.
stemH
)

This will set the stem H for the font.

public void
setStemV(float
The new stem v for the font.
stemV
)

This will set the stem V for the font.

public void
setSymbolic(boolean
The flag value.
flag
)

A convenience method that sets the flag bit.

public void
setXHeight(float
The new x height for the font.
xHeight
)

This will set the x height for the font.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

capHeightback to summary
private float capHeight
dicback to summary
private final COSDictionary dic
FLAG_ALL_CAPback to summary
private static final int FLAG_ALL_CAP
FLAG_FIXED_PITCHback to summary
private static final int FLAG_FIXED_PITCH
FLAG_FORCE_BOLDback to summary
private static final int FLAG_FORCE_BOLD
FLAG_ITALICback to summary
private static final int FLAG_ITALIC
FLAG_NON_SYMBOLICback to summary
private static final int FLAG_NON_SYMBOLIC
FLAG_SCRIPTback to summary
private static final int FLAG_SCRIPT
FLAG_SERIFback to summary
private static final int FLAG_SERIF
FLAG_SMALL_CAPback to summary
private static final int FLAG_SMALL_CAP
FLAG_SYMBOLICback to summary
private static final int FLAG_SYMBOLIC
flagsback to summary
private int flags
xHeightback to summary
private float xHeight

Constructor Detail

PDFontDescriptorback to summary
pack-priv PDFontDescriptor()

Package-private constructor, for embedding.

PDFontDescriptorback to summary
public PDFontDescriptor(COSDictionary desc)

Creates a PDFontDescriptor from a COS dictionary.

Parameters
desc:COSDictionary

The wrapped COS Dictionary.

Method Detail

getAscentback to summary
public float getAscent()

This will get the ascent for the font.

Returns:float

The ascent.

getAverageWidthback to summary
public float getAverageWidth()

This will get the average width for the font.

Returns:float

The average width value.

getCapHeightback to summary
public float getCapHeight()

This will get the CapHeight for the font.

Returns:float

The cap height.

getCharSetback to summary
public String getCharSet()

This will get the character set for the font.

Returns:String

The character set value.

getCIDSetback to summary
public PDStream getCIDSet()

Get the CIDSet stream.

Returns:PDStream

A stream containing a CIDSet.

getCOSObjectback to summary
public COSDictionary getCOSObject()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS object.

Returns:COSDictionary

The cos object that matches this Java object.

Annotations
@Override
getDescentback to summary
public float getDescent()

This will get the descent for the font.

Returns:float

The descent.

getFlagsback to summary
public int getFlags()

This will get the font flags.

Returns:int

The font flags.

getFontBoundingBoxback to summary
public PDRectangle getFontBoundingBox()

This will get the fonts bounding box.

Returns:PDRectangle

The fonts bounding box.

getFontFamilyback to summary
public String getFontFamily()

A string representing the preferred font family.

Returns:String

The font family.

getFontFileback to summary
public PDStream getFontFile()

A stream containing a Type 1 font program.

Returns:PDStream

A stream containing a Type 1 font program.

getFontFile2back to summary
public PDStream getFontFile2()

A stream containing a true type font program.

Returns:PDStream

A stream containing a true type font program.

getFontFile3back to summary
public PDStream getFontFile3()

A stream containing a font program that is not true type or type 1.

Returns:PDStream

A stream containing a font program.

getFontNameback to summary
public String getFontName()

Get the font name.

Returns:String

The name of the font.

getFontStretchback to summary
public 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:String

The stretch of the font.

getFontWeightback to summary
public 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:float

The font weight.

getItalicAngleback to summary
public float getItalicAngle()

This will get the italic angle for the font.

Returns:float

The italic angle.

getLeadingback to summary
public float getLeading()

This will get the leading for the font.

Returns:float

The leading.

getMaxWidthback to summary
public float getMaxWidth()

This will get the max width for the font.

Returns:float

The max width value.

getMissingWidthback to summary
public float getMissingWidth()

This will get the missing width for the font from the /MissingWidth dictionary entry.

Returns:float

The missing width value, or 0 if there is no such dictionary entry.

getPanoseback to summary
public PDPanose getPanose()

Returns the Panose entry of the Style dictionary, if any.

Returns:PDPanose

A Panose wrapper object.

getStemHback to summary
public float getStemH()

This will get the stemH for the font.

Returns:float

The stem h value.

getStemVback to summary
public float getStemV()

This will get the stemV for the font.

Returns:float

The stem v value.

getXHeightback to summary
public float getXHeight()

This will get the x height for the font.

Returns:float

The x height.

hasMissingWidthback to summary
public boolean hasMissingWidth()

Returns true if the missing widths entry is present in the font descriptor.

Returns:boolean

true if the missing widths entry is present in the font descriptor

hasWidthsback to summary
public boolean hasWidths()

Returns true if widths are present in the font descriptor.

Returns:boolean

true if widths are present in the font descriptor

isAllCapback to summary
public boolean isAllCap()

A convenience method that checks the flag bit.

Returns:boolean

The flag value.

isFixedPitchback to summary
public boolean isFixedPitch()

A convenience method that checks the flag bit.

Returns:boolean

The flag value.

isFlagBitOnback to summary
private boolean isFlagBitOn(int bit)
isForceBoldback to summary
public boolean isForceBold()

A convenience method that checks the flag bit.

Returns:boolean

The flag value.

isItalicback to summary
public boolean isItalic()

A convenience method that checks the flag bit.

Returns:boolean

The flag value.

isNonSymbolicback to summary
public boolean isNonSymbolic()

A convenience method that checks the flag bit.

Returns:boolean

The flag value.

isScriptback to summary
public boolean isScript()

A convenience method that checks the flag bit.

Returns:boolean

The flag value.

isSerifback to summary
public boolean isSerif()

A convenience method that checks the flag bit.

Returns:boolean

The flag value.

isSmallCapback to summary
public boolean isSmallCap()

A convenience method that checks the flag bit.

Returns:boolean

The flag value.

isSymbolicback to summary
public boolean isSymbolic()

A convenience method that checks the flag bit.

Returns:boolean

The flag value.

setAllCapback to summary
public void setAllCap(boolean flag)

A convenience method that sets the flag bit.

Parameters
flag:boolean

The flag value.

setAscentback to summary
public void setAscent(float ascent)

This will set the ascent for the font.

Parameters
ascent:float

The new ascent for the font.

setAverageWidthback to summary
public void setAverageWidth(float averageWidth)

This will set the average width for the font.

Parameters
averageWidth:float

The new average width for the font.

setCapHeightback to summary
public void setCapHeight(float capHeight)

This will set the cap height for the font.

Parameters
capHeight:float

The new cap height for the font.

setCharacterSetback to summary
public void setCharacterSet(String charSet)

This will set the character set for the font.

Parameters
charSet:String

The new character set for the font.

setCIDSetback to summary
public void setCIDSet(PDStream stream)

Set a stream containing a CIDSet.

Parameters
stream:PDStream

The font program stream.

setDescentback to summary
public void setDescent(float descent)

This will set the descent for the font.

Parameters
descent:float

The new descent for the font.

setFixedPitchback to summary
public void setFixedPitch(boolean flag)

A convenience method that sets the flag bit.

Parameters
flag:boolean

The flag value.

setFlagBitback to summary
private void setFlagBit(int bit, boolean value)
setFlagsback to summary
public void setFlags(int flags)

This will set the font flags.

Parameters
flags:int

The new font flags.

setFontBoundingBoxback to summary
public void setFontBoundingBox(PDRectangle rect)

Set the fonts bounding box.

Parameters
rect:PDRectangle

The new bounding box.

setFontFamilyback to summary
public void setFontFamily(String fontFamily)

This will set the font family.

Parameters
fontFamily:String

The font family.

setFontFileback to summary
public void setFontFile(PDStream type1Stream)

Set the type 1 font program.

Parameters
type1Stream:PDStream

The type 1 stream.

setFontFile2back to summary
public void setFontFile2(PDStream ttfStream)

Set the true type font program.

Parameters
ttfStream:PDStream

The true type stream.

setFontFile3back to summary
public void setFontFile3(PDStream stream)

Set a stream containing a font program that is not true type or type 1.

Parameters
stream:PDStream

The font program stream.

setFontNameback to summary
public void setFontName(String fontName)

This will set the font name.

Parameters
fontName:String

The new name for the font.

setFontStretchback to summary
public void setFontStretch(String fontStretch)

This will set the font stretch.

Parameters
fontStretch:String

The new stretch for the font.

setFontWeightback to summary
public void setFontWeight(float fontWeight)

Set the weight of the font.

Parameters
fontWeight:float

The new weight of the font.

setForceBoldback to summary
public void setForceBold(boolean flag)

A convenience method that sets the flag bit.

Parameters
flag:boolean

The flag value.

setItalicback to summary
public void setItalic(boolean flag)

A convenience method that sets the flag bit.

Parameters
flag:boolean

The flag value.

setItalicAngleback to summary
public void setItalicAngle(float angle)

This will set the italic angle for the font.

Parameters
angle:float

The new italic angle for the font.

setLeadingback to summary
public void setLeading(float leading)

This will set the leading for the font.

Parameters
leading:float

The new leading for the font.

setMaxWidthback to summary
public void setMaxWidth(float maxWidth)

This will set the max width for the font.

Parameters
maxWidth:float

The new max width for the font.

setMissingWidthback to summary
public void setMissingWidth(float missingWidth)

This will set the missing width for the font.

Parameters
missingWidth:float

The new missing width for the font.

setNonSymbolicback to summary
public void setNonSymbolic(boolean flag)

A convenience method that sets the flag bit.

Parameters
flag:boolean

The flag value.

setScriptback to summary
public void setScript(boolean flag)

A convenience method that sets the flag bit.

Parameters
flag:boolean

The flag value.

setSerifback to summary
public void setSerif(boolean flag)

A convenience method that sets the flag bit.

Parameters
flag:boolean

The flag value.

setSmallCapback to summary
public void setSmallCap(boolean flag)

A convenience method that sets the flag bit.

Parameters
flag:boolean

The flag value.

setStemHback to summary
public void setStemH(float stemH)

This will set the stem H for the font.

Parameters
stemH:float

The new stem h for the font.

setStemVback to summary
public void setStemV(float stemV)

This will set the stem V for the font.

Parameters
stemV:float

The new stem v for the font.

setSymbolicback to summary
public void setSymbolic(boolean flag)

A convenience method that sets the flag bit.

Parameters
flag:boolean

The flag value.

setXHeightback to summary
public void setXHeight(float xHeight)

This will set the x height for the font.

Parameters
xHeight:float

The new x height for the font.