Package org.apache.fop.fonts.truetype
Class OTFSubSetFile
java.lang.Object
org.apache.fop.fonts.truetype.OpenFont
org.apache.fop.fonts.truetype.OTFFile
org.apache.fop.fonts.truetype.OTFSubSetWriter
org.apache.fop.fonts.truetype.OTFSubSetFile
Reads an OpenType CFF file and generates a subset
The OpenType specification can be found at the Microsoft
Typography site: http://www.microsoft.com/typography/otspec/
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.fop.fonts.truetype.OpenFont
OpenFont.PostScriptVersion -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CFFDataReaderThe CFF reader object used to read data and offsets from the original font fileprotected StringThe embedded name to change in the name tableFor fonts which have an FDSelect or ROS flag in Top Dict, this is used to store the local subroutine indexes for each group as opposed to the above subsetLocalIndexSubrA map of the new GID to SID used to construct the charset tableprotected CFFDataReader.CFFIndexDataprotected CFFDataReader.CFFIndexDataA list of unique subroutines from the global / local subroutine indexesstatic final intThe number of standard strings in CFFprotected List<byte[]> An array used to hold the string index data for the subset fontprotected List<byte[]> A list of char string data for each glyph to be stored in the subset fontprotected List<byte[]> protected intA map containing each glyph to be included in the subset with their existing and new GID'sprotected List<byte[]> List of subroutines to write to the local / global indexes in the subset fontprotected intA store of the number of subroutines each global / local subroutine will storeFields inherited from class org.apache.fop.fonts.truetype.OTFSubSetWriter
currentPos, outputFields inherited from class org.apache.fop.fonts.truetype.OpenFont
advancedTableReader, cid, dirTabs, embedFontName, familyNames, fontFile, fullName, lastLoca, locaFormat, log, mtxTab, nhmtx, notice, numberOfGlyphs, postScriptName, subFamilyName, svgs, TRACE_ENABLED, unicodeMappings, useAdvanced, useKerning -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidstatic byte[]createNewRef(int newRef, int[] operatorCode, int forceLength, boolean isDict) Returns the parsed CFF data for the original font.voidreadFont(FontFileReader in, String embeddedName, MultiByteFont mbFont) Reads a font.storeFDStrings(List<Integer> uniqueNewRefs) protected voidupdateCIDOffsets(org.apache.fop.fonts.truetype.OTFSubSetFile.Offsets offsets) protected voidupdateFixedOffsets(Map<String, CFFDataReader.DICTEntry> topDICT, org.apache.fop.fonts.truetype.OTFSubSetFile.Offsets offsets) protected voidupdateOffsets(org.apache.fop.fonts.truetype.OTFSubSetFile.Offsets offsets) protected byte[]writeCIDCount(CFFDataReader.DICTEntry dictEntry) writeCIDDictsAndSubrs(List<Integer> uniqueNewRefs) protected intwriteFDArray(List<Integer> uniqueNewRefs, List<Integer> privateDictOffsets, List<Integer> fontNameSIDs) protected voidprotected intwriteIndex(List<byte[]> dataArray) protected intwriteIndex(List<byte[]> dataArray, int offSize) protected voidprotected intMethods inherited from class org.apache.fop.fonts.truetype.OTFSubSetWriter
concatArray, getFontSubset, writeByte, writeBytes, writeCard16, writeThreeByteNumber, writeULongMethods inherited from class org.apache.fop.fonts.truetype.OTFFile
getCFFData, initializeFont, isType1, readName, updateBBoxAndOffsetMethods inherited from class org.apache.fop.fonts.truetype.OpenFont
checkTTC, convertTTFUnit2PDFUnit, createCMaps, determineAscDesc, getAnsiKerning, getBBox, getBBoxRaw, getBoundingBoxes, getCapHeight, getCharSetName, getCharWidth, getCharWidthRaw, getCMaps, getCopyrightNotice, getDirectoryEntry, getEmbedFontName, getFamilyNames, getFirstChar, getFlags, getFontBBox, getFullName, getGDEF, getGPOS, getGSUB, getItalicAngle, getKerning, getLastChar, getLowerCaseAscent, getLowerCaseDescent, getMtx, getNumGlyphs, getPadSize, getPostScriptName, getStemV, getStrikeoutPosition, getStrikeoutThickness, getSubFamilyName, getTTCnames, getUnderlinePosition, getUnderlineThickness, getWeightClass, getWidths, getXHeight, guessVerticalMetricsFromGlyphBBox, handleCharacterSpacing, hasAdvancedTable, initAnsiWidths, isCFF, isEmbeddable, main, printStuff, readCMAP, readDirTabs, readFont, readFont, readFontHeader, readHorizontalHeader, readHorizontalMetrics, readKerning, readOS2, readPCLT, readPostScript, seekTab, stream
-
Field Details
-
subsetGlyphs
A map containing each glyph to be included in the subset with their existing and new GID's -
gidToSID
A map of the new GID to SID used to construct the charset table -
localIndexSubr
-
globalIndexSubr
-
subsetLocalIndexSubr
List of subroutines to write to the local / global indexes in the subset font -
subsetGlobalIndexSubr
-
fdSubrs
For fonts which have an FDSelect or ROS flag in Top Dict, this is used to store the local subroutine indexes for each group as opposed to the above subsetLocalIndexSubr -
localUniques
A list of unique subroutines from the global / local subroutine indexes -
globalUniques
-
subsetLocalSubrCount
protected int subsetLocalSubrCountA store of the number of subroutines each global / local subroutine will store -
subsetGlobalSubrCount
protected int subsetGlobalSubrCount -
subsetCharStringsIndex
A list of char string data for each glyph to be stored in the subset font -
embeddedName
The embedded name to change in the name table -
stringIndexData
An array used to hold the string index data for the subset font -
cffReader
The CFF reader object used to read data and offsets from the original font file -
NUM_STANDARD_STRINGS
public static final int NUM_STANDARD_STRINGSThe number of standard strings in CFF- See Also:
-
-
Constructor Details
-
OTFSubSetFile
- Throws:
IOException
-
-
Method Details
-
readFont
public void readFont(FontFileReader in, String embeddedName, MultiByteFont mbFont) throws IOException Description copied from class:OpenFontReads a font.- Overrides:
readFontin classOpenFont- Parameters:
in- FontFileReader to read from- Throws:
IOException- in case of an I/O problem
-
createCFF
- Throws:
IOException
-
storeFDStrings
- Throws:
IOException
-
writeTopDICT
- Throws:
IOException
-
writeCIDCount
- Throws:
IOException
-
createCharStringDataCID
- Throws:
IOException
-
writeFDSelect
protected void writeFDSelect() -
getUsedFDFonts
-
writeCIDDictsAndSubrs
- Throws:
IOException
-
writeFDArray
protected int writeFDArray(List<Integer> uniqueNewRefs, List<Integer> privateDictOffsets, List<Integer> fontNameSIDs) throws IOException - Throws:
IOException
-
createNewRef
public static byte[] createNewRef(int newRef, int[] operatorCode, int forceLength, boolean isDict) -
writeIndex
-
writeIndex
-
writePrivateDict
- Throws:
IOException
-
updateOffsets
protected void updateOffsets(org.apache.fop.fonts.truetype.OTFSubSetFile.Offsets offsets) throws IOException - Throws:
IOException
-
updateFixedOffsets
protected void updateFixedOffsets(Map<String, CFFDataReader.DICTEntry> topDICT, org.apache.fop.fonts.truetype.OTFSubSetFile.Offsets offsets) throws IOException- Throws:
IOException
-
updateCIDOffsets
protected void updateCIDOffsets(org.apache.fop.fonts.truetype.OTFSubSetFile.Offsets offsets) throws IOException - Throws:
IOException
-
getCFFReader
Returns the parsed CFF data for the original font.- Returns:
- The CFFDataReader contaiing the parsed data
-