public final class TTFSubsetter
extends java.lang.Object
Originally developed by Wolfgang Glas for Sketch.
| Constructor and Description |
|---|
TTFSubsetter(TrueTypeFont ttf)
Creates a subsetter for the given font.
|
TTFSubsetter(TrueTypeFont ttf,
java.util.List<java.lang.String> tables)
Creates a subsetter for the given font.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int unicode)
Add the given character code to the subset.
|
void |
addAll(java.util.Set<java.lang.Integer> unicodeSet)
Add the given character codes to the subset.
|
java.util.Map<java.lang.Integer,java.lang.Integer> |
getGIDMap()
Returns the map of new -> old GIDs.
|
void |
setPrefix(java.lang.String prefix)
Sets the prefix to add to the font's PostScript name.
|
void |
writeToStream(java.io.OutputStream os)
Write the subfont to the given output stream.
|
public TTFSubsetter(TrueTypeFont ttf) throws java.io.IOException
ttf - the font to be subsetjava.io.IOExceptionpublic TTFSubsetter(TrueTypeFont ttf, java.util.List<java.lang.String> tables) throws java.io.IOException
ttf - the font to be subsettables - optional tables to keep if presentjava.io.IOExceptionpublic void setPrefix(java.lang.String prefix)
public void add(int unicode)
unicode - character codepublic void addAll(java.util.Set<java.lang.Integer> unicodeSet)
unicodeSet - character code setpublic java.util.Map<java.lang.Integer,java.lang.Integer> getGIDMap()
throws java.io.IOException
java.io.IOExceptionpublic void writeToStream(java.io.OutputStream os)
throws java.io.IOException
os - the stream used for writing. It will be closed by this method.java.io.IOException - if something went wrong.java.lang.IllegalStateException - if the subset is empty.