net.sf.jett.model
Class FontCache

java.lang.Object
  extended by net.sf.jett.model.FontCache

public class FontCache
extends java.lang.Object

A FontCache is used internally to keep track of Fonts. It defines and uses a string format for declaring all possible font values that can be defined in a Font. Its lifetime is meant to last only during a single transformation. When created, it reads in all pre-existing Font information and caches it for later reference.

Since:
0.5.0
Author:
Randy Gettman

Constructor Summary
FontCache(org.apache.poi.ss.usermodel.Workbook workbook)
          Constructs a FontCache on a Workbook.
 
Method Summary
 void cacheFont(org.apache.poi.ss.usermodel.Font f)
          Caches the given Font.
 int getNumEntries()
          Returns the number of entries in this cache.
 org.apache.poi.ss.usermodel.Font retrieveFont(short fontBoldweight, boolean fontItalic, org.apache.poi.ss.usermodel.Color fontColor, java.lang.String fontName, short fontHeightInPoints, byte fontUnderline, boolean fontStrikeout, int fontCharset, short fontTypeOffset)
          Retrieve a Font from the cache with the given properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontCache

public FontCache(org.apache.poi.ss.usermodel.Workbook workbook)
Constructs a FontCache on a Workbook. Caches all Fonts found within.

Parameters:
workbook - A Workbook.
Method Detail

getNumEntries

public int getNumEntries()
Returns the number of entries in this cache.

Returns:
The number of entries in this cache.

retrieveFont

public org.apache.poi.ss.usermodel.Font retrieveFont(short fontBoldweight,
                                                     boolean fontItalic,
                                                     org.apache.poi.ss.usermodel.Color fontColor,
                                                     java.lang.String fontName,
                                                     short fontHeightInPoints,
                                                     byte fontUnderline,
                                                     boolean fontStrikeout,
                                                     int fontCharset,
                                                     short fontTypeOffset)
Retrieve a Font from the cache with the given properties.

Parameters:
fontBoldweight - The font boldweight.
fontItalic - Whether the font is italic.
fontColor - The font color.
fontName - The font name.
fontHeightInPoints - The font height in points.
fontUnderline - The font underline.
fontStrikeout - Whether the font is in strikeout.
fontCharset - The font charset.
fontTypeOffset - The font type offset.
Returns:
A Font that matches all given properties, or null if it doesn't exist.

cacheFont

public void cacheFont(org.apache.poi.ss.usermodel.Font f)
Caches the given Font.

Parameters:
f - A Font.


Copyright © 2012-2013 Jett Team. All Rights Reserved.