org.freehep.graphicsio.ps
Class PSFontTable

java.lang.Object
  extended by org.freehep.graphicsio.font.FontTable
      extended by org.freehep.graphicsio.ps.PSFontTable

public class PSFontTable
extends FontTable

FontTable for PS files. The fonts name is used as a reference for the font. When the font is first used, it is embedded to the file if it is not a standard font. If it is unknown it is not substituted.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.freehep.graphicsio.font.FontTable
FontTable.Entry
 
Constructor Summary
PSFontTable(java.io.OutputStream out, java.awt.font.FontRenderContext context)
           
 
Method Summary
protected  java.lang.String createFontReference(java.awt.Font font)
          Uses the font name as a reference.
protected  void firstRequest(FontTable.Entry e, boolean embed, java.lang.String embedAs)
          Called whenever a specific font is used for the first time.
 CharTable getEncodingTable()
          Returns a default CharTable to be used for normal text (not Symbol or Dingbats).
static void normalize(java.util.Map attributes)
          Replaces TextAttribute.FAMILY by values of replaceFonts.
protected  java.awt.Font substituteFont(java.awt.Font font)
          removes any transformation and superscript, changes the names to PS font name
 
Methods inherited from class org.freehep.graphicsio.font.FontTable
fontReference, getEntries
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSFontTable

public PSFontTable(java.io.OutputStream out,
                   java.awt.font.FontRenderContext context)
Method Detail

getEncodingTable

public CharTable getEncodingTable()
Description copied from class: FontTable
Returns a default CharTable to be used for normal text (not Symbol or Dingbats).

Specified by:
getEncodingTable in class FontTable

firstRequest

protected void firstRequest(FontTable.Entry e,
                            boolean embed,
                            java.lang.String embedAs)
                     throws java.io.IOException
Description copied from class: FontTable
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.

Specified by:
firstRequest in class FontTable
Throws:
java.io.IOException

substituteFont

protected java.awt.Font substituteFont(java.awt.Font font)
removes any transformation and superscript, changes the names to PS font name

Specified by:
substituteFont in class FontTable
Parameters:
font -
Returns:
derived font

createFontReference

protected java.lang.String createFontReference(java.awt.Font font)
Uses the font name as a reference. Whitespace is stripped. The font style (italic/bold) is added as a suffix delimited by a dash. Uses normalize(java.util.Map)

Specified by:
createFontReference in class FontTable

normalize

public static void normalize(java.util.Map attributes)
Replaces TextAttribute.FAMILY by values of replaceFonts. Whitespace is family name stripped. When a font created using the result of this method the transformation would be: java.awt.Font[family=SansSerif,name=SansSerif,style=plain,size=30]
will result to:
java.awt.Font[family=SansSerif,name=Helvetica,style=plain,size=30]

Uses FontTable.normalize(java.util.Map) first.

Parameters:
attributes - with font name to change


Copyright © 2000-2007 FreeHEP. All Rights Reserved.