| |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.awt.font
类 NumericShaper
java.lang.Object java.awt.font.NumericShaper
- 所有已实现的接口:
- Serializable
public final class NumericShaper
- extends Object
- implements Serializable
NumericShaper
类用于将 Latin-1(欧洲语)数字转换成其他 Unicode 十进制数字。此类的用户主要是那些希望使用民族数字形状显示数据的人,但是发现使用 Latin-1(欧洲语)数字内部表示该数据更方便。此类不能解释过时的数字形状选择器字符 (U+206E)。
NumericShaper
的实例通常用作具有 TextAttribute
类的 NUMERIC_SHAPING
属性的文本属性。例如,以下代码片段可使 TextLayout
将欧洲数字转换成阿拉伯语上下文中的阿拉伯数字:
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);
它还可能使用
NumericShaper
的实例显式执行数字成形,如以下代码片断所演示的: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 preceeding text is Arabic, or // shape European digits to TAMIL digits if preceeding text is Tamil, or // leave European digits alone if there is no preceeding text, or // preceeding text is neither Arabic nor Tamil NumericShaper shaper = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.TAMIL, NumericShaper.EUROPEAN); shaper.shape(text. start, count);
- 从以下版本开始:
- 1.4
- 另请参见:
- 序列化表格
字段摘要 | |
---|---|
static int | ALL_RANGES 识别所有的范围,用于完整的上下文成形。 |
static int | ARABIC 识别 ARABIC 范围和十进制基数。 |
static int | BENGALI 识别 BENGALI 范围和十进制基数。 |
static int | DEVANAGARI 识别 DEVANAGARI 范围和十进制基数。 |
static int | EASTERN_ARABIC 识别 ARABIC 范围和 ARABIC_EXTENDED 十进制基数。 |
static int | ETHIOPIC 识别 ETHIOPIC 范围和十进制基数。 |
static int | EUROPEAN 识别 Latin-1(欧洲语)和扩展范围,以及 Latin-1(欧洲语)十进制基数。 |
static int | GUJARATI 识别 GUJARATI 范围和十进制基数。 |
static int | GURMUKHI 识别 GURMUKHI 范围和十进制基数。 |
static int | KANNADA 识别 KANNADA 范围和十进制基数。 |
static int | KHMER 识别 KHMER 范围和十进制基数。 |
static int | LAO 识别 LAO 范围和十进制基数。 |
static int | MALAYALAM 识别 MALAYALAM 范围和十进制基数。 |
static int | MONGOLIAN 识别 MONGOLIAN 范围和十进制基数。 |
static int | MYANMAR 识别 MYANMAR 范围和十进制基数。 |
static int | ORIYA 识别 ORIYA 范围和十进制基数。 |
static int | TAMIL 识别 TAMIL 范围和十进制基数。 |
static int | TELUGU 识别 TELUGU 范围和十进制基数。 |
static int | THAI 识别 THAI 范围和十进制基数。 |
static int | TIBETAN 识别 TIBETAN 范围和十进制基数。 |
方法摘要 | |
---|---|
boolean | equals(Object o) 如果指定的对象是 NumericShaper 的一个实例,并且完全一致地成形到此实例,则返回 true。 |
static NumericShaper | getContextualShaper(int ranges) 返回所提供的 unicode 范围的上下文成形器。 |
static NumericShaper | getContextualShaper(int ranges, int defaultContext) 返回所提供 unicode 范围的上下文成形器。 |
int | getRanges() 返回一个 int ,它使用或连接 (OR) 所有将成形的范围的值。 |
static NumericShaper | getShaper(int singleRange) 返回所提供的 unicode 范围的成形器。 |
int | hashCode() 返回此成形器的哈希码。 |
boolean | isContextual() 返回一个 boolean 值,指示此成形器是否以上下文方式成形。 |
void | shape(char[] text, int start, int count) 转换文本中在 start 和 start + 计数之间出现的数字。 |
void | shape(char[] text, int start, int count, int context) 使用提供的上下文,转换文本中在 start 和 start + 计数之间出现的数字。 |
String | toString() 返回描述此成形器的 String 。 |
从类 java.lang.Object 继承的方法 |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
字段详细信息 |
---|
EUROPEAN
public static final int EUROPEAN
- 识别 Latin-1(欧洲语)和扩展范围,以及 Latin-1(欧洲语)十进制基数。
- 另请参见:
- 常量字段值
ARABIC
public static final int ARABIC
- 识别 ARABIC 范围和十进制基数。
- 另请参见:
- 常量字段值
EASTERN_ARABIC
public static final int EASTERN_ARABIC
- 识别 ARABIC 范围和 ARABIC_EXTENDED 十进制基数。
- 另请参见:
- 常量字段值
DEVANAGARI
public static final int DEVANAGARI
- 识别 DEVANAGARI 范围和十进制基数。
- 另请参见:
- 常量字段值
BENGALI
public static final int BENGALI
- 识别 BENGALI 范围和十进制基数。
- 另请参见:
- 常量字段值
GURMUKHI
public static final int GURMUKHI
- 识别 GURMUKHI 范围和十进制基数。
- 另请参见:
- 常量字段值
GUJARATI
public static final int GUJARATI
- 识别 GUJARATI 范围和十进制基数。
- 另请参见:
- 常量字段值