org.pdfbox.pdmodel.font

Class PDType0Font

Implemented Interfaces:
COSObjectable

public class PDType0Font
extends PDFont

This is implementation of the Type0 Font.
Version:
$Revision: 1.9 $
Author:
Ben Litchfield

Field Summary

Fields inherited from class org.pdfbox.pdmodel.font.PDFont

font

Constructor Summary

PDType0Font()
Constructor.
PDType0Font(COSDictionary fontDictionary)
Constructor.

Method Summary

void
drawString(String string, Graphics g, float fontSize, float xScale, float yScale, float x, float y)
float
getAverageFontWidth()
This will get the average font width for all characters.
PDRectangle
getFontBoundingBox()
This will get the fonts bouding box.
float
getFontHeight(byte[] c, int offset, int length)
This will get the font height for a character.
float
getFontWidth(byte[] c, int offset, int length)
This will get the font width for a character.

Methods inherited from class org.pdfbox.pdmodel.font.PDFont

clearResources, drawString, encode, equals, getAFM, getAverageFontWidth, getAverageFontWidthFromAFMFile, getBaseFont, getCOSObject, getCodeFromArray, getEncoding, getFirstChar, getFontBoundingBox, getFontHeight, getFontMatrix, getFontWidth, getFontWidthFromAFMFile, getLastChar, getStringWidth, getSubType, getType, getWidths, hashCode, setBaseFont, setEncoding, setFirstChar, setLastChar, setWidths

Constructor Details

PDType0Font

public PDType0Font()
Constructor.

PDType0Font

public PDType0Font(COSDictionary fontDictionary)
Constructor.
Parameters:
fontDictionary - The font dictionary according to the PDF specification.

Method Details

drawString

public void drawString(String string,
                       Graphics g,
                       float fontSize,
                       float xScale,
                       float yScale,
                       float x,
                       float y)
Overrides:
drawString in interface PDFont

getAverageFontWidth

public float getAverageFontWidth()
            throws IOException
This will get the average font width for all characters.
Overrides:
getAverageFontWidth in interface PDFont
Returns:
The width is in 1000 unit of text space, ie 333 or 777

getFontBoundingBox

public PDRectangle getFontBoundingBox()
            throws IOException
This will get the fonts bouding box.
Overrides:
getFontBoundingBox in interface PDFont
Returns:
The fonts bouding box.

getFontHeight

public float getFontHeight(byte[] c,
                           int offset,
                           int length)
            throws IOException
This will get the font height for a character.
Overrides:
getFontHeight in interface PDFont
Parameters:
c - The character code to get the height for.
offset - The offset into the array.
length - The length of the data.
Returns:
The width is in 1000 unit of text space, ie 333 or 777

getFontWidth

public float getFontWidth(byte[] c,
                          int offset,
                          int length)
            throws IOException
This will get the font width for a character.
Overrides:
getFontWidth in interface PDFont
Parameters:
c - The character code to get the width for.
offset - The offset into the array.
length - The length of the data.
Returns:
The width is in 1000 unit of text space, ie 333 or 777