Package com.tom_roush.fontbox.encoding
Class Encoding
- java.lang.Object
-
- com.tom_roush.fontbox.encoding.Encoding
-
- Direct Known Subclasses:
BuiltInEncoding,CFFEncoding,MacRomanEncoding,StandardEncoding
public abstract class Encoding extends Object
A PostScript Encoding vector.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Integer,String>codeToNameThis is a mapping from a character code to a character name.protected Map<String,Integer>nameToCodeThis is a mapping from a character name to a character code.
-
Constructor Summary
Constructors Constructor Description Encoding()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddCharacterEncoding(int code, String name)This will add a character encoding.IntegergetCode(String name)This will get the character code for the name.Map<Integer,String>getCodeToNameMap()Returns an unmodifiable view of the code to name mapping.StringgetName(int code)This will take a character code and get the name from the code.
-
-
-
Method Detail
-
addCharacterEncoding
protected void addCharacterEncoding(int code, String name)This will add a character encoding.- Parameters:
code- The character code that matches the character.name- The name of the character.
-
getCode
public Integer getCode(String name)
This will get the character code for the name.- Parameters:
name- The name of the character.- Returns:
- The code for the character or null if it is not in the encoding.
-
getName
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- The character code.- Returns:
- The name of the character, or ".notdef" if the bame doesn't exist.
-
-