NumericShaper Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The NumericShaper
class is used to convert Latin-1 (European)
digits to other Unicode decimal digits.
[Android.Runtime.Register("java/awt/font/NumericShaper", DoNotGenerateAcw=true)]
public sealed class NumericShaper : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable
[<Android.Runtime.Register("java/awt/font/NumericShaper", DoNotGenerateAcw=true)>]
type NumericShaper = class
inherit Object
interface ISerializable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Inheritance
- Attributes
- Implements
Remarks
The NumericShaper
class is used to convert Latin-1 (European) digits to other Unicode decimal digits. Users of this class will primarily be people who wish to present data using national digit shapes, but find it more convenient to represent the data internally using Latin-1 (European) digits. This does not interpret the deprecated numeric shape selector character (U+206E).
Instances of NumericShaper
are typically applied as attributes to text with the TextAttribute#NUMERIC_SHAPING NUMERIC_SHAPING
attribute of the TextAttribute
class. For example, this code snippet causes a TextLayout
to shape European digits to Arabic in an Arabic context:<br> <blockquote>
Map map = new HashMap();
map.put(TextAttribute.NUMERIC_SHAPING,
NumericShaper.getContextualShaper(NumericShaper.ARABIC));
FontRenderContext frc = ...;
TextLayout layout = new TextLayout(text, map, frc);
layout.draw(g2d, x, y);
</blockquote> <br> It is also possible to perform numeric shaping explicitly using instances of NumericShaper
, as this code snippet demonstrates:<br> <blockquote>
char[] text = ...;
// shape all EUROPEAN digits (except zero) to ARABIC digits
NumericShaper shaper = NumericShaper.getShaper(NumericShaper.ARABIC);
shaper.shape(text, start, count);
// shape European digits to ARABIC digits if preceding text is Arabic, or
// shape European digits to TAMIL digits if preceding text is Tamil, or
// leave European digits alone if there is no preceding text, or
// preceding text is neither Arabic nor Tamil
NumericShaper shaper =
NumericShaper.getContextualShaper(NumericShaper.ARABIC |
NumericShaper.TAMIL,
NumericShaper.EUROPEAN);
shaper.shape(text, start, count);
</blockquote>
<b>Bit mask- and enum-based Unicode ranges</b>
This class supports two different programming interfaces to represent Unicode ranges for script-specific digits: bit mask-based ones, such as #ARABIC NumericShaper.ARABIC
, and enum-based ones, such as NumericShaper.Range#ARABIC
. Multiple ranges can be specified by ORing bit mask-based constants, such as: <blockquote>
NumericShaper.ARABIC | NumericShaper.TAMIL
</blockquote> or creating a Set
with the NumericShaper.Range
constants, such as: <blockquote>
EnumSet.of(NumericShaper.Scirpt.ARABIC, NumericShaper.Range.TAMIL)
</blockquote> The enum-based ranges are a super set of the bit mask-based ones.
If the two interfaces are mixed (including serialization), Unicode range values are mapped to their counterparts where such mapping is possible, such as NumericShaper.Range.ARABIC
from/to NumericShaper.ARABIC
. If any unmappable range values are specified, such as NumericShaper.Range.BALINESE
, those ranges are ignored.
<b>Decimal Digits Precedence</b>
A Unicode range may have more than one set of decimal digits. If multiple decimal digits sets are specified for the same Unicode range, one of the sets will take precedence as follows.
<table border=1 cellspacing=3 cellpadding=0 summary="NumericShaper constants precedence."> <tr> <th class="TableHeadingColor">Unicode Range</th> <th class="TableHeadingColor">NumericShaper
Constants</th> <th class="TableHeadingColor">Precedence</th> </tr> <tr> <td rowspan="2">Arabic</td> <td>NumericShaper#ARABIC NumericShaper.ARABIC
<br> NumericShaper#EASTERN_ARABIC NumericShaper.EASTERN_ARABIC
</td> <td>NumericShaper#EASTERN_ARABIC NumericShaper.EASTERN_ARABIC
</td> </tr> <tr> <td>NumericShaper.Range#ARABIC
<br> NumericShaper.Range#EASTERN_ARABIC
</td> <td>NumericShaper.Range#EASTERN_ARABIC
</td> </tr> <tr> <td>Tai Tham</td> <td>NumericShaper.Range#TAI_THAM_HORA
<br> NumericShaper.Range#TAI_THAM_THAM
</td> <td>NumericShaper.Range#TAI_THAM_THAM
</td> </tr> </table>
Added in 1.4.
Java documentation for java.awt.font.NumericShaper
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Fields
AllRanges |
Obsolete.
Identifies all ranges, for full contextual shaping. |
Arabic |
Obsolete.
Identifies the ARABIC range and decimal base. |
Bengali |
Obsolete.
Identifies the BENGALI range and decimal base. |
Devanagari |
Obsolete.
Identifies the DEVANAGARI range and decimal base. |
EasternArabic |
Obsolete.
Identifies the ARABIC range and ARABIC_EXTENDED decimal base. |
Ethiopic |
Obsolete.
Identifies the ETHIOPIC range and decimal base. |
European |
Obsolete.
Identifies the Latin-1 (European) and extended range, and Latin-1 (European) decimal base. |
Gujarati |
Obsolete.
Identifies the GUJARATI range and decimal base. |
Gurmukhi |
Obsolete.
Identifies the GURMUKHI range and decimal base. |
Kannada |
Obsolete.
Identifies the KANNADA range and decimal base. |
Khmer |
Obsolete.
Identifies the KHMER range and decimal base. |
Lao |
Obsolete.
Identifies the LAO range and decimal base. |
Malayalam |
Obsolete.
Identifies the MALAYALAM range and decimal base. |
Mongolian |
Obsolete.
Identifies the MONGOLIAN range and decimal base. |
Myanmar |
Obsolete.
Identifies the MYANMAR range and decimal base. |
Oriya |
Obsolete.
Identifies the ORIYA range and decimal base. |
Tamil |
Obsolete.
Identifies the TAMIL range and decimal base. |
Telugu |
Obsolete.
Identifies the TELUGU range and decimal base. |
Thai |
Obsolete.
Identifies the THAI range and decimal base. |
Tibetan |
Obsolete.
Identifies the TIBETAN range and decimal base. |
Properties
Class |
Returns the runtime class of this |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
IsContextual |
Returns a |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
PeerReference | (Inherited from Object) |
Ranges |
Returns an |
RangeSet |
Returns a |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
Methods
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
GetContextualShaper(Ranges) |
Returns a contextual shaper for the provided unicode range(s). |
GetContextualShaper(Ranges, Int32) |
Returns a contextual shaper for the provided unicode range(s). |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
GetShaper(Ranges) |
Returns a shaper for the provided unicode range. |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
Shape(Char[], Int32, Int32) |
Converts the digits in the text that occur between start and start + count. |
Shape(Char[], Int32, Int32, Int32) |
Converts the digits in the text that occur between start and start + count, using the provided context. |
Shape(Char[], Int32, Int32, NumericShaper+Range) |
Converts the digits in the text that occur between start and start + count. |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |