|
|||||||||
| Home >> All >> java >> awt >> [ font overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.awt.font
Class NumericShaper

java.lang.Objectjava.awt.font.NumericShaper
- All Implemented Interfaces:
- java.io.Serializable
- public final class NumericShaper
- extends java.lang.Object
- implements java.io.Serializable
- extends java.lang.Object
This class handles numeric shaping. A shaper can either be contextual or not. A non-contextual shaper will always translate ASCII digits in its input into the target Unicode range. A contextual shaper will change the target Unicode range depending on the characters it has previously processed.
- Since:
- 1.4
| Field Summary | |
static int |
ALL_RANGES
Convenience constant representing all the valid Unicode ranges. |
static int |
ARABIC
Constant representing the Unicode ARABIC range. |
static int |
BENGALI
Constant representing the Unicode BENGALI range. |
static int |
DEVANAGARI
Constant representing the Unicode DEVANAGARI range. |
static int |
EASTERN_ARABIC
Constant representing the Unicode extended arabic range. |
static int |
ETHIOPIC
Constant representing the Unicode ETHIOPIC range. |
static int |
EUROPEAN
Constant representing the Unicode EUROPEAN range. |
static int |
GUJARATI
Constant representing the Unicode GUJARATI range. |
static int |
GURMUKHI
Constant representing the Unicode GURMUKHI range. |
static int |
KANNADA
Constant representing the Unicode KANNADA range. |
private int |
key
The default initial context for this shaper, specified as an integer from 0 to 18. |
static int |
KHMER
Constant representing the Unicode KHMER range. |
static int |
LAO
Constant representing the Unicode LAO range. |
static int |
MALAYALAM
Constant representing the Unicode MALAYALAM range. |
private int |
mask
The target ranges handled by this shaper. |
static int |
MONGOLIAN
Constant representing the Unicode MONGOLIAN range. |
static int |
MYANMAR
Constant representing the Unicode MYANMAR range. |
static int |
ORIYA
Constant representing the Unicode ORIYA range. |
private static long |
serialVersionUID
|
static int |
TAMIL
Constant representing the Unicode TAMIL range. |
static int |
TELUGU
Constant representing the Unicode TELUGU range. |
static int |
THAI
Constant representing the Unicode THAI range. |
static int |
TIBETAN
Constant representing the Unicode TIBETAN range. |
private static char[] |
zeroDigits
This table holds the zero digits for each language. |
| Constructor Summary | |
private |
NumericShaper(int key,
int mask)
Create a new numeric shaper. |
| Method Summary | |
private int |
classify(java.lang.Character.UnicodeBlock b)
Given a unicode block object, return corresponding language constant. |
boolean |
equals(java.lang.Object obj)
Determine whether this Object is semantically equal to another Object. |
static NumericShaper |
getContextualShaper(int ranges)
Return a contextual shaper which can shape to any of the indicated languages. |
static NumericShaper |
getContextualShaper(int ranges,
int defaultContext)
Return a contextual shaper which can shape to any of the indicated languages. |
int |
getRanges()
Return an integer representing all the languages for which this shaper will shape. |
static NumericShaper |
getShaper(int singleRange)
Return a non-contextual shaper which can shape to a single range. |
int |
hashCode()
Get a value that represents this Object, as uniquely as possible within the confines of an int. |
boolean |
isContextual()
Return true if this shaper is contextual, false if it is not. |
void |
shape(char[] text,
int start,
int count)
Shape the text in the given array. |
void |
shape(char[] text,
int start,
int count,
int context)
Shape the given text, using the indicated initial context. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
ALL_RANGES
public static final int ALL_RANGES
- Convenience constant representing all the valid Unicode ranges.
- See Also:
- Constant Field Values
ARABIC
public static final int ARABIC
- Constant representing the Unicode ARABIC range. Shaping done
using this range will translate to the arabic decimal characters.
Use EASTERN_ARABIC if you want to shape to the eastern arabic
(also known as the extended arabic) decimal characters.
- See Also:
- Constant Field Values
BENGALI
public static final int BENGALI
- Constant representing the Unicode BENGALI range.
- See Also:
- Constant Field Values
DEVANAGARI
public static final int DEVANAGARI
- Constant representing the Unicode DEVANAGARI range.
- See Also:
- Constant Field Values
EASTERN_ARABIC
public static final int EASTERN_ARABIC
- Constant representing the Unicode extended arabic range.
In Unicode there are two different sets of arabic digits;
this selects the extended or eastern set.
- See Also:
- Constant Field Values
ETHIOPIC
public static final int ETHIOPIC
- Constant representing the Unicode ETHIOPIC range. Note that
there is no digit zero in this range; an ASCII digit zero
is left unchanged when shaping to this range.
- See Also:
- Constant Field Values
EUROPEAN
public static final int EUROPEAN
- Constant representing the Unicode EUROPEAN range. For
contextual shaping purposes, characters in the various
extended Latin character blocks are recognized as EUROPEAN.
- See Also:
- Constant Field Values
GUJARATI
public static final int GUJARATI
- Constant representing the Unicode GUJARATI range.
- See Also:
- Constant Field Values
GURMUKHI
public static final int GURMUKHI
- Constant representing the Unicode GURMUKHI range.
- See Also:
- Constant Field Values
KANNADA
public static final int KANNADA
- Constant representing the Unicode KANNADA range.
- See Also:
- Constant Field Values
KHMER
public static final int KHMER
- Constant representing the Unicode KHMER range.
- See Also:
- Constant Field Values
LAO
public static final int LAO
- Constant representing the Unicode LAO range.
- See Also:
- Constant Field Values
MALAYALAM
public static final int MALAYALAM
- Constant representing the Unicode MALAYALAM range.
- See Also:
- Constant Field Values
MONGOLIAN
public static final int MONGOLIAN
- Constant representing the Unicode MONGOLIAN range.
- See Also:
- Constant Field Values
MYANMAR
public static final int MYANMAR
- Constant representing the Unicode MYANMAR range.
- See Also:
- Constant Field Values
ORIYA
public static final int ORIYA
- Constant representing the Unicode ORIYA range.
- See Also:
- Constant Field Values
TAMIL
public static final int TAMIL
- Constant representing the Unicode TAMIL range. Note that
there is no digit zero in this range; an ASCII digit zero
is left unchanged when shaping to this range.
- See Also:
- Constant Field Values
TELUGU
public static final int TELUGU
- Constant representing the Unicode TELUGU range.
- See Also:
- Constant Field Values
THAI
public static final int THAI
- Constant representing the Unicode THAI range.
- See Also:
- Constant Field Values
TIBETAN
public static final int TIBETAN
- Constant representing the Unicode TIBETAN range.
- See Also:
- Constant Field Values
zeroDigits
private static final char[] zeroDigits
- This table holds the zero digits for each language. This is hard-coded
because the values will not change and the table layout is tied to the
other constants in this class in any case. In the two places where a
language does not have a zero digit, the character immediately preceeding
the one digit is used instead. These languages are special-cased in
the shaping code.
key
private int key
- The default initial context for this shaper, specified as
an integer from 0 to 18.
mask
private int mask
- The target ranges handled by this shaper. If the shaper
is not contextual, the high bit of this field will be set.
| Constructor Detail |
NumericShaper
private NumericShaper(int key,
int mask)
- Create a new numeric shaper. The key given is a constant from
this class, the constructor turns it into its internal form.
| Method Detail |
getRanges
public int getRanges()
- Return an integer representing all the languages for which this
shaper will shape. The result is taken by "or"ing together
the constants representing the various languages.
isContextual
public boolean isContextual()
- Return true if this shaper is contextual, false if it is not.
shape
public void shape(char[] text,
int start,
int count)
- Shape the text in the given array. The starting context will
be the context passed to the shaper at creation time.
classify
private int classify(java.lang.Character.UnicodeBlock b)
- Given a unicode block object, return corresponding language constant.
If the block is not recognized, returns zero. Note that as there
is no separate ARABIC block in Character, this case must
be specially handled by the caller; EASTERN_ARABIC is preferred when
both are specified.
shape
public void shape(char[] text,
int start,
int count,
int context)
- Shape the given text, using the indicated initial context.
If this shaper is not a contextual shaper, then the given context
will be ignored.
equals
public boolean equals(java.lang.Object obj)
- Description copied from class:
java.lang.Object - Determine whether this Object is semantically equal
to another Object.
There are some fairly strict requirements on this method which subclasses must follow:
- It must be transitive. If
a.equals(b)andb.equals(c), thena.equals(c)must be true as well. - It must be symmetric.
a.equals(b)andb.equals(a)must have the same value. - It must be reflexive.
a.equals(a)must always be true. - It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
a.equals(null)must be false.- It must be consistent with hashCode(). That is,
a.equals(b)must implya.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.
This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for
a.equals(b)to be true even thougha.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.In general, the Collections API (
java.util) use theequalsmethod rather than the==operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.The default implementation returns
this == o. - It must be transitive. If
hashCode
public int hashCode()
- Description copied from class:
java.lang.Object - Get a value that represents this Object, as uniquely as
possible within the confines of an int.
There are some requirements on this method which subclasses must follow:
- Semantic equality implies identical hashcodes. In other
words, if
a.equals(b)is true, thena.hashCode() == b.hashCode()must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal. - It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.
Notice that since
hashCodeis used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.The default implementation returns
System.identityHashCode(this) - Semantic equality implies identical hashcodes. In other
words, if
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
getShaper
public static NumericShaper getShaper(int singleRange)
- Return a non-contextual shaper which can shape to a single range.
All ASCII digits in the input text are translated to this language.
getContextualShaper
public static NumericShaper getContextualShaper(int ranges)
- Return a contextual shaper which can shape to any of the indicated
languages. The default initial context for this shaper is EUROPEAN.
getContextualShaper
public static NumericShaper getContextualShaper(int ranges, int defaultContext)
- Return a contextual shaper which can shape to any of the indicated
languages. The default initial context for this shaper is given as
an argument.
|
|||||||||
| Home >> All >> java >> awt >> [ font overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
java.awt.font.NumericShaper