本文整理汇总了Java中sun.text.CodePointIterator.next方法的典型用法代码示例。如果您正苦于以下问题:Java CodePointIterator.next方法的具体用法?Java CodePointIterator.next怎么用?Java CodePointIterator.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.text.CodePointIterator
的用法示例。
在下文中一共展示了CodePointIterator.next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nextFontRunIndex
import sun.text.CodePointIterator; //导入方法依赖的package包/类
/**
* Determines the font index for the code point at the current position in the
* iterator, then advances the iterator to the first code point that has
* a different index or until the iterator is DONE, and returns the font index.
* @param iter a code point iterator, this will be advanced past any code
* points that have the same font index
* @return the font index for the initial code point found, or 1 if the iterator
* was empty.
*/
public int nextFontRunIndex(CodePointIterator iter) {
int cp = iter.next();
int fontIndex = 1;
if (cp != CodePointIterator.DONE) {
fontIndex = getFontIndex(cp);
while ((cp = iter.next()) != CodePointIterator.DONE) {
if (getFontIndex(cp) != fontIndex) {
iter.prev();
break;
}
}
}
return fontIndex;
}
示例2: requiresBidi
import sun.text.CodePointIterator; //导入方法依赖的package包/类
/**
* Return true if the specified text requires bidi analysis. If this returns false,
* the text will display left-to-right. Clients can then avoid constructing a Bidi object.
* Text in the Arabic Presentation Forms area of Unicode is presumed to already be shaped
* and ordered for display, and so will not cause this function to return true.
*
* @param text the text containing the characters to test
* @param start the start of the range of characters to test
* @param limit the limit of the range of characters to test
* @return true if the range of characters requires bidi analysis
*/
public static boolean requiresBidi(char[] text, int start, int limit) {
CodePointIterator cpi = CodePointIterator.create(text, start, limit);
for (int cp = cpi.next(); cp != CodePointIterator.DONE; cp = cpi.next()) {
if (cp > 0x0590) {
int dc = nativeGetDirectionCode(cp);
if ((RMASK & (1 << dc)) != 0) {
return true;
}
}
}
return false;
}