org.freehep.graphicsio.font
Class FontTable

java.lang.Object
  extended by org.freehep.graphicsio.font.FontTable
Direct Known Subclasses:
PDFFontTable, PSFontTable

public abstract class FontTable
extends java.lang.Object

A table to remember which fonts were used while writing a document.

Version:
$Id: FontTable.java 10516 2007-02-06 21:11:19Z duns $
Author:
Simon Fischer

Nested Class Summary
protected  class FontTable.Entry
           
 
Constructor Summary
FontTable()
           
 
Method Summary
protected abstract  java.lang.String createFontReference(java.awt.Font f)
          Creates a unique reference to address this font.
protected abstract  void firstRequest(FontTable.Entry e, boolean embed, java.lang.String embedAs)
          Called whenever a specific font is used for the first time.
 java.lang.String fontReference(java.awt.Font font, boolean embed, java.lang.String embedAs)
          Returns a name for this font that can be used in the document.
abstract  CharTable getEncodingTable()
          Returns a default CharTable to be used for normal text (not Symbol or Dingbats).
 java.util.Collection getEntries()
          Returns a Collection view of all fonts.
static void normalize(java.util.Map attributes)
          creates a normalized attribute map, e.g.
protected abstract  java.awt.Font substituteFont(java.awt.Font font)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontTable

public FontTable()
Method Detail

getEncodingTable

public abstract CharTable getEncodingTable()
Returns a default CharTable to be used for normal text (not Symbol or Dingbats).


firstRequest

protected abstract void firstRequest(FontTable.Entry e,
                                     boolean embed,
                                     java.lang.String embedAs)
                              throws java.io.IOException
Called whenever a specific font is used for the first time. Subclasses may use this method to include the font instantly. This method may change the value of the reference by calling e.setReference(String) e.g. if it wants to substitute the font by a standard font that can be addressed under a name different from the generated one.

Throws:
java.io.IOException

createFontReference

protected abstract java.lang.String createFontReference(java.awt.Font f)
Creates a unique reference to address this font.


substituteFont

protected abstract java.awt.Font substituteFont(java.awt.Font font)

fontReference

public java.lang.String fontReference(java.awt.Font font,
                                      boolean embed,
                                      java.lang.String embedAs)
Returns a name for this font that can be used in the document. A new name is generated if the font was not used yet. For different fontsizes the same name is returned.


normalize

public static void normalize(java.util.Map attributes)
creates a normalized attribute map, e.g. java.awt.Font[family=Dialog,name=dialog.bold,style=plain,size=20] becomes java.awt.Font[family=Dialog,name=Dialog,style=bold,size=20]

Parameters:
attributes -

getEntries

public java.util.Collection getEntries()
Returns a Collection view of all fonts. The elements of the collection are Entries.



Copyright © 2000-2007 FreeHEP. All Rights Reserved.