class TrueTypeFontSubSet extends Object
Modifier and Type | Field and Description |
---|---|
(package private) static int |
ARG_1_AND_2_ARE_WORDS |
protected int |
directoryOffset |
(package private) static int[] |
entrySelectors |
protected String |
fileName
The file name.
|
protected int |
fontPtr |
protected int |
glyfTableRealSize |
protected ArrayList<Integer> |
glyphsInList |
protected HashSet<Integer> |
glyphsUsed |
(package private) static int |
HEAD_LOCA_FORMAT_OFFSET |
protected boolean |
includeCmap |
protected boolean |
includeExtras |
protected boolean |
locaShortTable |
protected int[] |
locaTable |
protected int |
locaTableRealSize |
(package private) static int |
MORE_COMPONENTS |
protected byte[] |
newGlyfTable |
protected int[] |
newLocaTable |
protected byte[] |
newLocaTableOut |
protected byte[] |
outFont |
protected RandomAccessFileOrArray |
rf
The file in use.
|
(package private) static int |
TABLE_CHECKSUM |
(package private) static int |
TABLE_LENGTH |
(package private) static int |
TABLE_OFFSET |
protected HashMap<String,int[]> |
tableDirectory
Contains the location of the several tables.
|
protected int |
tableGlyphOffset |
(package private) static String[] |
tableNamesCmap |
(package private) static String[] |
tableNamesExtra |
(package private) static String[] |
tableNamesSimple |
(package private) static int |
WE_HAVE_A_SCALE |
(package private) static int |
WE_HAVE_A_TWO_BY_TWO |
(package private) static int |
WE_HAVE_AN_X_AND_Y_SCALE |
Constructor and Description |
---|
TrueTypeFontSubSet(String fileName,
RandomAccessFileOrArray rf,
HashSet<Integer> glyphsUsed,
int directoryOffset,
boolean includeCmap,
boolean includeExtras)
Creates a new TrueTypeFontSubSet
|
Modifier and Type | Method and Description |
---|---|
protected void |
assembleFont() |
protected int |
calculateChecksum(byte[] b) |
protected void |
checkGlyphComposite(int glyph) |
protected void |
createNewGlyphTables() |
protected void |
createTableDirectory() |
protected void |
flatGlyphs() |
protected void |
locaTobytes() |
(package private) byte[] |
process()
Does the actual work of subsetting the font.
|
protected void |
readLoca() |
protected String |
readStandardString(int length)
Reads a
String from the font file as bytes using the Cp1252
encoding. |
protected void |
writeFontInt(int n) |
protected void |
writeFontShort(int n) |
protected void |
writeFontString(String s) |
static final String[] tableNamesSimple
static final String[] tableNamesCmap
static final String[] tableNamesExtra
static final int[] entrySelectors
static final int TABLE_CHECKSUM
static final int TABLE_OFFSET
static final int TABLE_LENGTH
static final int HEAD_LOCA_FORMAT_OFFSET
static final int ARG_1_AND_2_ARE_WORDS
static final int WE_HAVE_A_SCALE
static final int MORE_COMPONENTS
static final int WE_HAVE_AN_X_AND_Y_SCALE
static final int WE_HAVE_A_TWO_BY_TWO
protected HashMap<String,int[]> tableDirectory
int[3]
where position 0
is the checksum, position 1 is the offset from the start of the file
and position 2 is the length of the table.protected RandomAccessFileOrArray rf
protected boolean includeCmap
protected boolean includeExtras
protected boolean locaShortTable
protected int[] locaTable
protected HashSet<Integer> glyphsUsed
protected ArrayList<Integer> glyphsInList
protected int tableGlyphOffset
protected int[] newLocaTable
protected byte[] newLocaTableOut
protected byte[] newGlyfTable
protected int glyfTableRealSize
protected int locaTableRealSize
protected byte[] outFont
protected int fontPtr
protected int directoryOffset
TrueTypeFontSubSet(String fileName, RandomAccessFileOrArray rf, HashSet<Integer> glyphsUsed, int directoryOffset, boolean includeCmap, boolean includeExtras)
directoryOffset
- The offset from the start of the file to the table directoryfileName
- the file name of the fontglyphsUsed
- the glyphs usedincludeCmap
- true
if the table cmap is to be included in the generated fontbyte[] process() throws IOException, DocumentException
IOException
- on errorDocumentException
- on errorprotected void assembleFont() throws IOException
IOException
protected void createTableDirectory() throws IOException, DocumentException
IOException
DocumentException
protected void readLoca() throws IOException, DocumentException
IOException
DocumentException
protected void createNewGlyphTables() throws IOException
IOException
protected void locaTobytes()
protected void flatGlyphs() throws IOException, DocumentException
IOException
DocumentException
protected void checkGlyphComposite(int glyph) throws IOException
IOException
protected String readStandardString(int length) throws IOException
String
from the font file as bytes using the Cp1252
encoding.length
- the length of bytes to readString
readIOException
- the font file could not be readprotected void writeFontShort(int n)
protected void writeFontInt(int n)
protected void writeFontString(String s)
protected int calculateChecksum(byte[] b)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses