Package org.apache.fop.fonts
Class SimpleSingleByteEncoding
- java.lang.Object
-
- org.apache.fop.fonts.SimpleSingleByteEncoding
-
- All Implemented Interfaces:
SingleByteEncoding
public class SimpleSingleByteEncoding extends java.lang.Object implements SingleByteEncoding
A simple implementation of the OneByteEncoding mostly used for encodings that are constructed on-the-fly.
-
-
Field Summary
-
Fields inherited from interface org.apache.fop.fonts.SingleByteEncoding
NOT_FOUND_CODE_POINT
-
-
Constructor Summary
Constructors Constructor Description SimpleSingleByteEncoding(java.lang.String name)Main constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description charaddCharacter(NamedCharacter ch)Adds a new character to the encoding.NamedCharactergetCharacterForIndex(int codePoint)Returns the named character at a given code point in the encoding.java.lang.String[]getCharNameMap()Returns the array of character names for this encoding.intgetFirstChar()Returns the index of the first defined character.intgetLastChar()Returns the index of the last defined character.java.lang.StringgetName()Returns the encoding's name.intgetSize()Returns the number of characters defined by this encoding.char[]getUnicodeCharMap()Returns a character array with Unicode scalar values which can be used to map encoding code points to Unicode values.booleanisFull()Indicates whether the encoding is full (with 256 code points).charmapChar(char c)Maps a Unicode character to a code point in the encoding.java.lang.StringtoString()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the encoding's name.- Specified by:
getNamein interfaceSingleByteEncoding- Returns:
- the name of the encoding
-
mapChar
public char mapChar(char c)
Maps a Unicode character to a code point in the encoding.- Specified by:
mapCharin interfaceSingleByteEncoding- Parameters:
c- the Unicode character to map- Returns:
- the code point in the encoding or 0 (=.notdef) if not found
-
getCharNameMap
public java.lang.String[] getCharNameMap()
Returns the array of character names for this encoding.- Specified by:
getCharNameMapin interfaceSingleByteEncoding- Returns:
- the array of character names (unmapped code points are represented by a ".notdef" value)
-
getFirstChar
public int getFirstChar()
Returns the index of the first defined character.- Returns:
- the index of the first defined character (always 1 for this class)
-
getLastChar
public int getLastChar()
Returns the index of the last defined character.- Returns:
- the index of the last defined character
-
getSize
public int getSize()
Returns the number of characters defined by this encoding.- Returns:
- the number of characters
-
isFull
public boolean isFull()
Indicates whether the encoding is full (with 256 code points).- Returns:
- true if the encoding is full
-
addCharacter
public char addCharacter(NamedCharacter ch)
Adds a new character to the encoding.- Parameters:
ch- the named character- Returns:
- the code point assigned to the character
-
getCharacterForIndex
public NamedCharacter getCharacterForIndex(int codePoint)
Returns the named character at a given code point in the encoding.- Parameters:
codePoint- the code point of the character- Returns:
- the NamedCharacter (or null if no character is at this position)
-
getUnicodeCharMap
public char[] getUnicodeCharMap()
Returns a character array with Unicode scalar values which can be used to map encoding code points to Unicode values. Note that this does not return all possible Unicode values that the encoding maps.- Specified by:
getUnicodeCharMapin interfaceSingleByteEncoding- Returns:
- a character array with Unicode scalar values
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-