fop 0.95beta | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.fop.fonts.truetype.TTFFile
public class TTFFile
extends java.lang.Object
Field Summary | |
static boolean |
|
protected Map |
|
protected long |
|
protected Log |
|
protected org.apache.fop.fonts.truetype.TTFMtxEntry[] |
|
Method Summary | |
protected boolean |
|
int |
|
Map |
|
List |
|
int |
|
String |
|
int |
|
Set |
|
short |
|
int |
|
int[] |
|
String |
|
String |
|
Map |
|
short |
|
int |
|
int |
|
protected void |
|
String |
|
String |
|
String |
|
int |
|
int[] |
|
int |
|
boolean |
|
boolean |
|
static void |
|
void |
|
protected void |
|
void |
|
boolean |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
public static final boolean TRACE_ENABLED
Set to true to get even more debug output than with level DEBUG
- Field Value:
- false
protected Map dirTabs
Table directory
protected long lastLoca
Offset to last loca
protected Log log
logging instance
protected org.apache.fop.fonts.truetype.TTFMtxEntry[] mtxTab
Contains glyph data
protected final boolean checkTTC(FontFileReader in, String name) throws IOException
Check if this is a TrueType collection and that the given name exists in the collection. If it does, set offset in fontfile to the beginning of the Table Directory for that font.
- Parameters:
in
- FontFileReader to read fromname
- The name to check
- Returns:
- True if not collection or font name present, false otherwise
public int convertTTFUnit2PDFUnit(int n)
Convert from truetype unit to pdf unit based on the unitsPerEm field in the "head" table
- Parameters:
n
- truetype unit
- Returns:
- pdf unit
public Map getAnsiKerning()
Returns the ANSI kerning table.
- Returns:
- Map The ANSI kerning table
public List getCMaps()
Return a List with TTFCmapEntry.
- Returns:
- A list of TTFCmapEntry objects
public int getCapHeight()
Returns the CapHeight attribute of the font.
- Returns:
- int The CapHeight
public String getCharSetName()
Returns the name of the character set used.
- Returns:
- String The caracter set
public int getCharWidth(int idx)
Returns the width of a given character.
- Parameters:
idx
- Index of the character
- Returns:
- int Standard width
public Set getFamilyNames()
Returns the font family names of the font.
- Returns:
- Set The family names (a Set of Strings)
public short getFirstChar()
Returns the index of the first character.
- Returns:
- short Index of the first character
public int getFlags()
Returns the Flags attribute of the font.
- Returns:
- int The Flags
public int[] getFontBBox()
Returns the font bounding box.
- Returns:
- int[] The font bbox
public String getFullName()
Returns the full name of the font.
- Returns:
- String The full name
public String getItalicAngle()
Returns the ItalicAngle attribute of the font.
- Returns:
- String The ItalicAngle
public Map getKerning()
Returns the kerning table.
- Returns:
- Map The kerning table
public short getLastChar()
Returns the index of the last character, but this is for WinAnsiEncoding only, so the last char is <32256.
- Returns:
- short Index of the last character (<256)
public int getLowerCaseAscent()
Returns the LowerCaseAscent attribute of the font.
- Returns:
- int The LowerCaseAscent
public int getLowerCaseDescent()
Returns the LowerCaseDescent attribute of the font.
- Returns:
- int The LowerCaseDescent
protected void getNumGlyphs(FontFileReader in) throws IOException
Read the number of glyphs from the "maxp" table
- Parameters:
in
- FontFileReader to read the number of glyphs from
public String getPostScriptName()
Returns the PostScript name of the font.
- Returns:
- String The PostScript name
public String getStemV()
Returns the StemV attribute of the font.
- Returns:
- String The StemV
public String getSubFamilyName()
Returns the font sub family name of the font.
- Returns:
- String The sub family name
public int getWeightClass()
Returns the weight class of this font. Valid values are 100, 200....,800, 900.
- Returns:
- the weight class value (or 0 if there was no OS/2 table in the font)
public int[] getWidths()
Returns an array of character widths.
- Returns:
- int[] The character widths
public int getXHeight()
Returns the XHeight attribute of the font.
- Returns:
- int The XHeight
public boolean isCFF()
Indicates whether or not the font is an OpenType CFF font (rather than a TrueType font).
- Returns:
- true if the font is in OpenType CFF format.
public boolean isEmbeddable()
Indicates if the font may be embedded.
- Returns:
- boolean True if it may be embedded
public static void main(String[] args)
Static main method to get info about a TrueType font.
- Parameters:
args
- The command line arguments
public void printStuff()
Dumps a few informational values to System.out.
protected void readDirTabs(FontFileReader in) throws IOException
Read Table Directory from the current position in the FontFileReader and fill the global HashMap dirTabs with the table name (String) as key and a TTFDirTabEntry as value.
- Parameters:
in
- FontFileReader to read the table directory from
public void readFont(FontFileReader in) throws IOException
Reads the font using a FontFileReader.
- Parameters:
in
- The FontFileReader to use
public boolean readFont(FontFileReader in, String name) throws IOException
Read the font data. If the fontfile is a TrueType Collection (.ttc file) the name of the font to read data for must be supplied, else the name is ignored.
- Parameters:
in
- The FontFileReader to usename
- The name of the font
- Returns:
- boolean Returns true if the font is valid
protected void readFontHeader(FontFileReader in) throws IOException
Read the "head" table, this reads the bounding box and sets the upem (unitsPerEM) variable
- Parameters:
in
- FontFileReader to read the header from
protected void readHorizontalHeader(FontFileReader in) throws IOException
Read the "hhea" table to find the ascender and descender and size of "hmtx" table, as a fixed size font might have only one width.
- Parameters:
in
- FontFileReader to read the hhea table from
protected void readHorizontalMetrics(FontFileReader in) throws IOException
Read "hmtx" table and put the horizontal metrics in the mtxTab array. If the number of metrics is less than the number of glyphs (eg fixed size fonts), extend the mtxTab array and fill in the missing widths
- Parameters:
in
- FontFileReader to read the hmtx table from
protected final void readIndexToLocation(FontFileReader in) throws IOException
Read the "loca" table.
- Parameters:
in
- FontFileReader to read from
fop 0.95beta |