JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.page
Class FontLibrary

java.lang.Object
  |
  +--com.klg.jclass.page.FontLibrary

public class FontLibrary
extends Object

Stores lists of available fonts in Hashtables for easy lookup, sometimes depending on output type. The list of stock fonts for PDF output and the files that contain them is currently found in the font.map file in the com.klg.jclass.sreport.adobe.fonts package. The list of stock fonts for RTF output is currently found in the font.map file in the com.klg.jclass.sreport.rtf package. The list of user font names that logically map to these fonts is currently found in com.klg.jclass.sreport.adobe.JCAdobeFontMap class for PDF output and the com.klg.jclass.sreport.rtf.JCRTFFontMap class for RTF output. Default directories are searched for additional TrueType fonts that are added to the list of available fonts. Users may specify additional fonts by directory or by font file name. User-added directories are searched for font name map resource bundle files named user.properties, but such files can also be added manually. Automatic font mapping is also attempted for TrueType fonts. User-specified font name mapping takes precedence over built-in mapping of stock fonts, which itself takes precedence over automatic font name mapping.


Field Summary
static int AFM
          Type 1 Font (backed with .afm file)
static int ALL_FILE_TYPES
          Special case: all file types!
protected static boolean autoLoad
          True if default font directories should be searched for fonts.
protected static Hashtable automaticFontNameMapTable
          Table of automatically generate font name mappings from possible user font names to the real font name as used by ServerReport internals.
static Hashtable[] availableFonts
          Array of Hashtables containing available fonts have been read from the default font directories or have been specified by a user.
static Hashtable[] availableStockFonts
          Array of Hashtables containing available stock fonts.
protected static String defaultUserFontBundleName
          Name before ".properties" in user font name map bundle name.
protected static com.klg.jclass.page.FontLibrary fontLibraryInstance
          Actual instance of FontLibrary.
static int NUM_OUTPUT_TYPES
          Number of output types supported.
static int PDF
          Output Type: PDF.
static ResourceBundle[] stockFontNameMapBundles
          Array of stock font name map bundles containing default mappings for stock fonts.
protected static boolean suppressErrorMessages
          True if font-related error messages should be suppressed.
static Hashtable trueTypeFontProperties
          Global hashtable storing user properties for use of true type fonts.
static int TTF
          TrueType Font
protected static List userFontBundleLookups
          Corresponding List of FontFileLookup objects that were used to find the font bundles.
protected static List[] userFontBundles
          Array of ResourceBundle lists representing the font name resource bundles for user-added font packages.
 
Method Summary
protected static String addAFMToAvailableFonts(com.klg.jclass.page.FontFileLookup afmFile)
          Add the font inside the AFM file represented by the passed FontFileLookup object to the list of available fonts by doing a quick parse of the afm file to determine the name of the font that is contained within.
static void addFont(String fileLocation)
          Add the font represented by the specified .afm or .ttf file to the hashtable of available fonts.
static void addFont(URL fontURL, int fontType)
          Add the font represented by the specified AFM or TrueType file to the hashtable of available fonts.
static void addFontNameMap(ResourceBundle fontBundle, int fileType)
          Add the values contained in the specified font name map to PageLayout's global font name map.
static void addFontNameMap(String location, String name)
          Add the values contained in the specified font name map to ServerReport's global font name map regardless of the type of the font file.
static void addFontNameMap(String location, String name, int fileType)
          Add the values contained in the specified font name map to ServerReport's global font name map for fonts of the specified file type (TTF or AFM).
static void addFontNameMap(URL location)
          Add the values contained in the specified font name map to ServerReport's global font name map regardless of the type of the font file.
static void addFontNameMap(URL location, int fileType)
          Add the values contained in the specified font name map to ServerReport's global font name map for fonts of the specified file type (TTF, AFM or NAMED).
static void addFontNameMap(URL location, String name)
          Add the values contained in the specified font name map to ServerReport's global font name map regardless of the type of the font file.
static void addFontNameMap(URL location, String name, int fileType)
          Add the values contained in the specified font name map to ServerReport's global font name map for fonts of the specified file type (TTF, AFM or NAMED).
protected static void addFontNameMapBundle(com.klg.jclass.page.FontFileLookup propLook, int fileType)
          Add the values contained in the specified font name map to ServerReport's global font name map for fonts of the specified file type (TTF, AFM or NAMED).
static void addFontPackage(String packagePath)
          Add any fonts represented by .afm or .ttf files in the provided directory (and all of its subdirectories) to the hashtable of available fonts.
static void addFontPackage(String packagePath, boolean recurse)
          Add any fonts represented by .afm or .ttf files in the provided directory (and all of its subdirectories, if recurse is set to true) to the hashtable of available fonts.
static void addRelativeFont(String fileLocation)
          Add the font represented by the specified AFM or TrueType file to the hashtable of available fonts.
static void addRelativeFontNameMap(String location, String name)
          Add the values contained in the specified font name map to ServerReport's global font name map regardless of the type of the font file.
static void addRelativeFontNameMap(String location, String name, int fileType)
          Add the values contained in the specified font name map to ServerReport's global font name map for fonts of the specified file type (TTF, AFM or NAMED).
protected static List addTTFToAvailableFonts(com.klg.jclass.page.FontFileLookup ttfFile)
          Add the font inside the TTF file represented by the passed FontFileLookup object to the list of available fonts by doing a quick parse of the ttf file to determine the name of the font that is contained within.
static String[] getAvailableFontNames()
          Return list of all font name aliases that are used across all output types.
static String[] getAvailableFontNames(int outputType)
          Return list of all font name aliases specified with respect to the specified output type.
static boolean getSuppressErrorMessages()
          Get the SuppressErrorMessages property, which determines if font-related error messages are being suppressed.
static com.klg.jclass.page.TrueTypeFontProperties getTrueTypeFontProperties(String userFontName, int outputType)
          Get the TrueTypeFontProperties class associated with the given user font name.
static List getTTFFontNames(String fileLocation)
          Returns the list of font names contained with a TTF file.
static List getTTFFontNames(URL fontURL)
          Returns the list of font names contained with a TTF file.
static void initFontLibrary()
          Initialize FontLibrary class by creating an instance and calling its constructor (if this hasn't been done yet).
static boolean isAFMFile(String fileName)
          Check to see if passed file name is an AFM file by examining its extension.
static boolean isAutoLoad()
          Get the AutoLoad property, which determines if default directories are automatically searched.
static boolean isTrueTypeFile(String fileName)
          Check to see if passed file name is a TrueType file (.ttf, .ttc) by examining its extension.
static String lookupAutomaticFontName(String fontName)
          Look up the specified font name in the automatic font name map.
static com.klg.jclass.page.FontFileLookup lookupFontFile(String fontName, int outputType)
          Lookup the font file (as encapsulated by the FontFileLookup object) by the actual font name, depending on the output type.
static String lookupFontNameByUserAlias(String key, int outputType)
          Find the actual name of the desired font by looking up the given user alias in the various font name map resource bundles.
static String lookupStockFontName(String fontName, int outputType)
          Look up the specified font name in the stock font name map resource bundle associated with the passed output type.
static com.klg.jclass.page.TrueTypeFontProperties lookupTrueTypeFontProperties(String realFontName)
          Get the TrueTypeFontProperties class associated with the given real font name.
static String lookupUserFontName(String fontName, int outputType)
          Look up the specified font name alias in the list of user-supplied font name map resource bundles associated with the specified output type.
static void setAutoLoad(boolean al)
          Set the AutoLoad property, which determines if default directories are automatically searched.
static void setSuppressErrorMessages(boolean suppress)
          Set the SuppressErrorMessages property, which suppresses font-related error messages if set to true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AFM

public static final int AFM
Type 1 Font (backed with .afm file)

See Also:
Constant Field Values

TTF

public static final int TTF
TrueType Font

See Also:
Constant Field Values

ALL_FILE_TYPES

public static final int ALL_FILE_TYPES
Special case: all file types!

See Also:
Constant Field Values

PDF

public static final int PDF
Output Type: PDF. Used to determine which stock font map to use during font lookup.

See Also:
Constant Field Values

NUM_OUTPUT_TYPES

public static final int NUM_OUTPUT_TYPES
Number of output types supported. Currently 1.

See Also:
Constant Field Values

availableFonts

public static Hashtable[] availableFonts
Array of Hashtables containing available fonts have been read from the default font directories or have been specified by a user. Indexed by output type (PDF or RTF). (Stock fonts used by the various output formats are stored in a separate variable.) Keys are actual font names (often derived from looking up the user's font alias name in the font name map resource bundles). Values are FontFileLookup classes encapsulating the location of the afm or ttf file backing the font.


availableStockFonts

public static Hashtable[] availableStockFonts
Array of Hashtables containing available stock fonts. Indexed by output type (PDF or RTF). Keys are actual font names (often derived from looking up the user's font alias name in the font name map resource bundles). Values are FontFileLookup classes encapsulating the location of the afm or ttf file backing the font. This array is populated in the constructor.


stockFontNameMapBundles

public static ResourceBundle[] stockFontNameMapBundles
Array of stock font name map bundles containing default mappings for stock fonts. Indexed by output type. These mappings take precedence over the automatically generated mappings but are overridden by any user-specified mappings. Null indicates no map exists for the corresponding output type. This array is populated in the constructor of the respective output types.


defaultUserFontBundleName

protected static final String defaultUserFontBundleName
Name before ".properties" in user font name map bundle name.

See Also:
Constant Field Values

userFontBundles

protected static List[] userFontBundles
Array of ResourceBundle lists representing the font name resource bundles for user-added font packages. Indexed by output type.


userFontBundleLookups

protected static List userFontBundleLookups
Corresponding List of FontFileLookup objects that were used to find the font bundles. Used to avoid loading bundles that have already been loaded.


automaticFontNameMapTable

protected static Hashtable automaticFontNameMapTable
Table of automatically generate font name mappings from possible user font names to the real font name as used by ServerReport internals. These mappings are overridden by the stock font name mappings and any user-specified mappings.


trueTypeFontProperties

public static Hashtable trueTypeFontProperties
Global hashtable storing user properties for use of true type fonts. Keys are the same font names used in the availableFonts hashtable. Values are TrueTypeFontProperties objects.


autoLoad

protected static boolean autoLoad
True if default font directories should be searched for fonts. Default is false. Default font directories include, specifically,
C:\WINNT\fonts
C:\WINDOWS\Fonts
/usr/share/fonts
/usr/lib/X11/fonts
. These directories can be loaded automatically by setting this property to true. To load other directories, leave false and use

fontLibraryInstance

protected static com.klg.jclass.page.FontLibrary fontLibraryInstance
Actual instance of FontLibrary. Currently only used so that the constructor is never called twice.


suppressErrorMessages

protected static boolean suppressErrorMessages
True if font-related error messages should be suppressed. Default is true.

Method Detail

initFontLibrary

public static void initFontLibrary()
Initialize FontLibrary class by creating an instance and calling its constructor (if this hasn't been done yet).


setAutoLoad

public static void setAutoLoad(boolean al)
Set the AutoLoad property, which determines if default directories are automatically searched. Default is true.

Parameters:
al - the new value of the AutoLoad property.

isAutoLoad

public static boolean isAutoLoad()
Get the AutoLoad property, which determines if default directories are automatically searched. Default is true.

Returns:
the value of the AutoLoad property.

setSuppressErrorMessages

public static void setSuppressErrorMessages(boolean suppress)
Set the SuppressErrorMessages property, which suppresses font-related error messages if set to true. Default is false.

Parameters:
suppress - the new value of the SuppressErrorMessages property.

getSuppressErrorMessages

public static boolean getSuppressErrorMessages()
Get the SuppressErrorMessages property, which determines if font-related error messages are being suppressed. Default is false.

Returns:
the value of the SuppressErrorMessages property.

addFontPackage

public static void addFontPackage(String packagePath)
Add any fonts represented by .afm or .ttf files in the provided directory (and all of its subdirectories) to the hashtable of available fonts. These directories are also stored for use in reading font files when they become needed. If a font name map resource bundle property file of name "user" and corresponding to the default locale exists in the directory, it is also loaded and its contents added to ServerReport's global font name map. (For example, for the North American/English locale, the directory is first searched for the file named "user_en_US.properties", then "user_en.properties" and finally "user.properties". Font name map files outline the names the user will refer to fonts by the and the names by which they're referred inside the corresponding .afm or .ttf file.) This method may be called via the convenience method in JCDocument.

Parameters:
packagePath - a String representing the absolute location of the directory which contains both font files (.afm or .ttf) and a font name map resource bundle property file (e.g. "user.properties").

addFontPackage

public static void addFontPackage(String packagePath,
                                  boolean recurse)
Add any fonts represented by .afm or .ttf files in the provided directory (and all of its subdirectories, if recurse is set to true) to the hashtable of available fonts. These directories are also stored for use in reading font files when they become needed. If a font name map resource bundle property file of name "user" and corresponding to the default locale exists in the directory, it is also loaded and its contents added to ServerReport's global font name map. (For example, for the North American/English locale, the directory is first searched for the file named "user_en_US.properties", then "user_en.properties" and finally "user.properties". Font name map files outline the names the user will refer to fonts by the and the names by which they're referred inside the corresponding .afm or .ttf file.) This method may be called via the convenience method in JCDocument.

Parameters:
packagePath - a String representing the absolute location of the directory which contains both font files (.afm or .ttf) and a font name map resource bundle property file (e.g. "user.properties").
recurse - if true, all subdirectories under provided directory will also be parsed for font files and font name map files

addFont

public static void addFont(String fileLocation)
                    throws IOException
Add the font represented by the specified .afm or .ttf file to the hashtable of available fonts. The specified font file location must be the absolute location of the desired file and will be stored for use in reading the font file when it is needed.

Parameters:
fileLocation - a String representing the absolute location of a .afm or .ttf font file.
IOException

addFont

public static void addFont(URL fontURL,
                           int fontType)
                    throws IOException
Add the font represented by the specified AFM or TrueType file to the hashtable of available fonts. The specified font file location must be the absolute location of the desired file and will be stored for use in reading the font file when it is needed.

Parameters:
fontURL - an URL representing the absolute location of a font file in either .afm or .ttf format
fontType - either AFM or TTF, depending on the contents located at the destination represented by fontURL
IOException

addRelativeFont

public static void addRelativeFont(String fileLocation)
                            throws IOException
Add the font represented by the specified AFM or TrueType file to the hashtable of available fonts. The specified font file location must be a location relative to the classpath. It will be stored for use in reading the font file when it is needed.

Parameters:
fileLocation - a String representing the relative location of a .afm or .ttf font file. It is assumed that the location begins at the tops of the classpath entries. (In other words, if the location does not begin with a '/', one is added.)
IOException

addAFMToAvailableFonts

protected static String addAFMToAvailableFonts(com.klg.jclass.page.FontFileLookup afmFile)
                                        throws IOException
Add the font inside the AFM file represented by the passed FontFileLookup object to the list of available fonts by doing a quick parse of the afm file to determine the name of the font that is contained within. AFM fonts are used for PDF output only.

Parameters:
afmFile - a FontFileLookup object referencing an .afm file
Returns:
name of AFM font added. May be null if no file was found at the provided location.
IOException

addTTFToAvailableFonts

protected static List addTTFToAvailableFonts(com.klg.jclass.page.FontFileLookup ttfFile)
                                      throws IOException
Add the font inside the TTF file represented by the passed FontFileLookup object to the list of available fonts by doing a quick parse of the ttf file to determine the name of the font that is contained within. AFM fonts are used for both PDF and RTF output.

Parameters:
ttfFile - a FontFileLookup object referencing an .afm file
Returns:
List of names of TTF fonts added. May be null if no file was found at the provided location.
IOException

addFontNameMap

public static void addFontNameMap(String location,
                                  String name)
                           throws IOException
Add the values contained in the specified font name map to ServerReport's global font name map regardless of the type of the font file. The font name map must be located in a resource bundle .properties file and is subject to standard resource bundle localization processing. In other words, the resource bundle that is eventually read by this method is the one that exists at the specified location and whose file name represents the most appropriate bundle for the default locale. For example, for the specified name of "user" in the North American/English locale, this method will first look for the a resource bundle in the file "user_en_US.properties", then "user_en.properties" and finally "user.properties".

Parameters:
location - the absolute path of the directory containing the font name map resource bundle file(s).
name - the name of the resource bundle. This name should not contain any locale-specific information or a file extension, as this information will be provided by the method. For example, names should be of the name "file", not "file.properties" or "file_en_US.properties".
IOException

addFontNameMap

public static void addFontNameMap(String location,
                                  String name,
                                  int fileType)
                           throws IOException
Add the values contained in the specified font name map to ServerReport's global font name map for fonts of the specified file type (TTF or AFM). The font name map must be located in a resource bundle .properties file and is subject to standard resource bundle localization processing. In other words, the resource bundle that is eventually read by this method is the one that exists at the specified location and whose file name represents the most appropriate bundle for the default locale. For example, for the specified name of "user" in the North American/English locale, this method will first look for the a resource bundle in the file "user_en_US.properties", then "user_en.properties" and finally "user.properties".

Parameters:
location - the absolute path of the directory containing the font name map resource bundle file(s).
name - the name of the resource bundle. This name should not contain any locale-specific information or a file extension, as this information will be provided by the method. For example, names should be of the name "file", not "file.properties" or "file_en_US.properties".
fileType - type of font the values in this map should be used with. One of TTF, AFM or NAMED.
IOException

addFontNameMapBundle

protected static void addFontNameMapBundle(com.klg.jclass.page.FontFileLookup propLook,
                                           int fileType)
                                    throws IOException
Add the values contained in the specified font name map to ServerReport's global font name map for fonts of the specified file type (TTF, AFM or NAMED). The font name map must be located in a resource bundle .properties file and is subject to standard resource bundle localization processing. In other words, the resource bundle that is eventually read by this method is the one that exists at the location specified by the FontFileLookup object and whose file name represents the most appropriate bundle for the default locale. For example, for a FontFileLookup object referencing the specified name of "user" in the North American/English locale, this method will first look for the a resource bundle in the file "user_en_US.properties", then "user_en.properties" and finally "user.properties".

Parameters:
propLook - FontFileLookup object representing location of resource properties file
fileType - type of font the values in this map should be used with. One of TTF, AFM or NAMED.
IOException

addFontNameMap

public static void addFontNameMap(URL location,
                                  String name)
                           throws IOException
Add the values contained in the specified font name map to ServerReport's global font name map regardless of the type of the font file. The font name map must be located in a resource bundle .properties file and is subject to standard resource bundle localization processing. In other words, the resource bundle that is eventually read by this method is the one that exists at the specified location and whose file name represents the most appropriate bundle for the default locale. For example, for the specified name of "user" in the North American/English locale, this method will first look for the a resource bundle in the file "user_en_US.properties", then "user_en.properties" and finally "user.properties".

Parameters:
location - the absolute path of the directory containing the font name map resource bundle file(s) specified as an URL.
name - the name of the resource bundle. This name should not contain any locale-specific information or a file extension, as this information will be provided by the method. For example, names should be of the name "file", not "file.properties" or "file_en_US.properties".
IOException

addFontNameMap

public static void addFontNameMap(ResourceBundle fontBundle,
                                  int fileType)
Add the values contained in the specified font name map to PageLayout's global font name map. Use of the other methods is recommended for better performance, as they try to reduce the number of ResourceBundles stored.

Parameters:
fontBundle - An existing font name map bundle.
fileType - type of font the values in this map should be used with. One of TTF or AFM.

addFontNameMap

public static void addFontNameMap(URL location,
                                  String name,
                                  int fileType)
                           throws IOException
Add the values contained in the specified font name map to ServerReport's global font name map for fonts of the specified file type (TTF, AFM or NAMED). The font name map must be located in a resource bundle .properties file and is subject to standard resource bundle localization processing. In other words, the resource bundle that is eventually read by this method is the one that exists at the specified location and whose file name represents the most appropriate bundle for the default locale. For example, for the specified name of "user" in the North American/English locale, this method will first look for the a resource bundle in the file "user_en_US.properties", then "user_en.properties" and finally "user.properties".

Parameters:
location - the absolute path of the directory containing the font name map resource bundle file(s) specified as an URL.
name - the name of the resource bundle. This name should not contain any locale-specific information or a file extension, as this information will be provided by the method. For example, names should be of the name "file", not "file.properties" or "file_en_US.properties".
fileType - type of font the values in this map should be used with. One of TTF, AFM or NAMED.
IOException

addFontNameMap

public static void addFontNameMap(URL location)
                           throws IOException
Add the values contained in the specified font name map to ServerReport's global font name map regardless of the type of the font file. The font name map located at the specified URL must be a resource bundle .properties-style stream, but this particular method does not apply any of the standard resource bundle localization processing to the specified URL. In other words, the resource bundle that is eventually read by this method is exactly the one specified in the passed URL.

Parameters:
location - the absolute path of the desired font name map resource bundle file specified as an URL.
IOException

addFontNameMap

public static void addFontNameMap(URL location,
                                  int fileType)
                           throws IOException
Add the values contained in the specified font name map to ServerReport's global font name map for fonts of the specified file type (TTF, AFM or NAMED). The font name map located at the specified URL must be a resource bundle .properties-style stream, but this particular method does not apply any of the standard resource bundle localization processing to the specified URL. In other words, the resource bundle that is eventually read by this method is exactly the one specified in the passed URL.

Parameters:
location - the absolute path of the desired font name map resource bundle file specified as an URL.
fileType - type of font the values in this map should be used with. One of TTF, AFM or NAMED.
IOException

addRelativeFontNameMap

public static void addRelativeFontNameMap(String location,
                                          String name)
                                   throws IOException
Add the values contained in the specified font name map to ServerReport's global font name map regardless of the type of the font file. The font name map must be located in a resource bundle .properties file and is subject to standard resource bundle localization processing. In other words, the resource bundle that is eventually read by this method is the one that exists at the specified location and whose file name represents the most appropriate bundle for the default locale. For example, for the specified name of "user" in the North American/English locale, this method will first look for the a resource bundle in the file "user_en_US.properties", then "user_en.properties" and finally "user.properties".

Parameters:
location - the path of the directory containing the font name map resource bundle file(s), specified as a directory relative to the classpath. It is assumed that the location begins at the tops of the classpath entries. (In other words, if the location does not begin with a '/', one is added.)
name - the name of the resource bundle. This name should not contain any locale-specific information or a file extension, as this information will be provided by the method. For example, names should be of the name "file", not "file.properties" or "file_en_US.properties".
IOException

addRelativeFontNameMap

public static void addRelativeFontNameMap(String location,
                                          String name,
                                          int fileType)
                                   throws IOException
Add the values contained in the specified font name map to ServerReport's global font name map for fonts of the specified file type (TTF, AFM or NAMED). The font name map located at the specified URL must be a resource bundle .properties-style stream, but this particular method does not apply any of the standard resource bundle localization processing to the specified URL. In other words, the resource bundle that is eventually read by this method is exactly the one specified in the passed URL.

Parameters:
location - the absolute path of the desired font name map resource bundle file specified as an URL.
fileType - type of font the values in this map should be used with. One of TTF, AFM or NAMED.
IOException

lookupFontNameByUserAlias

public static String lookupFontNameByUserAlias(String key,
                                               int outputType)
Find the actual name of the desired font by looking up the given user alias in the various font name map resource bundles. The bundles are searched in the following order: user specified font name maps, stock font name maps for the passed output type, automatically font name maps generated from true type files found on the system. If not found in any of the font name maps, see if the name maps directly to a font. If so, the font name is its own alias.

Parameters:
key - the name used by the user to reference the font
outputType - the output type currently being used, which determines which stock font packages will be searched. One of PDF or RTF.
Returns:
the actual name of the font as found in its .ttf or .afm file

lookupStockFontName

public static String lookupStockFontName(String fontName,
                                         int outputType)
Look up the specified font name in the stock font name map resource bundle associated with the passed output type. If it is found, return the corresponding font name alias. If not, return null.

Parameters:
fontName - the user font name used for lookup
outputType - the output type currently being used, which determines which stock font packages will be searched. One of PDF or RTF.
Returns:
the alias for the specified font name from the stock font name map resource bundle

lookupAutomaticFontName

public static String lookupAutomaticFontName(String fontName)
Look up the specified font name in the automatic font name map. The automatic font name map is a list of possible mappings generated automatically when TrueType fonts are loaded into the FontLibrary. These mappings map possible user aliases to the font's real name, as is used by the internals of ServerReport.

Parameters:
fontName - the user font name used for lookup
Returns:
the alias for the specified font name from the automatic font name map table

lookupUserFontName

public static String lookupUserFontName(String fontName,
                                        int outputType)
Look up the specified font name alias in the list of user-supplied font name map resource bundles associated with the specified output type. If it is found, return the font name that is being aliased. If not, return null.

Parameters:
fontName - user font name alias
outputType - One of PDF or RTF. Determines which user font bundles are searched for the alias.
Returns:
the font name associated with the specified font name alias in the user-supplied font name map resource bundles for the specified output type.

getAvailableFontNames

public static String[] getAvailableFontNames()
Return list of all font name aliases that are used across all output types.

Returns:
array of font name aliases used across all output types.

getAvailableFontNames

public static String[] getAvailableFontNames(int outputType)
Return list of all font name aliases specified with respect to the specified output type.

Parameters:
outputType - - only PDF type supported in this release.
Returns:
array of font name aliases used with respect to the specified output type.

lookupFontFile

public static com.klg.jclass.page.FontFileLookup lookupFontFile(String fontName,
                                                                int outputType)
Lookup the font file (as encapsulated by the FontFileLookup object) by the actual font name, depending on the output type.


getTrueTypeFontProperties

public static com.klg.jclass.page.TrueTypeFontProperties getTrueTypeFontProperties(String userFontName,
                                                                                   int outputType)
Get the TrueTypeFontProperties class associated with the given user font name. If one does not exist, one is created with default values. The given user font name is mapped to the real font name as defined in the backing font file, meaning that even if several user aliases refer to the same font, only a single TrueTypeFontProperties class will be associated eith the font.

Parameters:
userFontName - the user font name. This will be mapped to the real font name.
outputType - the output type being used. One of PDF or RTF. This is used to determine which bundle stock fonts to look up the font name.
Returns:
the instance of TrueTypeFontProperties associated with the font name.

lookupTrueTypeFontProperties

public static com.klg.jclass.page.TrueTypeFontProperties lookupTrueTypeFontProperties(String realFontName)
Get the TrueTypeFontProperties class associated with the given real font name. If one does not exist, one is created with default values.

Parameters:
realFontName - the real name of the font this properties class is associated with.
Returns:
the instance of TrueTypeFontProperties associated with the font name.

isAFMFile

public static boolean isAFMFile(String fileName)
Check to see if passed file name is an AFM file by examining its extension.

Returns:
true if the passed file name is an AFM file; false otherwise.

isTrueTypeFile

public static boolean isTrueTypeFile(String fileName)
Check to see if passed file name is a TrueType file (.ttf, .ttc) by examining its extension.

Returns:
true if the passed file name is a TrueType file; false otherwise.

getTTFFontNames

public static List getTTFFontNames(String fileLocation)
                            throws IOException
Returns the list of font names contained with a TTF file.

Parameters:
fileLocation - the absolute location of the TTF file on the filesystem
Returns:
a List containing the names (as Strings) for each font contained within the specified TTF file. These names are the ones used internally within ServerReport to identify the font.
IOException

getTTFFontNames

public static List getTTFFontNames(URL fontURL)
                            throws IOException
Returns the list of font names contained with a TTF file.

Parameters:
fontURL - the absolute location of the TTF file as an URL
Returns:
a List containing the names (as Strings) for each font contained within the specified TTF file. These names are the ones used internally within ServerReport to identify the font.
IOException

Copyright © 2004 Quest Software Inc..
All rights reserved.