Top Description Fields Constructors Methods
org.apache.fontbox.encoding

public abstract Class Encoding

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.fontbox.encoding.MacRomanEncoding, org.apache.fontbox.encoding.StandardEncoding, org.apache.fontbox.cff.CFFEncoding, org.apache.fontbox.encoding.BuiltInEncoding
Imports
java.util.Collections, .HashMap, .Map

A PostScript Encoding vector.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private final Map<Integer, String>
codeToName

This is a mapping from a character code to a character name.

private final Map<String, Integer>
nameToCode

This is a mapping from a character name to a character code.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
addCharacterEncoding(int
The character code that matches the character.
code
,
String
The name of the character.
name
)

This will add a character encoding.

public Integer

Returns:

The code for the character or null if it is not in the encoding.
getCode
(String
The name of the character.
name
)

This will get the character code for the name.

public Map<Integer, String>

Returns:

the Code2Name map
getCodeToNameMap
()

Returns an unmodifiable view of the code to name mapping.

public String

Returns:

The name of the character, or ".notdef" if the bame doesn't exist.
getName
(int
The character code.
code
)

This will take a character code and get the name from the code.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

codeToNameback to summary
private final Map<Integer, String> codeToName

This is a mapping from a character code to a character name.

nameToCodeback to summary
private final Map<String, Integer> nameToCode

This is a mapping from a character name to a character code.

Constructor Detail

Encodingback to summary
public Encoding()

Method Detail

addCharacterEncodingback to summary
protected void addCharacterEncoding(int code, String name)

This will add a character encoding.

Parameters
code:int

The character code that matches the character.

name:String

The name of the character.

getCodeback to summary
public Integer getCode(String name)

This will get the character code for the name.

Parameters
name:String

The name of the character.

Returns:Integer

The code for the character or null if it is not in the encoding.

getCodeToNameMapback to summary
public Map<Integer, String> getCodeToNameMap()

Returns an unmodifiable view of the code to name mapping.

Returns:Map<Integer, String>

the Code2Name map

getNameback to summary
public String getName(int code)

This will take a character code and get the name from the code. This method will never return null.

Parameters
code:int

The character code.

Returns:String

The name of the character, or ".notdef" if the bame doesn't exist.