SourceForge.net Logo
aXSL API 0.1

org.axsl.psR
Interface Encoding

All Known Subinterfaces:
EncodingVector

public interface Encoding

Encoding instances provide some standard encoding resources for PostScript. When a PostScript file is parsed, the characters in a string are really indices into an array of glyph names, which are in turn the keys to entries in a glyph dictionary. Input to a PostScript interpreter is not really characters, but rather character indexes. (The two might be the same, especially for ASCII characters).

So the PostScript interpreter uses a two-step process, as follows: 1. It conceptually maps character codes (integer values) to name objects like /A or /Uacute. This map is known as an "encoding". There are several standard encoding schemes defined in the PostScript standard that each interpreter must know how to handle. Those are provided as Encoding subclasses. 2. The name objects created in step 1 are then used as the key into a dictionary (contained in the Font dictionary) whose values contain the PostScript instructions needed to actually paint the glyph.


Field Summary
static char INVALID_UNICODE_CHAR
          The invalid Unicode character, suitable as a return value in methods that need to return an invalid character.
 
Method Summary
 java.lang.String asPostScript(Encoding baseEncoding)
          Returns this Encoding as a String in the format expected by PostScript.
 boolean canEncode(int codePoint)
          Determine whether a given Unicode code point can be encoded by this Encoding.
 int decodeCharacter(int encodedIndex)
          Finds the Unicode code point, if any, for a given encoding index.
 int encodeCharacter(int codePoint)
          Finds the encoding index for a given Unicode codepoint.
 int getFirstIndex()
          Returns the lowest glyph index used in this encoding.
 int getLastIndex()
          Returns the highest glyph index used in this encoding.
 java.lang.String getName()
          Return the name of this Encoding.
 boolean isPredefinedPDF()
          Indicates whether this is a predefined PDF encoding.
 boolean isPredefinedPS()
          Indicates whether this is a predefined PostScript encoding.
 

Field Detail

INVALID_UNICODE_CHAR

public static final char INVALID_UNICODE_CHAR
The invalid Unicode character, suitable as a return value in methods that need to return an invalid character.

See Also:
Constant Field Values
Method Detail

encodeCharacter

public int encodeCharacter(int codePoint)
Finds the encoding index for a given Unicode codepoint.

Parameters:
codePoint - The Unicode codepoint which should be encoded.
Returns:
The encoding index corresponding to codePoint, or 0 if there is none.

decodeCharacter

public int decodeCharacter(int encodedIndex)
Finds the Unicode code point, if any, for a given encoding index.

Parameters:
encodedIndex - The encoded index which should be decoded into a Unicode code point.
Returns:
The Unicode code point for index, or INVALID_UNICODE_CHAR if there is none.

asPostScript

public java.lang.String asPostScript(Encoding baseEncoding)
Returns this Encoding as a String in the format expected by PostScript.

Parameters:
baseEncoding - The encoding, if any, on which this encoding is based. If this encoding is similar to another encoding that will be in the same output document, setting baseEncoding to that Encoding will allow the return value of this method to include only the differences between the two encodings. Set this to null if this encoding is not based on some other encoding.
Returns:
The PostScript representation of this encoding.

getName

public java.lang.String getName()
Return the name of this Encoding.

Returns:
The name of this Encoding.

isPredefinedPS

public boolean isPredefinedPS()
Indicates whether this is a predefined PostScript encoding.

Returns:
True iff this Encoding is a predefined PostScript encoding.

isPredefinedPDF

public boolean isPredefinedPDF()
Indicates whether this is a predefined PDF encoding.

Returns:
True iff this Encoding is a predefined PDF encoding.

getFirstIndex

public int getFirstIndex()
Returns the lowest glyph index used in this encoding.

Returns:
The lowest glyph index used in this encoding.

getLastIndex

public int getLastIndex()
Returns the highest glyph index used in this encoding.

Returns:
The highest glyph index used in this encoding.

canEncode

public boolean canEncode(int codePoint)
Determine whether a given Unicode code point can be encoded by this Encoding.

Parameters:
codePoint - The Unicode code point to be tested.
Returns:
True if this Encoding can encode codePoint.

SourceForge.net Logo
aXSL API 0.1

This documentation was created September 6 2006 by The aXSL Group and may be freely copied. See license for details.