public class TTFFile
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.Map |
dirTabs
Table directory
|
protected long |
lastLoca
Offset to last loca
|
protected org.apache.commons.logging.Log |
log
logging instance
|
protected org.apache.fop.fonts.truetype.TTFMtxEntry[] |
mtxTab
Contains glyph data
|
static boolean |
TRACE_ENABLED
Set to true to get even more debug output than with level DEBUG
|
Constructor and Description |
---|
TTFFile() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkTTC(FontFileReader in,
java.lang.String name)
Check if this is a TrueType collection and that the given
name exists in the collection.
|
int |
convertTTFUnit2PDFUnit(int n)
Convert from truetype unit to pdf unit based on the
unitsPerEm field in the "head" table
|
java.util.Map |
getAnsiKerning()
Returns the ANSI kerning table.
|
int |
getCapHeight()
Returns the CapHeight attribute of the font.
|
java.lang.String |
getCharSetName()
Returns the name of the character set used.
|
int |
getCharWidth(int idx)
Returns the width of a given character.
|
java.util.List |
getCMaps()
Return a List with TTFCmapEntry.
|
java.util.Set |
getFamilyNames()
Returns the font family names of the font.
|
short |
getFirstChar()
Returns the index of the first character.
|
int |
getFlags()
Returns the Flags attribute of the font.
|
int[] |
getFontBBox()
Returns the font bounding box.
|
java.lang.String |
getFullName()
Returns the full name of the font.
|
java.lang.String |
getItalicAngle()
Returns the ItalicAngle attribute of the font.
|
java.util.Map |
getKerning()
Returns the kerning table.
|
short |
getLastChar()
Returns the index of the last character, but this is for WinAnsiEncoding
only, so the last char is < 256.
|
int |
getLowerCaseAscent()
Returns the LowerCaseAscent attribute of the font.
|
int |
getLowerCaseDescent()
Returns the LowerCaseDescent attribute of the font.
|
protected void |
getNumGlyphs(FontFileReader in)
Read the number of glyphs from the "maxp" table
|
java.lang.String |
getPostScriptName()
Returns the PostScript name of the font.
|
java.lang.String |
getStemV()
Returns the StemV attribute of the font.
|
java.lang.String |
getSubFamilyName()
Returns the font sub family name of the font.
|
java.util.List |
getTTCnames(FontFileReader in)
Return TTC font names
|
int |
getWeightClass()
Returns the weight class of this font.
|
int[] |
getWidths()
Returns an array of character widths.
|
int |
getXHeight()
Returns the XHeight attribute of the font.
|
boolean |
isCFF()
Indicates whether or not the font is an OpenType
CFF font (rather than a TrueType font).
|
boolean |
isEmbeddable()
Indicates if the font may be embedded.
|
static void |
main(java.lang.String[] args)
Static main method to get info about a TrueType font.
|
void |
printStuff()
Dumps a few informational values to System.out.
|
protected void |
readDirTabs(FontFileReader in)
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.
|
void |
readFont(FontFileReader in)
Reads the font using a FontFileReader.
|
boolean |
readFont(FontFileReader in,
java.lang.String name)
Read the font data.
|
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, as a fixed size font might have only
one width.
|
protected void |
readHorizontalMetrics(FontFileReader in)
Read "hmtx" table and put the horizontal metrics
in the mtxTab array.
|
protected void |
readIndexToLocation(FontFileReader in)
Read the "loca" table.
|
public static final boolean TRACE_ENABLED
protected java.util.Map dirTabs
protected long lastLoca
protected org.apache.fop.fonts.truetype.TTFMtxEntry[] mtxTab
protected org.apache.commons.logging.Log log
public int convertTTFUnit2PDFUnit(int n)
n
- truetype unitpublic void readFont(FontFileReader in) throws java.io.IOException
in
- The FontFileReader to usejava.io.IOException
- In case of an I/O problempublic boolean readFont(FontFileReader in, java.lang.String name) throws java.io.IOException
in
- The FontFileReader to usename
- The name of the fontjava.io.IOException
- In case of an I/O problempublic java.lang.String getPostScriptName()
public java.util.Set getFamilyNames()
public java.lang.String getSubFamilyName()
public java.lang.String getFullName()
public java.lang.String getCharSetName()
public int getCapHeight()
public int getXHeight()
public int getFlags()
public int getWeightClass()
public java.lang.String getStemV()
public java.lang.String getItalicAngle()
public int[] getFontBBox()
public int getLowerCaseAscent()
public int getLowerCaseDescent()
public short getLastChar()
public short getFirstChar()
public int[] getWidths()
public int getCharWidth(int idx)
idx
- Index of the characterpublic java.util.Map getKerning()
public java.util.Map getAnsiKerning()
public boolean isEmbeddable()
public boolean isCFF()
protected void readDirTabs(FontFileReader in) throws java.io.IOException
in
- FontFileReader to read the table directory fromjava.io.IOException
- in case of an I/O problemprotected void readFontHeader(FontFileReader in) throws java.io.IOException
in
- FontFileReader to read the header fromjava.io.IOException
- in case of an I/O problemprotected void getNumGlyphs(FontFileReader in) throws java.io.IOException
in
- FontFileReader to read the number of glyphs fromjava.io.IOException
- in case of an I/O problemprotected void readHorizontalHeader(FontFileReader in) throws java.io.IOException
in
- FontFileReader to read the hhea table fromjava.io.IOException
- in case of an I/O problemprotected void readHorizontalMetrics(FontFileReader in) throws java.io.IOException
in
- FontFileReader to read the hmtx table fromjava.io.IOException
- in case of an I/O problemprotected final void readIndexToLocation(FontFileReader in) throws java.io.IOException
in
- FontFileReader to read fromjava.io.IOException
- In case of a I/O problempublic java.util.List getCMaps()
protected final boolean checkTTC(FontFileReader in, java.lang.String name) throws java.io.IOException
in
- FontFileReader to read fromname
- The name to checkjava.io.IOException
- In case of an I/O problempublic final java.util.List getTTCnames(FontFileReader in) throws java.io.IOException
in
- FontFileReader to read fromjava.io.IOException
- In case of an I/O problempublic void printStuff()
public static void main(java.lang.String[] args)
args
- The command line argumentsCopyright 1999-2010 The Apache Software Foundation. All Rights Reserved.