public class CFFFontSubset extends CFFFont
CFFFont.DictNumberItem, CFFFont.DictOffsetItem, CFFFont.Font, CFFFont.IndexBaseItem, CFFFont.IndexMarkerItem, CFFFont.IndexOffsetItem, CFFFont.Item, CFFFont.MarkerItem, CFFFont.OffsetItem, CFFFont.RangeItem, CFFFont.StringItem, CFFFont.SubrMarkerItem, CFFFont.UInt16Item, CFFFont.UInt24Item, CFFFont.UInt32Item, CFFFont.UInt8Item
arg_count, args, buf, fonts, gsubrIndexOffset, gsubrOffsets, key, nameIndexOffset, nameOffsets, stringIndexOffset, stringOffsets, topdictIndexOffset, topdictOffsets
Constructor and Description |
---|
CFFFontSubset(byte[] cff, Set<Integer> GlyphsUsed)
C'tor for CFFFontSubset
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
AssembleIndex(int[] NewOffsets, byte[] NewObjects)
Function creates the new index, inserting the count,offsetsize,offset array and object array.
|
protected void |
BuildFDArrayUsed(int Font)
Function reads the FDSelect and builds the FDArrayUsed Map According to the glyphs used
|
protected void |
BuildFDSubrsOffsets(int Font, int FD)
The function finds for the FD array processed the local subr offset and its offset array.
|
protected void |
BuildGSubrsUsed(int Font)
Function scans the Glsubr used list to find recursive calls to Gsubrs and adds to Map and list
|
protected void |
BuildIndexHeader(int Count, int Offsize, int First)
Function Build the header of an index
|
protected void |
BuildNewCharString(int FontIndex)
Function uses BuildNewIndex to create the new index of the subset charstrings
|
protected byte[] |
BuildNewFile(int Font)
The function builds the new output stream according to the subset process
|
protected byte[] |
BuildNewIndex(int[] Offsets, Set<Integer> Used, byte OperatorForUnusedEntries)
Function builds the new offset array, object array and assembles the index.
|
protected byte[] |
BuildNewIndexAndCopyAllGSubrs(int[] Offsets, byte OperatorForUnusedEntries)
Function builds the new offset array, object array and assembles the index.
|
protected void |
BuildNewLGSubrs(int Font)
Function builds the new local and global subsrs indices.
|
protected void |
BuildSubrUsed(int Font, int FD, int SubrOffset, int[] SubrsOffsets, Set<Integer> hSubr, List<Integer> lSubr)
Function uses ReadAsubr on the glyph used to build the LSubr and Gsubr Map.
|
protected int |
CalcBias(int Offset, int Font)
Function calcs bias according to the CharString type and the count of the subrs
|
protected int |
CalcHints(int begin, int end, int LBias, int GBias, int[] LSubrsOffsets)
The function reads the subroutine and returns the number of the hint in it.
|
protected void |
CopyHeader()
Function Copies the header from the original fileto the output list
|
protected int |
countEntireIndexRange(int indexOffset)
Function computes the size of an index
|
protected void |
CreateCharset(CFFFont.OffsetItem charsetRef, int nglyphs)
Function creates new CharSet for non-CID fonts.
|
protected void |
CreateFDArray(CFFFont.OffsetItem fdarrayRef, CFFFont.OffsetItem privateRef, int Font)
Function creates new FDArray for non-CID fonts.
|
protected void |
CreateFDSelect(CFFFont.OffsetItem fdselectRef, int nglyphs)
Function creates new FDSelect for non-CID fonts.
|
protected void |
CreateKeys(CFFFont.OffsetItem fdarrayRef, CFFFont.OffsetItem fdselectRef, CFFFont.OffsetItem charsetRef, CFFFont.OffsetItem charstringsRef)
Function adds the keys into the TopDict
|
protected void |
CreateNewStringIndex(int Font)
Function takes the original string item and adds the new strings to accommodate the CID rules
|
protected void |
EmptyStack()
Empty the Type2 Stack
|
protected void |
HandelStack()
Function Checks how the current operator effects the run time stack after being run An operator may increase or decrease the stack size
|
protected void |
PopStack()
Pop one element from the stack
|
byte[] |
Process()
The Process function extracts one font out of the CFF file and returns a subset version of the original with the first name.
|
byte[] |
Process(String fontName)
The Process function extracts one font out of the CFF file and returns a subset version of the original.
|
protected void |
PushStack()
Add an item to the stack
|
protected void |
ReadASubr(int begin, int end, int GBias, int LBias, Set<Integer> hSubr, List<Integer> lSubr, int[] LSubrsOffsets)
The function reads a subrs (glyph info) between begin and end.
|
protected void |
ReadCommand()
The function reads the next command after the file pointer is set
|
protected void |
ReadFDArray(int Font)
Read the FDArray count, offsize and Offset array
|
protected void |
readFDSelect(int Font)
Read the FDSelect of the font and compute the array and its length
|
protected int |
StackOpp()
Function checks the key and return the change to the stack after the operator
|
exists, getCID, getDictItem, getEntireIndexRange, getNames, getString, isCID
protected void readFDSelect(int Font)
Font
- The index of the font being processed
protected void BuildFDArrayUsed(int Font)
Font
- the Number of font being processed
protected void ReadFDArray(int Font)
Font
- the Number of font being processed
public byte[] Process(String fontName)
fontName
- - The name of the font to be taken out of the CFF
public byte[] Process()
protected int CalcBias(int Offset, int Font)
Offset
- The offset to the relevant subrs index
Font
- the font
protected void BuildNewCharString(int FontIndex) throws IOException
FontIndex
- the font
IOException
protected void BuildNewLGSubrs(int Font) throws IOException
Font
- the font
IOException
protected void BuildFDSubrsOffsets(int Font, int FD)
Font
- the font
FD
- The FDARRAY processed
protected void BuildSubrUsed(int Font, int FD, int SubrOffset, int[] SubrsOffsets, Set<Integer> hSubr, List<Integer> lSubr)
Font
- the font
FD
- FD array processed. 0 indicates function was called by non CID font
SubrOffset
- the offset to the subr index to calc the bias
SubrsOffsets
- the offset array of the subr index
hSubr
- Map of the subrs used
lSubr
- list of the subrs used
protected void BuildGSubrsUsed(int Font)
Font
- the font
protected void ReadASubr(int begin, int end, int GBias, int LBias, Set<Integer> hSubr, List<Integer> lSubr, int[] LSubrsOffsets)
begin
- the start point of the subr
end
- the end point of the subr
GBias
- the bias of the Global Subrs
LBias
- the bias of the Local Subrs
hSubr
- the Map for the lSubrs
lSubr
- the list for the lSubrs
LSubrsOffsets
-
protected void HandelStack()
protected int StackOpp()
protected void EmptyStack()
protected void PopStack()
protected void PushStack()
protected void ReadCommand()
protected int CalcHints(int begin, int end, int LBias, int GBias, int[] LSubrsOffsets)
begin
- the start point of the subr
end
- the end point of the subr
LBias
- the bias of the Local Subrs
GBias
- the bias of the Global Subrs
LSubrsOffsets
- The Offsets array of the subroutines
protected byte[] BuildNewIndex(int[] Offsets, Set<Integer> Used, byte OperatorForUnusedEntries) throws IOException
Offsets
- the offset array of the original index
Used
- the Map of the used objects
OperatorForUnusedEntries
- the operator inserted into the data stream for unused entries
IOException
protected byte[] BuildNewIndexAndCopyAllGSubrs(int[] Offsets, byte OperatorForUnusedEntries) throws IOException
Offsets
- the offset array of the original index
OperatorForUnusedEntries
- the operator inserted into the data stream for unused entries
IOException
protected byte[] AssembleIndex(int[] NewOffsets, byte[] NewObjects)
NewOffsets
- the subsetted offset array
NewObjects
- the subsetted object array
protected byte[] BuildNewFile(int Font)
Font
- the font
protected void CopyHeader()
protected void BuildIndexHeader(int Count, int Offsize, int First)
Count
- the count field of the index
Offsize
- the offsize field of the index
First
- the first offset of the index
protected void CreateKeys(CFFFont.OffsetItem fdarrayRef, CFFFont.OffsetItem fdselectRef, CFFFont.OffsetItem charsetRef, CFFFont.OffsetItem charstringsRef)
fdarrayRef
- OffsetItem for the FDArray
fdselectRef
- OffsetItem for the FDSelect
charsetRef
- OffsetItem for the CharSet
charstringsRef
- OffsetItem for the CharString
protected void CreateNewStringIndex(int Font)
Font
- the font
protected void CreateFDSelect(CFFFont.OffsetItem fdselectRef, int nglyphs)
fdselectRef
- OffsetItem for the FDSelect
nglyphs
- the number of glyphs in the font
protected void CreateCharset(CFFFont.OffsetItem charsetRef, int nglyphs)
charsetRef
- OffsetItem for the CharSet
nglyphs
- the number of glyphs in the font
protected void CreateFDArray(CFFFont.OffsetItem fdarrayRef, CFFFont.OffsetItem privateRef, int Font)
fdarrayRef
- OffsetItem for the FDArray
privateRef
- OffsetItem for the Private Dict
Font
- the font
protected int countEntireIndexRange(int indexOffset)
indexOffset
- The offset for the computed index
Copyright © 1998–2020 iText Group NV. All rights reserved.