当前位置: 首页>>代码示例>>Java>>正文


Java UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC属性代码示例

本文整理汇总了Java中com.ibm.icu.lang.UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC属性的典型用法代码示例。如果您正苦于以下问题:Java UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC属性的具体用法?Java UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC怎么用?Java UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.ibm.icu.lang.UCharacter的用法示例。


在下文中一共展示了UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: requiresBidi

/**
 * 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 method 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
 *
 * @stable ICU 3.8
 */
public static boolean requiresBidi(char[] text,
        int start,
        int limit)
{
    final int RTLMask = (1 << UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT |
            1 << UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC |
            1 << UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING |
            1 << UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE |
            1 << UCharacter.DIRECTIONALITY_ARABIC_NUMBER);

    for (int i = start; i < limit; ++i) {
        if (((1 << UCharacter.getDirection(text[i])) & RTLMask) != 0) {
            return true;
        }
    }
    return false;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:32,代码来源:Bidi.java

示例2: isRtl

/**
 * @param ch
 * @return
 */
private boolean isRtl( char ch )
{
	byte direction = UCharacter.getDirectionality( ch );
	return UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT == direction
			|| UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC == direction;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:10,代码来源:BidiEngine.java

示例3: getExitDir

/**
 * Returns the directionality of the last character with strong directionality in the string, or
 * Dir.NEUTRAL if none was encountered. For efficiency, actually scans backwards from the end of
 * the string. Treats a non-BN character between an LRE/RLE/LRO/RLO and its matching PDF as a
 * strong character, LTR after LRE/LRO, and RTL after RLE/RLO. The results are undefined for a
 * string containing unbalanced LRE/RLE/LRO/RLO/PDF characters.
 */
Dir getExitDir() {
  // The reason for this method name, as opposed to getLastStrongDir(), is that "last strong"
  // sounds like the exact opposite of "first strong", which is a commonly used description of
  // Unicode's estimation algorithm (getUnicodeDir() above), but the two must treat formatting
  // characters quite differently. Thus, we are staying away from both "first" and "last" in
  // these method names to avoid confusion.
  charIndex = length;
  int embeddingLevel = 0;
  int lastNonEmptyEmbeddingLevel = 0;
  while (charIndex > 0) {
    switch (dirTypeBackward()) {
      case UCharacter.DIRECTIONALITY_LEFT_TO_RIGHT:
        if (embeddingLevel == 0) {
          return Dir.LTR;
        }
        if (lastNonEmptyEmbeddingLevel == 0) {
          lastNonEmptyEmbeddingLevel = embeddingLevel;
        }
        break;
      case UCharacter.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:
      case UCharacter.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:
        if (lastNonEmptyEmbeddingLevel == embeddingLevel) {
          return Dir.LTR;
        }
        --embeddingLevel;
        break;
      case UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT:
      case UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
        if (embeddingLevel == 0) {
          return Dir.RTL;
        }
        if (lastNonEmptyEmbeddingLevel == 0) {
          lastNonEmptyEmbeddingLevel = embeddingLevel;
        }
        break;
      case UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:
      case UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:
        if (lastNonEmptyEmbeddingLevel == embeddingLevel) {
          return Dir.RTL;
        }
        --embeddingLevel;
        break;
      case UCharacter.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT:
        ++embeddingLevel;
        break;
      case UCharacter.BOUNDARY_NEUTRAL:
        break;
      default:
        if (lastNonEmptyEmbeddingLevel == 0) {
          lastNonEmptyEmbeddingLevel = embeddingLevel;
        }
        break;
    }
  }
  return Dir.NEUTRAL;
}
 
开发者ID:google,项目名称:closure-templates,代码行数:63,代码来源:BidiUtils.java


注:本文中的com.ibm.icu.lang.UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。