java.lang.Object
org.sejda.sambox.pdmodel.font.BaseTTFSubsetter
Skeletal implementation for a TTF subsetter. To be used to subset embedded TrueType font and Type
0 fonts with CIDFontType2 descendant This is based on the
TTFSubsetter in FontBox.- Author:
- Andrea Vacondio
-
Constructor Summary
ConstructorsConstructorDescriptionBaseTTFSubsetter(COSDictionary existingFont, COSStream fontFileStream) BaseTTFSubsetter(COSDictionary existingFont, COSStream fontFileStream, org.apache.fontbox.ttf.TrueTypeFont font) -
Method Summary
Modifier and TypeMethodDescriptionCreates a subset of the font file containing only the glyphs added to this subsetter.protected byte[]protected byte[]buildGlyfTable(long[] newOffsets) protected byte[]protected byte[]protected byte[]protected byte[]buildLocaTable(long[] newOffsets) protected byte[]protected byte[]buildNameTable(String subsetFontName) protected byte[]protected byte[]abstract COSStreamorg.apache.fontbox.ttf.TrueTypeFontgetFont()voidAdds all the given mappings code -> GID to this subsettervoidsetNumberOfGlyphs(int numberOfGlyphs) Initialize the subsetter before performing a subsetprotected voidupdateChecksum(DataOutputStream out, Map<String, byte[]> tables) voidwriteTableBody(OutputStream os, byte[] bytes)
-
Constructor Details
-
BaseTTFSubsetter
public BaseTTFSubsetter(COSDictionary existingFont, COSStream fontFileStream, org.apache.fontbox.ttf.TrueTypeFont font) throws IOException - Parameters:
existingFont- the font dictionary that will be updatedfontFileStream- the corresponding not subsetted FontFile2font- the existing and already parsed font. If null the fontFileStream will be parsed to get the ttf font when needed- Throws:
IOException
-
BaseTTFSubsetter
- Throws:
IOException
-
-
Method Details
-
putAll
Adds all the given mappings code -> GID to this subsetter- Parameters:
codesToGID-
-
apply
Creates a subset of the font file containing only the glyphs added to this subsetter. If anything happens null is returned -
getFont
- Throws:
IOException
-
getGlyphIds
-
doSubset
- Throws:
IOException
-
setNumberOfGlyphs
public void setNumberOfGlyphs(int numberOfGlyphs) Initialize the subsetter before performing a subset -
updateChecksum
- Throws:
IOException
-
buildHeadTable
- Throws:
IOException
-
buildHheaTable
- Throws:
IOException
-
buildMaxpTable
- Throws:
IOException
-
buildNameTable
- Throws:
IOException
-
buildGlyfTable
- Throws:
IOException
-
buildLocaTable
- Throws:
IOException
-
buildHmtxTable
- Throws:
IOException
-
buildPostTable
- Throws:
IOException
-
buildOS2Table
- Throws:
IOException
-
buildCMapTable
- Throws:
IOException
-
writeTableBody
- Throws:
IOException
-