org.apache.fop.fonts
Class TTFFile

java.lang.Object
  |
  +--org.apache.fop.fonts.TTFFile
Direct Known Subclasses:
TTFSubSetFile

public class TTFFile
extends java.lang.Object

Reads a TrueType file or a TrueType Collection. The TrueType spec can be found at the Microsoft Typography site: http://www.microsoft.com/truetype/


Constructor Summary
TTFFile()
           
 
Method Summary
protected  boolean checkTTC(FontFileReader in, java.lang.String name, boolean verbose)
          Check if this is a TrueType collection and that the given name exists in the collection.
 java.util.Hashtable getAnsiKerning()
           
 int getCapHeight()
           
 java.lang.String getCharSetName()
           
 int getCharWidth(int idx)
           
 java.util.Vector getCMaps()
          Return a vector with TTFCmapEntry
 java.lang.String getFamilyName()
           
 short getFirstChar()
           
 int getFlags()
           
 int[] getFontBBox()
           
 java.lang.String getItalicAngle()
           
 java.util.Hashtable getKerning()
           
 short getLastChar()
           
 int getLowerCaseAscent()
           
 int getLowerCaseDescent()
           
protected  void getNumGlyphs(FontFileReader in)
          Read the number of glyphs from the "maxp" table
 java.lang.String getPostscriptName()
           
 java.lang.String getStemV()
           
 int[] getWidths()
           
 java.lang.String getWindowsName()
           
 int getXHeight()
           
 boolean isEmbeddable()
           
static void main(java.lang.String[] args)
           
 void printStuff()
           
protected  void readDirTabs(FontFileReader in)
          Read Table Directory from the current position in the FontFileReader and fill the global Hashtable dirTabs with the table name (String) as key and a TTFDirTabEntry as value.
 void readFont(FontFileReader in)
           
 void readFont(FontFileReader in, java.lang.String name)
          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
protected  void readFontHeader(FontFileReader in)
          Read the "head" table, this reads the bounding box and sets the upem (unitsPerEM) variable
protected  void readHorizontalHeader(FontFileReader in)
          Read the "hhea" table to find the ascender and descender and size of "hmtx" table, i.e. a fixed size font might have only one width
protected  void readHorizontalMetrics(FontFileReader in)
          Read "hmtx" table and put the horizontal metrics in the mtx_tab array.
protected  void readIndexToLocation(FontFileReader in)
          Read the "loca" table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TTFFile

public TTFFile()
Method Detail

readFont

public void readFont(FontFileReader in)
              throws java.io.IOException

readFont

public void readFont(FontFileReader in,
                     java.lang.String name)
              throws java.io.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

printStuff

public void printStuff()

main

public static void main(java.lang.String[] args)

getWindowsName

public java.lang.String getWindowsName()

getPostscriptName

public java.lang.String getPostscriptName()

getFamilyName

public java.lang.String getFamilyName()

getCharSetName

public java.lang.String getCharSetName()

getCapHeight

public int getCapHeight()

getXHeight

public int getXHeight()

getFlags

public int getFlags()

getStemV

public java.lang.String getStemV()

getItalicAngle

public java.lang.String getItalicAngle()

getFontBBox

public int[] getFontBBox()

getLowerCaseAscent

public int getLowerCaseAscent()

getLowerCaseDescent

public int getLowerCaseDescent()

getLastChar

public short getLastChar()

getFirstChar

public short getFirstChar()

getWidths

public int[] getWidths()

getCharWidth

public int getCharWidth(int idx)

getKerning

public java.util.Hashtable getKerning()

getAnsiKerning

public java.util.Hashtable getAnsiKerning()

isEmbeddable

public boolean isEmbeddable()

readDirTabs

protected void readDirTabs(FontFileReader in)
                    throws java.io.IOException
Read Table Directory from the current position in the FontFileReader and fill the global Hashtable dirTabs with the table name (String) as key and a TTFDirTabEntry as value.

readFontHeader

protected void readFontHeader(FontFileReader in)
                       throws java.io.IOException
Read the "head" table, this reads the bounding box and sets the upem (unitsPerEM) variable

getNumGlyphs

protected void getNumGlyphs(FontFileReader in)
                     throws java.io.IOException
Read the number of glyphs from the "maxp" table

readHorizontalHeader

protected void readHorizontalHeader(FontFileReader in)
                             throws java.io.IOException
Read the "hhea" table to find the ascender and descender and size of "hmtx" table, i.e. a fixed size font might have only one width

readHorizontalMetrics

protected void readHorizontalMetrics(FontFileReader in)
                              throws java.io.IOException
Read "hmtx" table and put the horizontal metrics in the mtx_tab array. If the number of metrics is less than the number of glyphs (eg fixed size fonts), extend the mtx_tab array and fill in the missing widths

readIndexToLocation

protected final void readIndexToLocation(FontFileReader in)
                                  throws java.io.IOException
Read the "loca" table

getCMaps

public java.util.Vector getCMaps()
Return a vector with TTFCmapEntry

checkTTC

protected final boolean checkTTC(FontFileReader in,
                                 java.lang.String name,
                                 boolean verbose)
                          throws java.io.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


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.