Method from org.apache.fontbox.encoding.Encoding Detail: |
protected void addCharacterEncoding(int code,
String name) {
codeToName.put( code, name );
nameToCode.put( name, code );
}
This will add a character encoding. |
public String getCharacter(int code) throws IOException {
return getCharacter( getName( code ) );
}
This will get the character from the code. |
public static String getCharacter(String name) {
String character = NAME_TO_CHARACTER.get( name );
if( character == null )
{
character = name;
}
return character;
}
This will get the character from the name. |
public int getCode(String name) throws IOException {
Integer code = nameToCode.get( name );
if( code == null )
{
throw new IOException( "No character code for character name '" + name + "'" );
}
return code.intValue();
}
This will get the character code for the name. |
public String getName(int code) throws IOException {
String name = codeToName.get( code );
if( name == null )
{
//lets be forgiving for now
name = "space";
//throw new IOException( getClass().getName() +
// ": No name for character code '" + code + "'" );
}
return name;
}
This will take a character code and get the name from the code. |
public String getNameFromCharacter(char c) throws IOException {
String name = CHARACTER_TO_NAME.get( c );
if( name == null )
{
throw new IOException( "No name for character '" + c + "'" );
}
return name;
}
This will take a character code and get the name from the code. |