GeezerVison is showing docs.oracle.com — NumericShaper (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
java.awt.font
Class NumericShaper
-
-
Nested Class Summary
Nested Classes
| Modifier and Type |
Class |
Description |
static class |
NumericShaper.Range |
A NumericShaper.Range represents a Unicode range of a
script having its own decimal digits.
|
-
Field Summary
Fields
| Modifier and Type |
Field |
Description |
static int |
ALL_RANGES |
Identifies all ranges, for full contextual shaping.
|
static int |
ARABIC |
Identifies the ARABIC range and decimal base.
|
static int |
BENGALI |
Identifies the BENGALI range and decimal base.
|
static int |
DEVANAGARI |
Identifies the DEVANAGARI range and decimal base.
|
static int |
EASTERN_ARABIC |
Identifies the ARABIC range and ARABIC_EXTENDED decimal base.
|
static int |
ETHIOPIC |
Identifies the ETHIOPIC range and decimal base.
|
static int |
EUROPEAN |
Identifies the Latin-1 (European) and extended range, and
Latin-1 (European) decimal base.
|
static int |
GUJARATI |
Identifies the GUJARATI range and decimal base.
|
static int |
GURMUKHI |
Identifies the GURMUKHI range and decimal base.
|
static int |
KANNADA |
Identifies the KANNADA range and decimal base.
|
static int |
KHMER |
Identifies the KHMER range and decimal base.
|
static int |
LAO |
Identifies the LAO range and decimal base.
|
static int |
MALAYALAM |
Identifies the MALAYALAM range and decimal base.
|
static int |
MONGOLIAN |
Identifies the MONGOLIAN range and decimal base.
|
static int |
MYANMAR |
Identifies the MYANMAR range and decimal base.
|
static int |
ORIYA |
Identifies the ORIYA range and decimal base.
|
static int |
TAMIL |
Identifies the TAMIL range and decimal base.
|
static int |
TELUGU |
Identifies the TELUGU range and decimal base.
|
static int |
THAI |
Identifies the THAI range and decimal base.
|
static int |
TIBETAN |
Identifies the TIBETAN range and decimal base.
|
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
boolean |
equals(Object o) |
Returns true if the specified object is an instance of
NumericShaper and shapes identically to this one,
regardless of the range representations, the bit mask or the
enum.
|
static NumericShaper |
getContextualShaper(int ranges) |
Returns a contextual shaper for the provided unicode range(s).
|
static NumericShaper |
getContextualShaper(int ranges,
int defaultContext) |
Returns a contextual shaper for the provided unicode range(s).
|
static NumericShaper |
getContextualShaper(Set<NumericShaper.Range> ranges) |
Returns a contextual shaper for the provided Unicode
range(s).
|
static NumericShaper |
getContextualShaper(Set<NumericShaper.Range> ranges,
NumericShaper.Range defaultContext) |
Returns a contextual shaper for the provided Unicode range(s).
|
int |
getRanges() |
Returns an int that ORs together the values for
all the ranges that will be shaped.
|
Set<NumericShaper.Range> |
getRangeSet() |
Returns a Set representing all the Unicode ranges in
this NumericShaper that will be shaped.
|
static NumericShaper |
getShaper(int singleRange) |
Returns a shaper for the provided unicode range.
|
static NumericShaper |
getShaper(NumericShaper.Range singleRange) |
Returns a shaper for the provided Unicode
range.
|
int |
hashCode() |
Returns a hash code for this shaper.
|
boolean |
isContextual() |
Returns a boolean indicating whether or not
this shaper shapes contextually.
|
void |
shape(char[] text,
int start,
int count) |
Converts the digits in the text that occur between start and
start + count.
|
void |
shape(char[] text,
int start,
int count,
int context) |
Converts the digits in the text that occur between start and
start + count, using the provided context.
|
void |
shape(char[] text,
int start,
int count,
NumericShaper.Range context) |
Converts the digits in the text that occur between start and start + count, using the provided context.
|
String |
toString() |
Returns a String that describes this shaper.
|
-
-
Field Detail
-
EUROPEAN
public static final int EUROPEAN
Identifies the Latin-1 (European) and extended range, and
Latin-1 (European) decimal base.
- See Also:
- Constant Field Values
-
Method Detail
-
getShaper
public static NumericShaper getShaper(NumericShaper.Range singleRange)
Returns a shaper for the provided Unicode
range. All Latin-1 (EUROPEAN) digits are converted to the
corresponding decimal digits of the specified Unicode range.
- Parameters:
singleRange - the Unicode range given by a NumericShaper.Range constant.
- Returns:
- a non-contextual
NumericShaper.
- Throws:
NullPointerException - if singleRange is null
- Since:
- 1.7
-
getContextualShaper
public static NumericShaper getContextualShaper(int ranges)
Returns a contextual shaper for the provided unicode range(s).
Latin-1 (EUROPEAN) digits are converted to the decimal digits
corresponding to the range of the preceding text, if the
range is one of the provided ranges. Multiple ranges are
represented by or-ing the values together, such as,
NumericShaper.ARABIC | NumericShaper.THAI. The
shaper assumes EUROPEAN as the starting context, that is, if
EUROPEAN digits are encountered before any strong directional
text in the string, the context is presumed to be EUROPEAN, and
so the digits will not shape.
- Parameters:
ranges - the specified Unicode ranges
- Returns:
- a shaper for the specified ranges
-
getContextualShaper
public static NumericShaper getContextualShaper(int ranges,
int defaultContext)
Returns a contextual shaper for the provided unicode range(s).
Latin-1 (EUROPEAN) digits will be converted to the decimal digits
corresponding to the range of the preceding text, if the
range is one of the provided ranges. Multiple ranges are
represented by or-ing the values together, for example,
NumericShaper.ARABIC | NumericShaper.THAI. The
shaper uses defaultContext as the starting context.
- Parameters:
ranges - the specified Unicode ranges
defaultContext - the starting context, such as
NumericShaper.EUROPEAN
- Returns:
- a shaper for the specified Unicode ranges.
- Throws:
IllegalArgumentException - if the specified
defaultContext is not a single valid range.
-
getContextualShaper
public static NumericShaper getContextualShaper(Set<NumericShaper.Range> ranges,
NumericShaper.Range defaultContext)
Returns a contextual shaper for the provided Unicode range(s).
The Latin-1 (EUROPEAN) digits will be converted to the decimal
digits corresponding to the range of the preceding text, if the
range is one of the provided ranges. The shaper uses defaultContext as the starting context.
- Parameters:
ranges - the specified Unicode ranges
defaultContext - the starting context, such as
NumericShaper.Range.EUROPEAN
- Returns:
- a contextual shaper for the specified Unicode ranges.
- Throws:
NullPointerException - if ranges or defaultContext is null
- Since:
- 1.7
-
shape
public void shape(char[] text,
int start,
int count)
Converts the digits in the text that occur between start and
start + count.
- Parameters:
text - an array of characters to convert
start - the index into text to start
converting
count - the number of characters in text
to convert
- Throws:
IndexOutOfBoundsException - if start or start + count is
out of bounds
NullPointerException - if text is null
-
shape
public void shape(char[] text,
int start,
int count,
int context)
Converts the digits in the text that occur between start and
start + count, using the provided context.
Context is ignored if the shaper is not a contextual shaper.
- Parameters:
text - an array of characters
start - the index into text to start
converting
count - the number of characters in text
to convert
context - the context to which to convert the
characters, such as NumericShaper.EUROPEAN
- Throws:
IndexOutOfBoundsException - if start or start + count is
out of bounds
NullPointerException - if text is null
IllegalArgumentException - if this is a contextual shaper
and the specified context is not a single valid
range.
-
shape
public void shape(char[] text,
int start,
int count,
NumericShaper.Range context)
Converts the digits in the text that occur between start and start + count, using the provided context. Context is ignored if the shaper is not a
contextual shaper.
- Parameters:
text - a char array
start - the index into text to start converting
count - the number of chars in text
to convert
context - the context to which to convert the characters,
such as NumericShaper.Range.EUROPEAN
- Throws:
IndexOutOfBoundsException - if start or start + count is out of bounds
NullPointerException - if text or context is null
- Since:
- 1.7
-
getRanges
public int getRanges()
Returns an int that ORs together the values for
all the ranges that will be shaped.
For example, to check if a shaper shapes to Arabic, you would use the
following:
if ((shaper.getRanges() & shaper.ARABIC) != 0) { ...
Note that this method supports only the bit mask-based
ranges. Call getRangeSet() for the enum-based ranges.
- Returns:
- the values for all the ranges to be shaped.
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|