Top Description Inners Fields Constructors Methods
org.apache.fontbox.cff

public Class Type2CharStringParser

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.ArrayList, .List, org.apache.fontbox.cff.CharStringCommand.Type2KeyWord

This class represents a converter for a mapping into a Type2-sequence.
Author
Villu Ruusmann

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final int
private final String
private static final int

Constructor Summary

AccessConstructor and Description
public
Type2CharStringParser(String
font name
fontName
)

Constructs a new Type1CharStringParser object for a Type 1-equivalent font.

Method Summary

Modifier and TypeMethod and Description
private int
calculateSubrNumber(int operand, int subrIndexlength)

private int
private int
getMaskLength(int hstemCount, int vstemCount)

private byte[]
getSubrBytes(byte[][] subrIndex, Type2CharStringParser.GlyphData glyphData)

public List<Object>

Returns:

the Type2 sequence
parse
(byte[]
the given mapping as byte array
bytes
,
byte[][]
array containing all global subroutines
globalSubrIndex
,
byte[][]
array containing all local subroutines
localSubrIndex
,
String
the name of the current glyph
glyphName
)

The given byte array will be parsed and converted to a Type2 sequence.

private void
parseSequence(byte[] bytes, byte[][] globalSubrIndex, byte[][] localSubrIndex, Type2CharStringParser.GlyphData glyphData)

private void
processCallGSubr(byte[][] globalSubrIndex, byte[][] localSubrIndex, Type2CharStringParser.GlyphData glyphData)

private void
processCallSubr(byte[][] globalSubrIndex, byte[][] localSubrIndex, Type2CharStringParser.GlyphData glyphData)

private void
processSubr(byte[][] globalSubrIndex, byte[][] localSubrIndex, byte[] subrBytes, Type2CharStringParser.GlyphData glyphData)

private CharStringCommand
private Number
readNumber(int b0, DataInput input)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

CALLGSUBRback to summary
private static final int CALLGSUBR
CALLSUBRback to summary
private static final int CALLSUBR
CNTRMASKback to summary
private static final int CNTRMASK
fontNameback to summary
private final String fontName
HINTMASKback to summary
private static final int HINTMASK

Constructor Detail

Type2CharStringParserback to summary
public Type2CharStringParser(String fontName)

Constructs a new Type1CharStringParser object for a Type 1-equivalent font.

Parameters
fontName:String

font name

Method Detail

calculateSubrNumberback to summary
private int calculateSubrNumber(int operand, int subrIndexlength)
countNumbersback to summary
private int countNumbers(List<Object> sequence)
getMaskLengthback to summary
private int getMaskLength(int hstemCount, int vstemCount)
getSubrBytesback to summary
private byte[] getSubrBytes(byte[][] subrIndex, Type2CharStringParser.GlyphData glyphData)
parseback to summary
public List<Object> parse(byte[] bytes, byte[][] globalSubrIndex, byte[][] localSubrIndex, String glyphName) throws IOException

The given byte array will be parsed and converted to a Type2 sequence.

Parameters
bytes:byte[]

the given mapping as byte array

globalSubrIndex:byte[][]

array containing all global subroutines

localSubrIndex:byte[][]

array containing all local subroutines

glyphName:String

the name of the current glyph

Returns:List<Object>

the Type2 sequence

Exceptions
IOException:
if an error occurs during reading
parseSequenceback to summary
private void parseSequence(byte[] bytes, byte[][] globalSubrIndex, byte[][] localSubrIndex, Type2CharStringParser.GlyphData glyphData) throws IOException
processCallGSubrback to summary
private void processCallGSubr(byte[][] globalSubrIndex, byte[][] localSubrIndex, Type2CharStringParser.GlyphData glyphData) throws IOException
processCallSubrback to summary
private void processCallSubr(byte[][] globalSubrIndex, byte[][] localSubrIndex, Type2CharStringParser.GlyphData glyphData) throws IOException
processSubrback to summary
private void processSubr(byte[][] globalSubrIndex, byte[][] localSubrIndex, byte[] subrBytes, Type2CharStringParser.GlyphData glyphData) throws IOException
readCommandback to summary
private CharStringCommand readCommand(int b0, DataInput input, Type2CharStringParser.GlyphData glyphData) throws IOException
readNumberback to summary
private Number readNumber(int b0, DataInput input) throws IOException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.apache.fontbox.cff back to summary

private Class Type2CharStringParser.GlyphData

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv final List<Object>
pack-priv int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hstemCountback to summary
pack-priv int hstemCount
sequenceback to summary
pack-priv final List<Object> sequence
vstemCountback to summary
pack-priv int vstemCount

Constructor Detail

GlyphDataback to summary
private GlyphData()