Package org.apache.pdfbox.pdmodel.font
Class PDFontDescriptor
java.lang.Object
org.apache.pdfbox.pdmodel.font.PDFontDescriptor
- Direct Known Subclasses:
PDFontDescriptorAFM
,PDFontDescriptorDictionary
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract float
This will get the ascent for the font.abstract float
This will get the average width for the font.abstract float
This will get the CapHeight for the font.abstract String
This will get the character set for the font.abstract float
This will get the descent for the font.abstract int
getFlags()
This will get the font flags.abstract PDRectangle
This will get the fonts bouding box.abstract String
A string representing the preferred font family.abstract String
Get the font name.abstract String
A string representing the preferred font stretch.abstract float
The weight of the font.abstract float
This will get the italic angle for the font.abstract float
This will get the leading for the font.abstract float
This will get the max width for the font.abstract float
This will get the missing 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
This will get the x height for the font.boolean
isAllCap()
A convenience method that checks the flag bit.boolean
A convenience method that checks the flag bit.boolean
A convenience method that checks the flag bit.boolean
isItalic()
A convenience method that checks the flag bit.boolean
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
A convenience method that checks the flag bit.boolean
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
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.abstract 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.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.
-
Constructor Details
-
PDFontDescriptor
public PDFontDescriptor()
-
-
Method Details
-
getFontName
Get the font name.- Returns:
- The name of the font.
-
setFontName
This will set the font name.- Parameters:
fontName
- The new name for the font.
-
getFontFamily
A string representing the preferred font family.- Returns:
- The font family.
-
setFontFamily
This will set the font family.- Parameters:
fontFamily
- The font family.
-
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.
-
setFontStretch
This will set the font stretch.- Parameters:
fontStretch
- 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.
-
setFontWeight
public abstract void setFontWeight(float fontWeight) Set the weight of the font.- Parameters:
fontWeight
- The new weight of the font.
-
getFlags
public abstract int getFlags()This will get the font flags.- Returns:
- The font flags.
-
setFlags
public abstract void setFlags(int flags) This will set the font flags.- Parameters:
flags
- The new font flags.
-
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.
-
getFontBoundingBox
This will get the fonts bouding box.- Returns:
- The fonts bouding box.
-
setFontBoundingBox
Set the fonts bounding box.- Parameters:
rect
- The new bouding box.
-
getItalicAngle
public abstract float getItalicAngle()This will get the italic angle for the font.- Returns:
- The italic angle.
-
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.
-
getAscent
public abstract float getAscent()This will get the ascent for the font.- Returns:
- The ascent.
-
setAscent
public abstract void setAscent(float ascent) This will set the ascent for the font.- Parameters:
ascent
- The new ascent for the font.
-
getDescent
public abstract float getDescent()This will get the descent for the font.- Returns:
- The descent.
-
setDescent
public abstract void setDescent(float descent) This will set the descent for the font.- Parameters:
descent
- The new descent for the font.
-
getLeading
public abstract float getLeading()This will get the leading for the font.- Returns:
- The leading.
-
setLeading
public abstract void setLeading(float leading) This will set the leading for the font.- Parameters:
leading
- The new leading for the font.
-
getCapHeight
public abstract float getCapHeight()This will get the CapHeight for the font.- Returns:
- The cap height.
-
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.
-
getXHeight
public abstract float getXHeight()This will get the x height for the font.- Returns:
- The x height.
-
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.
-
getStemV
public abstract float getStemV()This will get the stemV for the font.- Returns:
- The stem v value.
-
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.
-
getStemH
public abstract float getStemH()This will get the stemH for the font.- Returns:
- The stem h 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.
-
getAverageWidth
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.
- Throws:
IOException
- If there is an error calculating the average width.
-
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.
-
getMaxWidth
public abstract float getMaxWidth()This will get the max width for the font.- Returns:
- The max width value.
-
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.
-
getCharSet
This will get the character set for the font.- Returns:
- The character set value.
-
setCharacterSet
This will set the character set for the font.- Parameters:
charSet
- The new character set for the font.
-
getMissingWidth
public abstract float getMissingWidth()This will get the missing width for the font.- Returns:
- The missing width value.
-
setMissingWidth
public abstract void setMissingWidth(float missingWidth) This will set the missing width for the font.- Parameters:
missingWidth
- The new missing width for the font.
-