to top
Android APIs
public final class

NumericShaper

extends Object
implements Serializable
java.lang.Object
   ↳ java.awt.font.NumericShaper

Class Overview

The Class NumericShaper provides methods to convert latin character codes to unicode character codes. For tables of the character codes used, see unicode.org.

Summary

Constants
int ALL_RANGES The Constant ALL_RANGES indicates all ranges.
int ARABIC The Constant ARABIC indicates the ARABIC range and decimal base.
int BENGALI The Constant BENGALI indicates the BENGALI range and decimal base.
int DEVANAGARI The Constant DEVANAGARI indicates the DEVANAGARI range and decimal base.
int EASTERN_ARABIC The Constant EASTERN_ARABIC indicates the ARABIC range and ARABIC_EXTENDED decimal base.
int ETHIOPIC The Constant ETHIOPIC indicates the ETHIOPIC range and decimal base.
int EUROPEAN The Constant EUROPEAN indicates the latin and extended range, and latin decimal base.
int GUJARATI The Constant GUJARATI indicates the GUJARATI range and decimal base.
int GURMUKHI The Constant GURMUKHI indicates the GURMUKHI range and decimal base.
int KANNADA The Constant KANNADA indicates the KANNADA range and decimal base.
int KHMER The Constant KHMER indicates the KHMER range and decimal base.
int LAO The Constant LAO indicates the LAO range and decimal base.
int MALAYALAM The Constant MALAYALAM indicates the MALAYALAM range and decimal base.
int MONGOLIAN The Constant MONGOLIAN indicates the MONGOLIAN range and decimal base.
int MYANMAR The Constant MYANMAR indicates the MYANMAR range and decimal base.
int ORIYA The Constant ORIYA indicates the ORIYA range and decimal base.
int TAMIL The Constant TAMIL indicates the TAMIL range and decimal base.
int TELUGU The Constant TELUGU indicates the TELUGU range and decimal base.
int THAI The Constant THAI indicates the THAI range and decimal base.
int TIBETAN The Constant TIBETAN indicates the TIBETAN range and decimal base.
Public Methods
boolean equals(Object obj)
Compares this instance with the specified object and indicates if they are equal.
static NumericShaper getContextualShaper(int ranges)
Gets the NumericShaper for the specified unicode ranges.
static NumericShaper getContextualShaper(int ranges, int defaultContext)
Gets the NumericShaper for the specified unicode ranges and default unicode range.
int getRanges()
Gets the masks for all of the ranges supported by this NumericShaper, packed into an int value using the logical OR logical operation for multiple ranges: NumericShaper.DEVANAGARI | NumericShaper.BENGALI.
static NumericShaper getShaper(int singleRange)
Gets a NumericShaper for the specified unicode range.
int hashCode()
Returns an integer hash code for this object.
boolean isContextual()
Checks if this NumericShaper is contextual (supporting multiple script ranges) or not.
void shape(char[] text, int start, int count, int context)
Transforms the encoding of the text, starting from the character at index start and transforming count characters, using the specified context.
void shape(char[] text, int start, int count)
Transforms the encoding of the text, starting from the character at index start and transforming count characters.
String toString()
Returns a string containing a concise, human-readable description of this object.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int ALL_RANGES

Added in API level 1

The Constant ALL_RANGES indicates all ranges.

Constant Value: 524287 (0x0007ffff)

public static final int ARABIC

Added in API level 1

The Constant ARABIC indicates the ARABIC range and decimal base.

Constant Value: 2 (0x00000002)

public static final int BENGALI

Added in API level 1

The Constant BENGALI indicates the BENGALI range and decimal base.

Constant Value: 16 (0x00000010)

public static final int DEVANAGARI

Added in API level 1

The Constant DEVANAGARI indicates the DEVANAGARI range and decimal base.

Constant Value: 8 (0x00000008)

public static final int EASTERN_ARABIC

Added in API level 1

The Constant EASTERN_ARABIC indicates the ARABIC range and ARABIC_EXTENDED decimal base.

Constant Value: 4 (0x00000004)

public static final int ETHIOPIC

Added in API level 1

The Constant ETHIOPIC indicates the ETHIOPIC range and decimal base.

Constant Value: 65536 (0x00010000)

public static final int EUROPEAN

Added in API level 1

The Constant EUROPEAN indicates the latin and extended range, and latin decimal base.

Constant Value: 1 (0x00000001)

public static final int GUJARATI

Added in API level 1

The Constant GUJARATI indicates the GUJARATI range and decimal base.

Constant Value: 64 (0x00000040)

public static final int GURMUKHI

Added in API level 1

The Constant GURMUKHI indicates the GURMUKHI range and decimal base.

Constant Value: 32 (0x00000020)

public static final int KANNADA

Added in API level 1

The Constant KANNADA indicates the KANNADA range and decimal base.

Constant Value: 1024 (0x00000400)

public static final int KHMER

Added in API level 1

The Constant KHMER indicates the KHMER range and decimal base.

Constant Value: 131072 (0x00020000)

public static final int LAO

Added in API level 1

The Constant LAO indicates the LAO range and decimal base.

Constant Value: 8192 (0x00002000)

public static final int MALAYALAM

Added in API level 1

The Constant MALAYALAM indicates the MALAYALAM range and decimal base.

Constant Value: 2048 (0x00000800)

public static final int MONGOLIAN

Added in API level 1

The Constant MONGOLIAN indicates the MONGOLIAN range and decimal base.

Constant Value: 262144 (0x00040000)

public static final int MYANMAR

Added in API level 1

The Constant MYANMAR indicates the MYANMAR range and decimal base.

Constant Value: 32768 (0x00008000)

public static final int ORIYA

Added in API level 1

The Constant ORIYA indicates the ORIYA range and decimal base.

Constant Value: 128 (0x00000080)

public static final int TAMIL

Added in API level 1

The Constant TAMIL indicates the TAMIL range and decimal base.

Constant Value: 256 (0x00000100)

public static final int TELUGU

Added in API level 1

The Constant TELUGU indicates the TELUGU range and decimal base.

Constant Value: 512 (0x00000200)

public static final int THAI

Added in API level 1

The Constant THAI indicates the THAI range and decimal base.

Constant Value: 4096 (0x00001000)

public static final int TIBETAN

Added in API level 1

The Constant TIBETAN indicates the TIBETAN range and decimal base.

Constant Value: 16384 (0x00004000)

Public Methods

public boolean equals (Object obj)

Added in API level 1

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

The general contract for the equals and hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

Parameters
obj the object to compare this instance with.
Returns
  • true if the specified object is equal to this Object; false otherwise.

public static NumericShaper getContextualShaper (int ranges)

Added in API level 1

Gets the NumericShaper for the specified unicode ranges. The OR logical operation should be used for multiple ranges: NumericShaper.DEVANAGARI | NumericShaper.BENGALI. The NumericShaper returned by this method is contextual in that it supports multiple character ranges, depending on the context.

Parameters
ranges the unicode ranges.
Returns
  • the NumericShaper for the specified ranges.

public static NumericShaper getContextualShaper (int ranges, int defaultContext)

Added in API level 1

Gets the NumericShaper for the specified unicode ranges and default unicode range. The defaultContext parameter is used as the starting context (which indicates the language/script being used). The OR logical operation should be used for multiple ranges: NumericShaper.DEVANAGARI | NumericShaper.BENGALI. The NumericShaper returned by this method is contextual in that it supports multiple character ranges, depending on the context.

Parameters
ranges the unicode ranges.
defaultContext the default, starting context.
Returns
  • the NumericShaper for the specified ranges.

public int getRanges ()

Added in API level 1

Gets the masks for all of the ranges supported by this NumericShaper, packed into an int value using the logical OR logical operation for multiple ranges: NumericShaper.DEVANAGARI | NumericShaper.BENGALI.

Returns
  • all ranges of this NumericShaper.

public static NumericShaper getShaper (int singleRange)

Added in API level 1

Gets a NumericShaper for the specified unicode range. The NumericShaper supports only a single range and hence is not contextual.

Parameters
singleRange the specified unicode single range.
Returns
  • the NumericShaper for the specified unicode range.

public int hashCode ()

Added in API level 1

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
  • this object's hash code.

public boolean isContextual ()

Added in API level 1

Checks if this NumericShaper is contextual (supporting multiple script ranges) or not.

Returns
  • true, if this NumericShaper is contextual, false otherwise.

public void shape (char[] text, int start, int count, int context)

Added in API level 1

Transforms the encoding of the text, starting from the character at index start and transforming count characters, using the specified context.

Parameters
text the text to be shaped.
start the start offset of the text.
count the number of characters to be shaped.
context the context to be used for shaping.

public void shape (char[] text, int start, int count)

Added in API level 1

Transforms the encoding of the text, starting from the character at index start and transforming count characters.

Parameters
text the text to be shaped.
start the start offset of the text.
count the number of characters to be shaped.

public String toString ()

Added in API level 1

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.