org.apache.pdfbox.pdmodel.font

## Class PDFontDescriptor

- java.lang.Object
- - org.apache.pdfbox.pdmodel.font.PDFontDescriptor

All Implemented Interfaces:
  COSObjectable

    public final class PDFontDescriptor
    extends Object
    implements COSObjectable

A font descriptor.

Author:
  Ben Litchfield

### Constructor Summary

Constructors
Constructor and Description
`PDFontDescriptor(COSDictionary desc)` Creates a PDFontDescriptor from a COS dictionary.

### Method Summary

All Methods Instance Methods Concrete Methods
`float` `getAscent()` This will get the ascent for the font.
`float` `getAverageWidth()` This will get the average width for the font.
`float` `getCapHeight()` This will get the CapHeight for the font.
`String` `getCharSet()` This will get the character set for the font.
`PDStream` `getCIDSet()` Get the CIDSet stream.
`COSDictionary` `getCOSObject()` Convert this standard java object to a COS object.
`float` `getDescent()` This will get the descent for the font.
`int` `getFlags()` This will get the font flags.
`PDRectangle` `getFontBoundingBox()` This will get the fonts bounding box.
`String` `getFontFamily()` A string representing the preferred font family.
`PDStream` `getFontFile()` A stream containing a Type 1 font program.
`PDStream` `getFontFile2()` A stream containing a true type font program.
`PDStream` `getFontFile3()` A stream containing a font program that is not true type or type 1.
`String` `getFontName()` Get the font name.
`String` `getFontStretch()` A string representing the preferred font stretch.
`float` `getFontWeight()` The weight of the font.
`float` `getItalicAngle()` This will get the italic angle for the font.
`float` `getLeading()` This will get the leading for the font.
`float` `getMaxWidth()` This will get the max width for the font.
`float` `getMissingWidth()` This will get the missing width for the font from the /MissingWidth dictionary entry.
`PDPanose` `getPanose()` Returns the Panose entry of the Style dictionary, if any.
`float` `getStemH()` This will get the stemH for the font.
`float` `getStemV()` This will get the stemV for the font.
`float` `getXHeight()` This will get the x height for the font.
`boolean` `hasMissingWidth()` Returns true if the missing widths entry is present in the font descriptor.
`boolean` `hasWidths()` Returns true if widths are present in the font descriptor.
`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.
`void` `setAscent(float ascent)` This will set the ascent for the font.
`void` `setAverageWidth(float averageWidth)` This will set the average width for the font.
`void` `setCapHeight(float capHeight)` This will set the cap height for the font.
`void` `setCharacterSet(String charSet)` This will set the character set for the font.
`void` `setCIDSet(PDStream stream)` Set a stream containing a CIDSet.
`void` `setDescent(float descent)` This will set the descent for the font.
`void` `setFixedPitch(boolean flag)` A convenience method that sets the flag bit.
`void` `setFlags(int flags)` This will set the font flags.
`void` `setFontBoundingBox(PDRectangle rect)` Set the fonts bounding box.
`void` `setFontFamily(String fontFamily)` This will set the font family.
`void` `setFontFile(PDStream type1Stream)` Set the type 1 font program.
`void` `setFontFile2(PDStream ttfStream)` Set the true type font program.
`void` `setFontFile3(PDStream stream)` Set a stream containing a font program that is not true type or type 1.
`void` `setFontName(String fontName)` This will set the font name.
`void` `setFontStretch(String fontStretch)` This will set the font stretch.
`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.
`void` `setItalicAngle(float angle)` This will set the italic angle for the font.
`void` `setLeading(float leading)` This will set the leading for the font.
`void` `setMaxWidth(float maxWidth)` This will set the max width for the font.
`void` `setMissingWidth(float missingWidth)` This will set the missing 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.
`void` `setStemH(float stemH)` This will set the stem H for the font.
`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.
`void` `setXHeight(float xHeight)` This will set the x height for the font.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PDFontDescriptor

    public PDFontDescriptor(COSDictionary desc)

Creates a PDFontDescriptor from a COS dictionary.

Parameters:
  `desc` - The wrapped COS Dictionary.

### Method Detail

#### isFixedPitch

    public boolean isFixedPitch()

A convenience method that checks the flag bit.

Returns:
  The flag value.

#### setFixedPitch

    public void setFixedPitch(boolean flag)

A convenience method that sets the flag bit.

Parameters:
  `flag` - The flag value.

#### isSerif

    public boolean isSerif()

A convenience method that checks the flag bit.

Returns:
  The flag value.

#### setSerif

    public void setSerif(boolean flag)

A convenience method that sets the flag bit.

Parameters:
  `flag` - The flag value.

#### isSymbolic

    public boolean isSymbolic()

A convenience method that checks the flag bit.

Returns:
  The flag value.

#### setSymbolic

    public void setSymbolic(boolean flag)

A convenience method that sets the flag bit.

Parameters:
  `flag` - The flag value.

#### isScript

    public boolean isScript()

A convenience method that checks the flag bit.

Returns:
  The flag value.

#### setScript

    public void setScript(boolean flag)

A convenience method that sets the flag bit.

Parameters:
  `flag` - The flag value.

#### isNonSymbolic

    public boolean isNonSymbolic()

A convenience method that checks the flag bit.

Returns:
  The flag value.

#### setNonSymbolic

    public void setNonSymbolic(boolean flag)

A convenience method that sets the flag bit.

Parameters:
  `flag` - The flag value.

#### isItalic

    public boolean isItalic()

A convenience method that checks the flag bit.

Returns:
  The flag value.

#### setItalic

    public void setItalic(boolean flag)

A convenience method that sets the flag bit.

Parameters:
  `flag` - The flag value.

#### isAllCap

    public boolean isAllCap()

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.

#### isSmallCap

    public boolean isSmallCap()

A convenience method that checks the flag bit.

Returns:
  The flag value.

#### setSmallCap

    public void setSmallCap(boolean flag)

A convenience method that sets the flag bit.

Parameters:
  `flag` - The flag value.

#### isForceBold

    public boolean isForceBold()

A convenience method that checks the flag bit.

Returns:
  The flag value.

#### setForceBold

    public void setForceBold(boolean flag)

A convenience method that sets the flag bit.

Parameters:
  `flag` - The flag value.

#### getCOSObject

    public COSDictionary getCOSObject()

Convert this standard java object to a COS object.

Specified by:
  `getCOSObject` in interface `COSObjectable`
Returns:
  The cos object that matches this Java object.

#### getFontName

    public String getFontName()

Get the font name.

Returns:
  The name of the font.

#### setFontName

    public void setFontName(String fontName)

This will set the font name.

Parameters:
  `fontName` - The new name for the font.

#### getFontFamily

    public String getFontFamily()

A string representing the preferred font family.

Returns:
  The font family.

#### setFontFamily

    public void setFontFamily(String fontFamily)

This will set the font family.

Parameters:
  `fontFamily` - The font family.

#### getFontWeight

    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:
  The font weight.

#### setFontWeight

    public void setFontWeight(float fontWeight)

Set the weight of the font.

Parameters:
  `fontWeight` - The new weight of the font.

#### getFontStretch

    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:
  The stretch of the font.

#### setFontStretch

    public void setFontStretch(String fontStretch)

This will set the font stretch.

Parameters:
  `fontStretch` - The new stretch for the font.

#### getFlags

    public int getFlags()

This will get the font flags.

Returns:
  The font flags.

#### setFlags

    public void setFlags(int flags)

This will set the font flags.

Parameters:
  `flags` - The new font flags.

#### getFontBoundingBox

    public PDRectangle getFontBoundingBox()

This will get the fonts bounding box.

Returns:
  The fonts bounding box.

#### setFontBoundingBox

    public void setFontBoundingBox(PDRectangle rect)

Set the fonts bounding box.

Parameters:
  `rect` - The new bounding box.

#### getItalicAngle

    public float getItalicAngle()

This will get the italic angle for the font.

Returns:
  The italic angle.

#### setItalicAngle

    public void setItalicAngle(float angle)

This will set the italic angle for the font.

Parameters:
  `angle` - The new italic angle for the font.

#### getAscent

    public float getAscent()

This will get the ascent for the font.

Returns:
  The ascent.

#### setAscent

    public void setAscent(float ascent)

This will set the ascent for the font.

Parameters:
  `ascent` - The new ascent for the font.

#### getDescent

    public float getDescent()

This will get the descent for the font.

Returns:
  The descent.

#### setDescent

    public void setDescent(float descent)

This will set the descent for the font.

Parameters:
  `descent` - The new descent for the font.

#### getLeading

    public float getLeading()

This will get the leading for the font.

Returns:
  The leading.

#### setLeading

    public void setLeading(float leading)

This will set the leading for the font.

Parameters:
  `leading` - The new leading for the font.

#### getCapHeight

    public float getCapHeight()

This will get the CapHeight for the font.

Returns:
  The cap height.

#### setCapHeight

    public void setCapHeight(float capHeight)

This will set the cap height for the font.

Parameters:
  `capHeight` - The new cap height for the font.

#### getXHeight

    public float getXHeight()

This will get the x height for the font.

Returns:
  The x height.

#### setXHeight

    public void setXHeight(float xHeight)

This will set the x height for the font.

Parameters:
  `xHeight` - The new x height for the font.

#### getStemV

    public float getStemV()

This will get the stemV for the font.

Returns:
  The stem v value.

#### setStemV

    public void setStemV(float stemV)

This will set the stem V for the font.

Parameters:
  `stemV` - The new stem v for the font.

#### getStemH

    public float getStemH()

This will get the stemH for the font.

Returns:
  The stem h value.

#### setStemH

    public void setStemH(float stemH)

This will set the stem H for the font.

Parameters:
  `stemH` - The new stem h for the font.

#### getAverageWidth

    public float getAverageWidth()

This will get the average width for the font.

Returns:
  The average width value.

#### setAverageWidth

    public void setAverageWidth(float averageWidth)

This will set the average width for the font.

Parameters:
  `averageWidth` - The new average width for the font.

#### getMaxWidth

    public float getMaxWidth()

This will get the max width for the font.

Returns:
  The max width value.

#### setMaxWidth

    public void setMaxWidth(float maxWidth)

This will set the max width for the font.

Parameters:
  `maxWidth` - The new max width for the font.

#### hasWidths

    public boolean hasWidths()

Returns true if widths are present in the font descriptor.

#### hasMissingWidth

    public boolean hasMissingWidth()

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

#### getMissingWidth

    public float getMissingWidth()

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

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

#### setMissingWidth

    public void setMissingWidth(float missingWidth)

This will set the missing width for the font.

Parameters:
  `missingWidth` - The new missing width for the font.

#### getCharSet

    public String getCharSet()

This will get the character set for the font.

Returns:
  The character set value.

#### setCharacterSet

    public void setCharacterSet(String charSet)

This will set the character set for the font.

Parameters:
  `charSet` - The new character set for the font.

#### getFontFile

    public PDStream getFontFile()

A stream containing a Type 1 font program.

Returns:
  A stream containing a Type 1 font program.

#### setFontFile

    public void setFontFile(PDStream type1Stream)

Set the type 1 font program.

Parameters:
  `type1Stream` - The type 1 stream.

#### getFontFile2

    public PDStream getFontFile2()

A stream containing a true type font program.

Returns:
  A stream containing a true type font program.

#### setFontFile2

    public void setFontFile2(PDStream ttfStream)

Set the true type font program.

Parameters:
  `ttfStream` - The true type stream.

#### getFontFile3

    public PDStream getFontFile3()

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

Returns:
  A stream containing a font program.

#### setFontFile3

    public void setFontFile3(PDStream stream)

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

Parameters:
  `stream` - The font program stream.

#### getCIDSet

    public PDStream getCIDSet()

Get the CIDSet stream.

Returns:
  A stream containing a CIDSet.

#### setCIDSet

    public void setCIDSet(PDStream stream)

Set a stream containing a CIDSet.

Parameters:
  `stream` - The font program stream.

#### getPanose

    public PDPanose getPanose()

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

Returns:
  A Panose wrapper object.