|
Platypus | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pz.platypus.TypefaceMap
public class TypefaceMap
Map that maps a typeface family to font files on the runtime system that implement that typeface family. Entries consist of a typeface name -> linked-list of file URIs. So, for example, Arial -> c:\windows\fonts\arial.ttf, c:\windows\fonts\ariali.ttf, etc. This map is consulted when the user specifies a typeface other than the 14 base PDF fonts
| Field Summary | |
|---|---|
private GDD |
gdd
|
private java.util.HashMap<java.lang.String,java.util.LinkedList<java.lang.String>> |
map
|
| Constructor Summary | |
|---|---|
TypefaceMap(GDD Gdd)
|
|
| Method Summary | |
|---|---|
void |
addFamily(java.lang.String family,
java.util.LinkedList<java.lang.String> filenames)
As a family name with a linked list of one or more associated font files |
void |
addFontFileToFamily(java.lang.String family,
java.lang.String filename)
add a filename to a family, as long as the filename was not previously added . |
java.lang.String[] |
extractFamilyNames(java.lang.String fontFilename,
com.lowagie.text.pdf.BaseFont bf)
Uses iText to extract the family name (or in case of .ttc the names) of the font family. |
java.lang.String[] |
getFamilyFilenames(java.lang.String family)
Returns the list of filenames that correspond to a font/typeface family. |
(package private) java.util.LinkedList<java.lang.String> |
getFontFileList(java.lang.String[] fontDirs)
Return a linked list of font files found in the past list of font directories. |
java.util.HashMap<java.lang.String,java.util.LinkedList<java.lang.String>> |
getMap()
Used mostly for testing |
void |
loadFamilies()
Load the font families with their respective font files into the table 1. |
void |
loadFontFile(java.lang.String fontFilename,
com.lowagie.text.pdf.BaseFont bf)
Loads an individual font file to the map. |
void |
loadFromFile(java.lang.String filename)
Load the Typeface map from a configuration file consisting on line entries of the form: family=fontFilename; |
void |
loadLine(java.lang.String line)
Loads a line from the config file. |
void |
loadMapFromFile()
Reads the config/fontlist.txt file in PLATYPUS_HOME and loads the entries into the map. |
(package private) void |
writeMapEntryToFile(java.io.PrintWriter out,
java.lang.String family,
java.lang.String[] files)
Writes a single map entry to file |
void |
writeMapToFile(java.lang.String filename)
Writes the current map to an output file after sorting the entries on font family. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.HashMap<java.lang.String,java.util.LinkedList<java.lang.String>> map
private GDD gdd
| Constructor Detail |
|---|
public TypefaceMap(GDD Gdd)
| Method Detail |
|---|
public void loadMapFromFile()
InvalidConfigFileException - if the fontlist.txt file is missingpublic void writeMapToFile(java.lang.String filename)
filename - name of file to write out.
void writeMapEntryToFile(java.io.PrintWriter out,
java.lang.String family,
java.lang.String[] files)
out - the file writer for textfamily - the family part of the map entryfiles - the files part of the map entrypublic void loadFamilies()
public void loadFontFile(java.lang.String fontFilename,
com.lowagie.text.pdf.BaseFont bf)
fontFilename - font file to load to mapbf - is the base font
public java.lang.String[] extractFamilyNames(java.lang.String fontFilename,
com.lowagie.text.pdf.BaseFont bf)
fontFilename - font filebf - base font we create to get the family font name
java.util.LinkedList<java.lang.String> getFontFileList(java.lang.String[] fontDirs)
fontDirs - array of directory names that should contain fonts
public void addFamily(java.lang.String family,
java.util.LinkedList<java.lang.String> filenames)
family - font family (key)filenames - font files associated with the family (value)
public void addFontFileToFamily(java.lang.String family,
java.lang.String filename)
family - the family namefilename - the filename to addpublic java.lang.String[] getFamilyFilenames(java.lang.String family)
family - the family to look up
public void loadFromFile(java.lang.String filename)
filename - name of the file to readpublic void loadLine(java.lang.String line)
line - the line read from the file containing: family=file name/locationpublic java.util.HashMap<java.lang.String,java.util.LinkedList<java.lang.String>> getMap()
|
Platypus | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||