com.sun.pdfview.font.ttf

Class TrueTypeFont

public class TrueTypeFont extends Object

Constructor Summary
TrueTypeFont(int type)
Creates a new instance of TrueTypeParser
Method Summary
voidaddTable(String tagString, ByteBuffer data)
Add a table to the font
voidaddTable(String tagString, TrueTypeTable table)
Add a table to the font
shortgetEntrySelector()
Get the entry selector
shortgetNumTables()
Get the number of tables
shortgetRangeShift()
Get the range shift
shortgetSearchRange()
Get the search range
TrueTypeTablegetTable(String tagString)
Get a table by name.
intgetType()
Get the type of this font
static voidmain(String[] args)
static TrueTypeFontparseFont(byte[] orig)
Parses a TrueType font from a byte array
static TrueTypeFontparseFont(ByteBuffer inBuf)
Parses a TrueType font from a byte buffer
voidremoveTable(String tagString)
Remove a table by name
StringtoString()
Write the font to a pretty string
byte[]writeFont()
Write a font given the type and an array of Table Directory Entries

Constructor Detail

TrueTypeFont

public TrueTypeFont(int type)
Creates a new instance of TrueTypeParser

Method Detail

addTable

public void addTable(String tagString, ByteBuffer data)
Add a table to the font

Parameters: tagString the name of this table, as a 4 character string (i.e. cmap or head) data the data for this table, as a byte buffer

addTable

public void addTable(String tagString, TrueTypeTable table)
Add a table to the font

Parameters: tagString the name of this table, as a 4 character string (i.e. cmap or head) table the table

getEntrySelector

public short getEntrySelector()
Get the entry selector

getNumTables

public short getNumTables()
Get the number of tables

getRangeShift

public short getRangeShift()
Get the range shift

getSearchRange

public short getSearchRange()
Get the search range

getTable

public TrueTypeTable getTable(String tagString)
Get a table by name. This command causes the table in question to be parsed, if it has not already been parsed.

Parameters: tagString the name of this table, as a 4 character string (i.e. cmap or head)

getType

public int getType()
Get the type of this font

main

public static void main(String[] args)

Parameters: args the command line arguments

parseFont

public static TrueTypeFont parseFont(byte[] orig)
Parses a TrueType font from a byte array

parseFont

public static TrueTypeFont parseFont(ByteBuffer inBuf)
Parses a TrueType font from a byte buffer

removeTable

public void removeTable(String tagString)
Remove a table by name

Parameters: tagString the name of this table, as a 4 character string (i.e. cmap or head)

toString

public String toString()
Write the font to a pretty string

writeFont

public byte[] writeFont()
Write a font given the type and an array of Table Directory Entries