This class represents an implementation to the font descriptor that gets its
information from a COS Dictionary.
Method from org.apache.pdfbox.pdmodel.font.PDFontDescriptorDictionary Detail: |
public float getAscent() {
return dic.getFloat( "Ascent", 0 );
}
This will get the ascent for the font. |
public float getAverageWidth() {
return dic.getFloat( "AvgWidth", 0 );
}
This will get the average width for the font. |
public COSDictionary getCOSDictionary() {
return dic;
}
This will get the dictionary for this object. |
public COSBase getCOSObject() {
return dic;
}
Convert this standard java object to a COS object. |
public float getCapHeight() {
if(capHeight==Float.NEGATIVE_INFINITY){
/* We observed a negative value being returned with
* the Scheherazade font. PDFBOX-429 was logged for this.
* We are not sure if returning the absolute value
* is the correct fix, but it seems to work. */
capHeight = java.lang.Math.abs(dic.getFloat( "CapHeight", 0 ));
}
return capHeight;
}
This will get the CapHeight for the font. |
public String getCharSet() {
String retval = null;
COSString name = (COSString)dic.getDictionaryObject( COSName.CHAR_SET );
if( name != null )
{
retval = name.getString();
}
return retval;
}
This will get the character set for the font. |
public float getDescent() {
return dic.getFloat( "Descent", 0 );
}
This will get the descent for the font. |
public int getFlags() {
return dic.getInt( "Flags", 0 );
}
This will get the font flags. |
public PDRectangle getFontBoundingBox() {
COSArray rect = (COSArray)dic.getDictionaryObject( COSName.FONT_BBOX );
PDRectangle retval = null;
if( rect != null )
{
retval = new PDRectangle( rect );
}
return retval;
}
This will get the fonts bouding box. |
public String getFontFamily() {
String retval = null;
COSString name = (COSString)dic.getDictionaryObject( COSName.FONT_FAMILY );
if( name != null )
{
retval = name.getString();
}
return retval;
}
A string representing the preferred font family. |
public PDStream getFontFile() {
PDStream retval = null;
COSStream stream = (COSStream)dic.getDictionaryObject( "FontFile" );
if( stream != null )
{
retval = new PDStream( stream );
}
return retval;
}
A stream containing a Type 1 font program. |
public PDStream getFontFile2() {
PDStream retval = null;
COSStream stream = (COSStream)dic.getDictionaryObject( "FontFile2" );
if( stream != null )
{
retval = new PDStream( stream );
}
return retval;
}
A stream containing a true type font program. |
public PDStream getFontFile3() {
PDStream retval = null;
COSStream stream = (COSStream)dic.getDictionaryObject( "FontFile3" );
if( stream != null )
{
retval = new PDStream( stream );
}
return retval;
}
A stream containing a font program that is not true type or type 1. |
public String getFontName() {
String retval = null;
COSName name = (COSName)dic.getDictionaryObject( COSName.FONT_NAME );
if( name != null )
{
retval = name.getName();
}
return retval;
}
|
public String getFontStretch() {
String retval = null;
COSName name = (COSName)dic.getDictionaryObject( COSName.FONT_STRETCH );
if( name != null )
{
retval = name.getName();
}
return retval;
}
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. |
public float getFontWeight() {
return dic.getFloat( "FontWeight",0 );
}
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. |
public float getItalicAngle() {
return dic.getFloat( "ItalicAngle", 0 );
}
This will get the italic angle for the font. |
public float getLeading() {
return dic.getFloat( "Leading", 0 );
}
This will get the leading for the font. |
public float getMaxWidth() {
return dic.getFloat( "MaxWidth", 0 );
}
This will get the max width for the font. |
public float getMissingWidth() {
return dic.getFloat( "MissingWidth", 0 );
}
This will get the missing width for the font. |
public float getStemH() {
return dic.getFloat( "StemH", 0 );
}
This will get the stemH for the font. |
public float getStemV() {
return dic.getFloat( "StemV", 0 );
}
This will get the stemV for the font. |
public float getXHeight() {
if(xHeight==Float.NEGATIVE_INFINITY){
/* We observed a negative value being returned with
* the Scheherazade font. PDFBOX-429 was logged for this.
* We are not sure if returning the absolute value
* is the correct fix, but it seems to work. */
xHeight = java.lang.Math.abs(dic.getFloat( "XHeight", 0 ));
}
return xHeight;
}
This will get the x height for the font. |
public void setAscent(float ascent) {
dic.setFloat( "Ascent", ascent );
}
This will set the ascent for the font. |
public void setAverageWidth(float averageWidth) {
dic.setFloat( "AvgWidth", averageWidth );
}
This will set the average width for the font. |
public void setCapHeight(float capHeight) {
dic.setFloat( "CapHeight", capHeight );
this.capHeight = capHeight;
}
This will set the cap height for the font. |
public void setCharacterSet(String charSet) {
COSString name = null;
if( charSet != null )
{
name = new COSString( charSet );
}
dic.setItem( COSName.CHAR_SET, name );
}
This will set the character set for the font. |
public void setDescent(float descent) {
dic.setFloat( "Descent", descent );
}
This will set the descent for the font. |
public void setFlags(int flags) {
dic.setInt( "Flags", flags );
}
This will set the font flags. |
public void setFontBoundingBox(PDRectangle rect) {
COSArray array = null;
if( rect != null )
{
array = rect.getCOSArray();
}
dic.setItem( COSName.FONT_BBOX, array );
}
Set the fonts bounding box. |
public void setFontFamily(String fontFamily) {
COSString name = null;
if( fontFamily != null )
{
name = new COSString( fontFamily );
}
dic.setItem( COSName.FONT_FAMILY, name );
}
This will set the font family. |
public void setFontFile(PDStream type1Stream) {
dic.setItem( "FontFile", type1Stream );
}
Set the type 1 font program. |
public void setFontFile2(PDStream ttfStream) {
dic.setItem( "FontFile2", ttfStream );
}
Set the true type font program. |
public void setFontFile3(PDStream stream) {
dic.setItem( "FontFile3", stream );
}
Set a stream containing a font program that is not true type or type 1. |
public void setFontName(String fontName) {
COSName name = null;
if( fontName != null )
{
name = COSName.getPDFName( fontName );
}
dic.setItem( COSName.FONT_NAME, name );
}
This will set the font name. |
public void setFontStretch(String fontStretch) {
COSName name = null;
if( fontStretch != null )
{
name = COSName.getPDFName( fontStretch );
}
dic.setItem( COSName.FONT_STRETCH, name );
}
This will set the font stretch. |
public void setFontWeight(float fontWeight) {
dic.setFloat( "FontWeight", fontWeight );
}
Set the weight of the font. |
public void setItalicAngle(float angle) {
dic.setFloat( "ItalicAngle", angle );
}
This will set the italic angle for the font. |
public void setLeading(float leading) {
dic.setFloat( "Leading", leading );
}
This will set the leading for the font. |
public void setMaxWidth(float maxWidth) {
dic.setFloat( "MaxWidth", maxWidth );
}
This will set the max width for the font. |
public void setMissingWidth(float missingWidth) {
dic.setFloat( "MissingWidth", missingWidth );
}
This will set the missing width for the font. |
public void setStemH(float stemH) {
dic.setFloat( "StemH", stemH );
}
This will set the stem H for the font. |
public void setStemV(float stemV) {
dic.setFloat( "StemV", stemV );
}
This will set the stem V for the font. |
public void setXHeight(float xHeight) {
dic.setFloat( "XHeight", xHeight );
this.xHeight = xHeight;
}
This will set the x height for the font. |