org.pentaho.reporting.libraries.fonts.itext
Class BaseFontSupport

java.lang.Object
  extended by org.pentaho.reporting.libraries.fonts.itext.BaseFontSupport

public class BaseFontSupport
extends java.lang.Object

iText font support.

Author:
Thomas Morgner

Constructor Summary
BaseFontSupport(ITextFontRegistry registry)
          Creates a new support instance.
BaseFontSupport(ITextFontRegistry registry, java.lang.String defaultEncoding)
           
 
Method Summary
 BaseFont awtToPdf(java.awt.Font font)
          Returns a BaseFont which can be used to represent the given AWT Font
 void close()
          Close the font support.
 BaseFont createBaseFont(java.lang.String logicalName, boolean bold, boolean italic, java.lang.String encoding, boolean embedded)
          Creates a iText-BaseFont for an font.
 BaseFontRecord createBaseFontRecord(java.lang.String logicalName, boolean bold, boolean italic, java.lang.String encoding, boolean embedded)
          Creates a BaseFontRecord for an font.
 java.lang.String getDefaultEncoding()
           
 boolean isEmbedFonts()
           
 java.awt.Font pdfToAwt(BaseFont font, int size)
          Returns an AWT Font which can be used to represent the given BaseFont
 void setDefaultEncoding(java.lang.String defaultEncoding)
           
 void setEmbedFonts(boolean embedFonts)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseFontSupport

public BaseFontSupport(ITextFontRegistry registry)
Creates a new support instance.


BaseFontSupport

public BaseFontSupport(ITextFontRegistry registry,
                       java.lang.String defaultEncoding)
Method Detail

getDefaultEncoding

public java.lang.String getDefaultEncoding()

setDefaultEncoding

public void setDefaultEncoding(java.lang.String defaultEncoding)

isEmbedFonts

public boolean isEmbedFonts()

setEmbedFonts

public void setEmbedFonts(boolean embedFonts)

close

public void close()
Close the font support.


createBaseFont

public BaseFont createBaseFont(java.lang.String logicalName,
                               boolean bold,
                               boolean italic,
                               java.lang.String encoding,
                               boolean embedded)
                        throws BaseFontCreateException
Creates a iText-BaseFont for an font. If no basefont could be created, an BaseFontCreateException is thrown.

Parameters:
logicalName - the name of the font (null not permitted).
bold - a flag indicating whether the font is rendered as bold font.
italic - a flag indicating whether the font is rendered as italic or cursive font.
encoding - the encoding.
embedded - a flag indicating whether to embed the font glyphs in the generated documents.
Returns:
the base font record.
Throws:
BaseFontCreateException - if there was a problem setting the font for the target.

createBaseFontRecord

public BaseFontRecord createBaseFontRecord(java.lang.String logicalName,
                                           boolean bold,
                                           boolean italic,
                                           java.lang.String encoding,
                                           boolean embedded)
                                    throws BaseFontCreateException
Creates a BaseFontRecord for an font. If no basefont could be created, an BaseFontCreateException is thrown.

Parameters:
logicalName - the name of the font (null not permitted).
bold - a flag indicating whether the font is rendered as bold font.
italic - a flag indicating whether the font is rendered as italic or cursive font.
encoding - the encoding.
embedded - a flag indicating whether to embed the font glyphs in the generated documents.
Returns:
the base font record.
Throws:
BaseFontCreateException - if there was a problem setting the font for the target.

awtToPdf

public BaseFont awtToPdf(java.awt.Font font)
Returns a BaseFont which can be used to represent the given AWT Font

Parameters:
font - the font to be converted
Returns:
a BaseFont which has similar properties to the provided Font

pdfToAwt

public java.awt.Font pdfToAwt(BaseFont font,
                              int size)
Returns an AWT Font which can be used to represent the given BaseFont

Parameters:
font - the font to be converted
size - the desired point size of the resulting font
Returns:
a Font which has similar properties to the provided BaseFont