Class TTFSubsetter
java.lang.Object
org.apache.fontbox.ttf.TTFSubsetter
-
Constructor Summary
ConstructorsConstructorDescriptionTTFSubsetter(TrueTypeFont ttf) Creates a subsetter for the given font.TTFSubsetter(TrueTypeFont ttf, List<String> tables) Creates a subsetter for the given font. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int unicode) Add the given character code to the subset.voidAdd the given character codes to the subset.voidforceInvisible(int unicode) Forces the glyph for the specified character code to be zero-width and contour-free, regardless of what the glyph looks like in the original font.Returns the map of new -> old GIDs.voidSets the prefix to add to the font's PostScript name.voidWrite the subfont to the given output stream.
-
Constructor Details
-
TTFSubsetter
Creates a subsetter for the given font.- Parameters:
ttf- the font to be subset- Throws:
IOException
-
TTFSubsetter
Creates a subsetter for the given font.- Parameters:
ttf- the font to be subsettables- optional tables to keep if present- Throws:
IOException
-
-
Method Details
-
setPrefix
Sets the prefix to add to the font's PostScript name. -
add
public void add(int unicode) Add the given character code to the subset.- Parameters:
unicode- character code
-
addAll
-
forceInvisible
public void forceInvisible(int unicode) Forces the glyph for the specified character code to be zero-width and contour-free, regardless of what the glyph looks like in the original font. Note that the specified character code is not added to the subset unless it is alsoaddedseparately.- Parameters:
unicode- the character code whose glyph should be invisible
-
getGIDMap
Returns the map of new -> old GIDs.- Throws:
IOException
-
writeToStream
Write the subfont to the given output stream.- Parameters:
os- the stream used for writing. It will be closed by this method.- Throws:
IOException- if something went wrong.IllegalStateException- if the subset is empty.
-