IFontEncoding

public interface IFontEncoding

Defines an interface for Font encoding.

Methods

MethodDescription
gidToUnicode(GlyphId gid)Decodes Gid to unicode.
encode(long gid, long charCode)Encodes the glyph.
unicodeToGid(long unicode)Decodes a unicode and returns glyph id.
decodeToGid(long charCode)Decodes a character code and returns glyph id.
decodeToGidParameterized(IEncodingParameters parameters, long charCode)Parameterized decode method.

gidToUnicode(GlyphId gid)

public abstract long gidToUnicode(GlyphId gid)

Decodes Gid to unicode. Glyph id is a unique number for a glyph, which is font type dependent. For example: Type1’s id is a glyph name, instance of ( GlyphStringId ) class. TTF’s id is an int index, instance of ( GlyphUInt32Id ) class.

Parameters:

ParameterTypeDescription
gidGlyphIdGlyph identifier of symbol to decode.

Returns: long - Unicode value related to glyph id passed.

encode(long gid, long charCode)

public abstract void encode(long gid, long charCode)

Encodes the glyph. For TTF Fonts the charCode is unicode.

Parameters:

ParameterTypeDescription
gidlongGlyph id.
charCodelongCharacter code associated with the glyph id.

unicodeToGid(long unicode)

public abstract GlyphId unicodeToGid(long unicode)

Decodes a unicode and returns glyph id. Glyph id is a unique number for a glyph, which is font type dependent. For example: Type1’s id is a glyph name, instance of ( GlyphStringId ) class. TTF’s id is an int index, instance of ( GlyphUInt32Id ) class.

Parameters:

ParameterTypeDescription
unicodelongUnicode to get glyph identifier for.

Returns: GlyphId - Glyph identifier related to unicode passed.

decodeToGid(long charCode)

public abstract GlyphId decodeToGid(long charCode)

Decodes a character code and returns glyph id. Glyph id is a unique number for a glyph, which is font type dependent. For example: Type1’s id is a glyph name, instance of ( GlyphStringId ) class. TTF’s id is an int index, instance of ( GlyphUInt32Id ) class.

Parameters:

ParameterTypeDescription
charCodelongCharacter code to get glyph identifier for.

Returns: GlyphId - Glyph identifier related to charCode passed.

decodeToGidParameterized(IEncodingParameters parameters, long charCode)

public abstract GlyphId decodeToGidParameterized(IEncodingParameters parameters, long charCode)

Parameterized decode method. Some font types can have multiple encoding algorithms/maps. So, IEncodingParameters interface is used to create concrete font encoding parameters.

Parameters:

ParameterTypeDescription
parametersIEncodingParametersImplementation of IEncodingParameters interface.
charCodelongCharacter code to get glyph identifier for.

Returns: GlyphId - Glyph identifier related to char code passed.