Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/java/awt/font/NumericShaper#constants) \| [Methods](https://developer.android.com/reference/java/awt/font/NumericShaper#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/awt/font/NumericShaper#inhmethods)

# NumericShaper

` public final class NumericShaper `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/java/io/Serializable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.awt.font.NumericShaper |

<br />

*** ** * ** ***

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 `https://developer.android.com/reference/java/awt/font/TextAttribute#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:  
>
> ```
> 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);
> ```

It is also possible to perform numeric shaping explicitly using instances of `NumericShaper`, as this code snippet demonstrates:  
>
> ```
> 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);
> ```

**Bit mask- and enum-based Unicode ranges**

This class supports two different programming interfaces to represent Unicode ranges for script-specific digits: bit mask-based ones, such as `https://developer.android.com/reference/java/awt/font/NumericShaper#ARABIC`, and enum-based ones, such as `https://developer.android.com/reference/java/awt/font/NumericShaper.Range#ARABIC`. Multiple ranges can be specified by ORing bit mask-based constants, such as:
>
> ```
> NumericShaper.ARABIC | NumericShaper.TAMIL
> ```
or creating a `Set` with the `https://developer.android.com/reference/java/awt/font/NumericShaper.Range` constants, such as:
>
> ```
> EnumSet.of(NumericShaper.Scirpt.ARABIC, NumericShaper.Range.TAMIL)
> ```
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.

**Decimal Digits Precedence**

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.

| Unicode Range | `NumericShaper` Constants | Precedence |
|---|---|---|
| Arabic | `https://developer.android.com/reference/java/awt/font/NumericShaper#ARABIC` `https://developer.android.com/reference/java/awt/font/NumericShaper#EASTERN_ARABIC` | `https://developer.android.com/reference/java/awt/font/NumericShaper#EASTERN_ARABIC` |
| Arabic | `https://developer.android.com/reference/java/awt/font/NumericShaper.Range#ARABIC` `https://developer.android.com/reference/java/awt/font/NumericShaper.Range#EASTERN_ARABIC` | `https://developer.android.com/reference/java/awt/font/NumericShaper.Range#EASTERN_ARABIC` |
| Tai Tham | `https://developer.android.com/reference/java/awt/font/NumericShaper.Range#TAI_THAM_HORA` `https://developer.android.com/reference/java/awt/font/NumericShaper.Range#TAI_THAM_THAM` | `https://developer.android.com/reference/java/awt/font/NumericShaper.Range#TAI_THAM_THAM` |

<br />

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#ALL_RANGES` Identifies all ranges, for full contextual shaping. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#ARABIC` Identifies the ARABIC range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#BENGALI` Identifies the BENGALI range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#DEVANAGARI` Identifies the DEVANAGARI range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#EASTERN_ARABIC` Identifies the ARABIC range and ARABIC_EXTENDED decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#ETHIOPIC` Identifies the ETHIOPIC range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#EUROPEAN` Identifies the Latin-1 (European) and extended range, and Latin-1 (European) decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#GUJARATI` Identifies the GUJARATI range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#GURMUKHI` Identifies the GURMUKHI range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#KANNADA` Identifies the KANNADA range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#KHMER` Identifies the KHMER range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#LAO` Identifies the LAO range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#MALAYALAM` Identifies the MALAYALAM range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#MONGOLIAN` Identifies the MONGOLIAN range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#MYANMAR` Identifies the MYANMAR range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#ORIYA` Identifies the ORIYA range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#TAMIL` Identifies the TAMIL range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#TELUGU` Identifies the TELUGU range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#THAI` Identifies the THAI range and decimal base. |
| `int` | `https://developer.android.com/reference/java/awt/font/NumericShaper#TIBETAN` Identifies the TIBETAN range and decimal base. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/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 https://developer.android.com/reference/java/awt/font/NumericShaper` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#getContextualShaper(java.util.Set<java.awt.font.NumericShaper.Range>)(https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/awt/font/NumericShaper.Range> ranges) ` Returns a contextual shaper for the provided Unicode range(s). |
| ` static https://developer.android.com/reference/java/awt/font/NumericShaper` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#getContextualShaper(int,%20int)(int ranges, int defaultContext) ` Returns a contextual shaper for the provided unicode range(s). |
| ` static https://developer.android.com/reference/java/awt/font/NumericShaper` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#getContextualShaper(java.util.Set<java.awt.font.NumericShaper.Range>,%20java.awt.font.NumericShaper.Range)(https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/awt/font/NumericShaper.Range> ranges, https://developer.android.com/reference/java/awt/font/NumericShaper.Range defaultContext) ` Returns a contextual shaper for the provided Unicode range(s). |
| ` static https://developer.android.com/reference/java/awt/font/NumericShaper` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#getContextualShaper(int)(int ranges) ` Returns a contextual shaper for the provided unicode range(s). |
| ` https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/awt/font/NumericShaper.Range>` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#getRangeSet()() ` Returns a `Set` representing all the Unicode ranges in this `NumericShaper` that will be shaped. |
| ` int` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#getRanges()() ` Returns an `int` that ORs together the values for all the ranges that will be shaped. |
| ` static https://developer.android.com/reference/java/awt/font/NumericShaper` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#getShaper(int)(int singleRange) ` Returns a shaper for the provided unicode range. |
| ` static https://developer.android.com/reference/java/awt/font/NumericShaper` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#getShaper(java.awt.font.NumericShaper.Range)(https://developer.android.com/reference/java/awt/font/NumericShaper.Range singleRange) ` Returns a shaper for the provided Unicode range. |
| ` int` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#hashCode()() ` Returns a hash code for this shaper. |
| ` boolean` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#isContextual()() ` Returns a `boolean` indicating whether or not this shaper shapes contextually. |
| ` void` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#shape(char[],%20int,%20int)(char[] text, int start, int count) ` Converts the digits in the text that occur between start and start + count. |
| ` void` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#shape(char[],%20int,%20int,%20java.awt.font.NumericShaper.Range)(char[] text, int start, int count, https://developer.android.com/reference/java/awt/font/NumericShaper.Range context) ` Converts the digits in the text that occur between `start` and `start + count`, using the provided `context`. |
| ` void` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#shape(char[],%20int,%20int,%20int)(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. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/awt/font/NumericShaper#toString()() ` Returns a `String` that describes this shaper. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### ALL_RANGES

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ALL_RANGES
```

Identifies all ranges, for full contextual shaping.

This constant specifies all of the bit mask-based ranges. Use `EmunSet.allOf(NumericShaper.Range.class)` to specify all of the enum-based ranges.

<br />

Constant Value: 524287 (0x0007ffff)

### ARABIC

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ARABIC
```

Identifies the ARABIC range and decimal base.

<br />

Constant Value: 2 (0x00000002)

### BENGALI

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BENGALI
```

Identifies the BENGALI range and decimal base.

<br />

Constant Value: 16 (0x00000010)

### DEVANAGARI

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DEVANAGARI
```

Identifies the DEVANAGARI range and decimal base.

<br />

Constant Value: 8 (0x00000008)

### EASTERN_ARABIC

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int EASTERN_ARABIC
```

Identifies the ARABIC range and ARABIC_EXTENDED decimal base.

<br />

Constant Value: 4 (0x00000004)

### ETHIOPIC

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ETHIOPIC
```

Identifies the ETHIOPIC range and decimal base.

<br />

Constant Value: 65536 (0x00010000)

### EUROPEAN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int EUROPEAN
```

Identifies the Latin-1 (European) and extended range, and Latin-1 (European) decimal base.

<br />

Constant Value: 1 (0x00000001)

### GUJARATI

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GUJARATI
```

Identifies the GUJARATI range and decimal base.

<br />

Constant Value: 64 (0x00000040)

### GURMUKHI

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GURMUKHI
```

Identifies the GURMUKHI range and decimal base.

<br />

Constant Value: 32 (0x00000020)

### KANNADA

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int KANNADA
```

Identifies the KANNADA range and decimal base.

<br />

Constant Value: 1024 (0x00000400)

### KHMER

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int KHMER
```

Identifies the KHMER range and decimal base.

<br />

Constant Value: 131072 (0x00020000)

### LAO

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int LAO
```

Identifies the LAO range and decimal base.

<br />

Constant Value: 8192 (0x00002000)

### MALAYALAM

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MALAYALAM
```

Identifies the MALAYALAM range and decimal base.

<br />

Constant Value: 2048 (0x00000800)

### MONGOLIAN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MONGOLIAN
```

Identifies the MONGOLIAN range and decimal base.

<br />

Constant Value: 262144 (0x00040000)

### MYANMAR

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MYANMAR
```

Identifies the MYANMAR range and decimal base.

<br />

Constant Value: 32768 (0x00008000)

### ORIYA

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ORIYA
```

Identifies the ORIYA range and decimal base.

<br />

Constant Value: 128 (0x00000080)

### TAMIL

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TAMIL
```

Identifies the TAMIL range and decimal base.

<br />

Constant Value: 256 (0x00000100)

### TELUGU

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TELUGU
```

Identifies the TELUGU range and decimal base.

<br />

Constant Value: 512 (0x00000200)

### THAI

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int THAI
```

Identifies the THAI range and decimal base.

<br />

Constant Value: 4096 (0x00001000)

### TIBETAN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TIBETAN
```

Identifies the TIBETAN range and decimal base.

<br />

Constant Value: 16384 (0x00004000)

## Public methods

### equals

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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. For example, the following code produces `"true"`.
>
> ```
> NumericShaper ns1 = NumericShaper.getShaper(NumericShaper.ARABIC);
> NumericShaper ns2 = NumericShaper.getShaper(NumericShaper.Range.ARABIC);
> System.out.println(ns1.equals(ns2));
> ```

<br />

<br />

| Parameters ||
|---|---|
| `o` | `Object`: the specified object to compare to this `NumericShaper` <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if `o` is an instance of `NumericShaper` and shapes in the same way; `false` otherwise. <br /> |

**See also:**

- `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)`

### getContextualShaper

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static NumericShaper getContextualShaper (Set<NumericShaper.Range> ranges)
```

Returns a contextual shaper for the provided Unicode range(s). The 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.

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.

<br />

| Parameters ||
|---|---|
| `ranges` | `Set`: the specified Unicode ranges <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/awt/font/NumericShaper` | a contextual shaper for the specified ranges <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `ranges` is `null`. |

### getContextualShaper

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `ranges` | `int`: the specified Unicode ranges <br /> |
| `defaultContext` | `int`: the starting context, such as `NumericShaper.EUROPEAN` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/awt/font/NumericShaper` | a shaper for the specified Unicode ranges. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the specified `defaultContext` is not a single valid range. |

### getContextualShaper

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `ranges` | `Set`: the specified Unicode ranges <br /> |
| `defaultContext` | `NumericShaper.Range`: the starting context, such as `NumericShaper.Range.EUROPEAN` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/awt/font/NumericShaper` | a contextual shaper for the specified Unicode ranges. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `ranges` or `defaultContext` is `null` |

### getContextualShaper

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `ranges` | `int`: the specified Unicode ranges <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/awt/font/NumericShaper` | a shaper for the specified ranges <br /> |

### getRangeSet

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Set<NumericShaper.Range> getRangeSet ()
```

Returns a `Set` representing all the Unicode ranges in this `NumericShaper` that will be shaped.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/awt/font/NumericShaper.Range>` | all the Unicode ranges to be shaped. <br /> |

### getRanges

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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) &#123; ... `

Note that this method supports only the bit mask-based ranges. Call `https://developer.android.com/reference/java/awt/font/NumericShaper#getRangeSet()` for the enum-based ranges.

<br />

| Returns ||
|---|---|
| `int` | the values for all the ranges to be shaped. <br /> |

### getShaper

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static NumericShaper getShaper (int singleRange)
```

Returns a shaper for the provided unicode range. All Latin-1 (EUROPEAN) digits are converted to the corresponding decimal unicode digits.

<br />

| Parameters ||
|---|---|
| `singleRange` | `int`: the specified Unicode range <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/awt/font/NumericShaper` | a non-contextual numeric shaper <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the range is not a single range |

### getShaper

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `singleRange` | `NumericShaper.Range`: the Unicode range given by a `https://developer.android.com/reference/java/awt/font/NumericShaper.Range` constant. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/awt/font/NumericShaper` | a non-contextual `NumericShaper`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `singleRange` is `null` |

### hashCode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Returns a hash code for this shaper.

<br />

| Returns ||
|---|---|
| `int` | this shaper's hash code. <br /> |

**See also:**

- `https://developer.android.com/reference/java/lang/Object#hashCode()`

### isContextual

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isContextual ()
```

Returns a `boolean` indicating whether or not this shaper shapes contextually.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if this shaper is contextual; `false` otherwise. <br /> |

### shape

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Converts the digits in the text that occur between start and start + count.

<br />

| Parameters ||
|---|---|
| `text` | `char`: an array of characters to convert <br /> |
| `start` | `int`: the index into `text` to start converting <br /> |
| `count` | `int`: the number of characters in `text` to convert <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IndexOutOfBoundsException` | if start or start + count is out of bounds |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if text is null |

### shape

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `text` | `char`: a `char` array <br /> |
| `start` | `int`: the index into `text` to start converting <br /> |
| `count` | `int`: the number of `char`s in `text` to convert <br /> |
| `context` | `NumericShaper.Range`: the context to which to convert the characters, such as `NumericShaper.Range.EUROPEAN` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IndexOutOfBoundsException` | if `start` or `start + count` is out of bounds |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `text` or `context` is null |

### shape

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `text` | `char`: an array of characters <br /> |
| `start` | `int`: the index into `text` to start converting <br /> |
| `count` | `int`: the number of characters in `text` to convert <br /> |
| `context` | `int`: the context to which to convert the characters, such as `NumericShaper.EUROPEAN` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if this is a contextual shaper and the specified `context` is not a single valid range. |
| `https://developer.android.com/reference/java/lang/IndexOutOfBoundsException` | if start or start + count is out of bounds |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if text is null |

### toString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a `String` that describes this shaper. This method is used for debugging purposes only.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a `String` describing this shaper. <br /> |