public final class Bidi extends Object
阿比迪对象提供对用于创建文本的双向排序信息。这是必需的,例如,要正确显示阿拉伯语或希伯来文本。这些语言本质上是混合的方向性,因为他们从左到右的顺序数字,而其他从右到左的文本排序。
一旦创建,比迪烟,对象可以查询是否表示的文本都是从左到右或右到左。这样的对象是非常轻量级的,这是比较容易处理的文本。
如果有多个文本,可以通过索引来访问运行的信息,以获得运行的开始、限制和级别。水平代表一个方向运行的方向和“嵌套级别”。奇数层是右到左,而偶数则是左到右。因此,例如0级代表左到右的文本,而1级代表右到左文本,2级代表左到右文本嵌入在一个右到左运行。
Modifier and Type | Field and Description |
---|---|
static int |
DIRECTION_DEFAULT_LEFT_TO_RIGHT
常数表明基地的方向取决于第一强方向性的文本根据Unicode双向算法。
|
static int |
DIRECTION_DEFAULT_RIGHT_TO_LEFT
常数表明基地的方向取决于第一强方向性的文本根据Unicode双向算法。
|
static int |
DIRECTION_LEFT_TO_RIGHT
指示基本方向是左到右。
|
static int |
DIRECTION_RIGHT_TO_LEFT
指示基本方向为右向左。
|
Constructor and Description |
---|
Bidi(AttributedCharacterIterator paragraph)
创建从给定的文本段落比迪烟。
|
Bidi(char[] text, int textStart, byte[] embeddings, int embStart, int paragraphLength, int flags)
创建从给定的文本,比迪烟的嵌入,和方向信息。
|
Bidi(String paragraph, int flags)
创建比迪烟从给定的文本段落和基本方向。
|
Modifier and Type | Method and Description |
---|---|
boolean |
baseIsLeftToRight()
如果基本方向是左到右,则返回真值。
|
Bidi |
createLineBidi(int lineStart, int lineLimit)
创建一个代表Bidi信息对文本行内的电流比迪代表段比迪对象。
|
int |
getBaseLevel()
返回基本层(如果左到右,1,如果右到左)。
|
int |
getLength()
返回行中的文本的长度。
|
int |
getLevelAt(int offset)
返回偏移的字符的解决级别。
|
int |
getRunCount()
返回运行级别的数量。
|
int |
getRunLevel(int run)
返回第n个逻辑运行在这条线的水平。
|
int |
getRunLimit(int run)
回到过去的字符在这条线N逻辑运行结束的指标,从线条开始偏移。
|
int |
getRunStart(int run)
在这条线的第n个逻辑运行开始返回的字符的索引,从线条开始偏移。
|
boolean |
isLeftToRight()
如果行的全部左到右文本和基本方向是左到右的返回值。
|
boolean |
isMixed()
如果行不左到右或右向左,则返回真值。
|
boolean |
isRightToLeft()
如果行右向左文本行返回,则基本方向是右向左的。
|
static void |
reorderVisually(byte[] levels, int levelStart, Object[] objects, int objectStart, int count)
在数组的视觉秩序基础上的等级排序的对象。
|
static boolean |
requiresBidi(char[] text, int start, int limit)
如果指定的文本需要比迪分析返回true。
|
String |
toString()
显示比迪烟的内部状态,用于调试。
|
public static final int DIRECTION_LEFT_TO_RIGHT
public static final int DIRECTION_RIGHT_TO_LEFT
public static final int DIRECTION_DEFAULT_LEFT_TO_RIGHT
public static final int DIRECTION_DEFAULT_RIGHT_TO_LEFT
public Bidi(String paragraph, int flags)
paragraph
-一段文字
flags
-一组控制算法的旗帜。该算法对旗direction_left_to_right,direction_right_to_left,direction_default_left_to_right,和direction_default_right_to_left。其他值保留。
public Bidi(AttributedCharacterIterator paragraph)
run_direction属性的文本中,如果存在,确定的基本方向(从左到右或从右到左)。如果不存在,基本方向是计算使用Unicode双向算法,默认为左到右如果文本中没有方向性强的特点。此属性,如果存在,必须应用到该段中的所有文本中。
bidi_embedding属性的文本中,如果存在的话,表示嵌入信息。负的值从1到62表示覆盖在水平的绝对值。积极的值从1到62表示嵌入。当值为零或未定义时,假定由基本方向确定的基本嵌入水平。
numeric_shaping属性的文本中,如果存在,将欧洲数字其他十进制数字运行前BIDI算法。此属性,如果存在,必须应用到该段中的所有文本中。
paragraph
-一段可选的字符和段落属性信息文本
TextAttribute.BIDI_EMBEDDING
,
TextAttribute.NUMERIC_SHAPING
,
TextAttribute.RUN_DIRECTION
public Bidi(char[] text, int textStart, byte[] embeddings, int embStart, int paragraphLength, int flags)
text
-一个数组包含文本段落的处理。
textStart
-索引到该段的开始文本数组。
embeddings
-数组段中含有嵌入值为每个字符。这可以是空的,在这种情况下,它被假定没有外部嵌入信息。
embStart
-索引到该段的开始嵌入阵列。
paragraphLength
-这段的长度在文本和嵌入阵列。
flags
-一组控制算法的旗帜。该算法对旗direction_left_to_right,direction_right_to_left,direction_default_left_to_right,和direction_default_right_to_left。其他值保留。
public Bidi createLineBidi(int lineStart, int lineLimit)
lineStart
-从段落的开始偏移到一行的开始。
lineLimit
-从段落开始的偏移线的限制。
Bidi
对象
public boolean isMixed()
public boolean isLeftToRight()
public boolean isRightToLeft()
public int getLength()
public boolean baseIsLeftToRight()
public int getBaseLevel()
public int getLevelAt(int offset)
offset
-的字符索引返回的水平
public int getRunCount()
public int getRunLevel(int run)
run
-运行指标,0和
getRunCount()
之间
public int getRunStart(int run)
run
-运行指标,0和
getRunCount()
之间
public int getRunLimit(int run)
run
-运行指标,0和
getRunCount()
之间
public static boolean requiresBidi(char[] text, int start, int limit)
text
含有字符测试文本
start
-字符范围测试开始
limit
-字符范围测试极限
public static void reorderVisually(byte[] levels, int levelStart, Object[] objects, int objectStart, int count)
index
从
objectStart
到
objectStart + count
在对象数组将被重新排序,为视觉秩序假设每个运行文本有水平的水平阵列的相应元素的显示(在
index - objectStart + levelStart
)。
levels
代表每个对象的比迪烟水平数组
levelStart
在水平数组的开始位置
objects
-对象被记录为视觉秩序的阵列
objectStart
在对象数组的开始位置
count
-物体的数量重新排序
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, 2014, Oracle and/or its affiliates. All rights reserved.