Package java.awt.font
Class NumericShaper
java.lang.Object
java.awt.font.NumericShaper
- All Implemented Interfaces:
Serializable
public final class NumericShaper extends Object implements Serializable
The Class NumericShaper provides methods to convert latin character codes
to unicode character codes.
For tables of the character codes used,
see unicode.org.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static intALL_RANGESThe Constant ALL_RANGES indicates all ranges.static intARABICThe Constant ARABIC indicates the ARABIC range and decimal base.static intBENGALIThe Constant BENGALI indicates the BENGALI range and decimal base.static intDEVANAGARIThe Constant DEVANAGARI indicates the DEVANAGARI range and decimal base.static intEASTERN_ARABICThe Constant EASTERN_ARABIC indicates the ARABIC range and ARABIC_EXTENDED decimal base.static intETHIOPICThe Constant ETHIOPIC indicates the ETHIOPIC range and decimal base.static intEUROPEANThe Constant EUROPEAN indicates the latin and extended range, and latin decimal base.static intGUJARATIThe Constant GUJARATI indicates the GUJARATI range and decimal base.static intGURMUKHIThe Constant GURMUKHI indicates the GURMUKHI range and decimal base.static intKANNADAThe Constant KANNADA indicates the KANNADA range and decimal base.static intKHMERThe Constant KHMER indicates the KHMER range and decimal base.static intLAOThe Constant LAO indicates the LAO range and decimal base.static intMALAYALAMThe Constant MALAYALAM indicates the MALAYALAM range and decimal base.static intMONGOLIANThe Constant MONGOLIAN indicates the MONGOLIAN range and decimal base.static intMYANMARThe Constant MYANMAR indicates the MYANMAR range and decimal base.static intORIYAThe Constant ORIYA indicates the ORIYA range and decimal base.static intTAMILThe Constant TAMIL indicates the TAMIL range and decimal base.static intTELUGUThe Constant TELUGU indicates the TELUGU range and decimal base.static intTHAIThe Constant THAI indicates the THAI range and decimal base.static intTIBETANThe Constant TIBETAN indicates the TIBETAN range and decimal base. -
Method Summary
Modifier and Type Method Description booleanequals(Object obj)Compares this instance with the specified object and indicates if they are equal.static NumericShapergetContextualShaper(int ranges)Gets the NumericShaper for the specified unicode ranges.static NumericShapergetContextualShaper(int ranges, int defaultContext)Gets the NumericShaper for the specified unicode ranges and default unicode range.intgetRanges()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 NumericShapergetShaper(int singleRange)Gets a NumericShaper for the specified unicode range.inthashCode()Returns an integer hash code for this object.booleanisContextual()Checks if this NumericShaper is contextual (supporting multiple script ranges) or not.voidshape(char[] text, int start, int count)Transforms the encoding of the text, starting from the character at index start and transforming count characters.voidshape(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.StringtoString()Returns a string containing a concise, human-readable description of this object.
-
Field Details
-
EUROPEAN
public static final int EUROPEANThe Constant EUROPEAN indicates the latin and extended range, and latin decimal base.- See Also:
- Constant Field Values
-
ARABIC
public static final int ARABICThe Constant ARABIC indicates the ARABIC range and decimal base.- See Also:
- Constant Field Values
-
EASTERN_ARABIC
public static final int EASTERN_ARABICThe Constant EASTERN_ARABIC indicates the ARABIC range and ARABIC_EXTENDED decimal base.- See Also:
- Constant Field Values
-
DEVANAGARI
public static final int DEVANAGARIThe Constant DEVANAGARI indicates the DEVANAGARI range and decimal base.- See Also:
- Constant Field Values
-
BENGALI
public static final int BENGALIThe Constant BENGALI indicates the BENGALI range and decimal base.- See Also:
- Constant Field Values
-
GURMUKHI
public static final int GURMUKHIThe Constant GURMUKHI indicates the GURMUKHI range and decimal base.- See Also:
- Constant Field Values
-
GUJARATI
public static final int GUJARATIThe Constant GUJARATI indicates the GUJARATI range and decimal base.- See Also:
- Constant Field Values
-
ORIYA
public static final int ORIYAThe Constant ORIYA indicates the ORIYA range and decimal base.- See Also:
- Constant Field Values
-
TAMIL
public static final int TAMILThe Constant TAMIL indicates the TAMIL range and decimal base.- See Also:
- Constant Field Values
-
TELUGU
public static final int TELUGUThe Constant TELUGU indicates the TELUGU range and decimal base.- See Also:
- Constant Field Values
-
KANNADA
public static final int KANNADAThe Constant KANNADA indicates the KANNADA range and decimal base.- See Also:
- Constant Field Values
-
MALAYALAM
public static final int MALAYALAMThe Constant MALAYALAM indicates the MALAYALAM range and decimal base.- See Also:
- Constant Field Values
-
THAI
public static final int THAIThe Constant THAI indicates the THAI range and decimal base.- See Also:
- Constant Field Values
-
LAO
public static final int LAOThe Constant LAO indicates the LAO range and decimal base.- See Also:
- Constant Field Values
-
TIBETAN
public static final int TIBETANThe Constant TIBETAN indicates the TIBETAN range and decimal base.- See Also:
- Constant Field Values
-
MYANMAR
public static final int MYANMARThe Constant MYANMAR indicates the MYANMAR range and decimal base.- See Also:
- Constant Field Values
-
ETHIOPIC
public static final int ETHIOPICThe Constant ETHIOPIC indicates the ETHIOPIC range and decimal base.- See Also:
- Constant Field Values
-
KHMER
public static final int KHMERThe Constant KHMER indicates the KHMER range and decimal base.- See Also:
- Constant Field Values
-
MONGOLIAN
public static final int MONGOLIANThe Constant MONGOLIAN indicates the MONGOLIAN range and decimal base.- See Also:
- Constant Field Values
-
ALL_RANGES
public static final int ALL_RANGESThe Constant ALL_RANGES indicates all ranges.- See Also:
- Constant Field Values
-
-
Method Details
-
hashCode
public int hashCode()Description copied from class:ObjectReturns an integer hash code for this object. By contract, any two objects for whichObject.equals(java.lang.Object)returnstruemust return the same hash code value. This means that subclasses ofObjectusually 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
hashCodemethod if you intend implementing your ownhashCodemethod.- Overrides:
hashCodein classObject- Returns:
- this object's hash code.
- See Also:
Object.equals(java.lang.Object)
-
equals
Description copied from class:ObjectCompares this instance with the specified object and indicates if they are equal. In order to be equal,omust 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
trueonly ifthis == o. See Writing a correctequalsmethod if you intend implementing your ownequalsmethod.The general contract for the
equalsandObject.hashCode()methods is that ifequalsreturnstruefor any two objects, thenhashCode()must return the same value for these objects. This means that subclasses ofObjectusually override either both methods or neither of them.- Overrides:
equalsin classObject- Parameters:
obj- the object to compare this instance with.- Returns:
trueif the specified object is equal to thisObject;falseotherwise.- See Also:
Object.hashCode()
-
toString
Description copied from class:ObjectReturns 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
toStringmethod if you intend implementing your owntoStringmethod. -
getContextualShaper
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.
-
getContextualShaper
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.
-
getRanges
public 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.- Returns:
- all ranges of this NumericShaper.
-
getShaper
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.
-
isContextual
public boolean isContextual()Checks if this NumericShaper is contextual (supporting multiple script ranges) or not.- Returns:
- true, if this NumericShaper is contextual, false otherwise.
-
shape
public 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.- 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.
-
shape
public 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.- Parameters:
text- the text to be shaped.start- the start offset of the text.count- the number of characters to be shaped.
-