java.text.Bidi.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中java.text.Bidi.<init>()方法的一些代码示例,展示了Bidi.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bidi.<init>()方法的具体详情如下:
包路径:java.text.Bidi
类名称:Bidi
方法名:<init>

Bidi.<init>介绍

[英]Creates a Bidi object.
[中]创建一个Bidi对象。

代码示例

代码示例来源:origin: robovm/robovm

private Bidi createEmptyLineBidi(long parent) {
  // ICU4C doesn't allow this case, but the RI does.
  Bidi result = new Bidi(parent);
  result.length = 0;
  result.offsetLevel = null;
  result.runs = null;
  result.unidirectional = true;
  return result;
}

代码示例来源:origin: stackoverflow.com

@Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    Bidi bidi = new Bidi(userList.get(position).getName(), Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
    if(bidi.getBaseLevel() == 0)
      convertView = myInflater.inflate(R.layout.list_add_friends_row, null);
    else
      convertView = myInflater.inflate(R.layout.list_add_friends_row_mirror, null);

...

代码示例来源:origin: stackoverflow.com

Bidi bidi = new Bidi(userList.get(position).getName(), Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
if(bidi.baseIsLeftToRight())
        convertView = myInflater.inflate(R.layout.list_add_friends_row, null);
      else
        convertView = myInflater.inflate(R.layout.list_add_friends_row_mirror, null);

代码示例来源:origin: robovm/robovm

/**
 * Indicates whether a range of characters of a text requires a {@code Bidi}
 * object to display properly.
 *
 * @param text
 *            the char array of the text.
 * @param start
 *            the start offset of the range of characters.
 * @param limit
 *            the limit offset of the range of characters.
 * @return {@code true} if the range of characters requires a {@code Bidi}
 *         object; {@code false} otherwise.
 * @throws IllegalArgumentException
 *             if {@code start} or {@code limit} is negative; {@code start >
 *             limit} or {@code limit} is greater than the length of this
 *             object's paragraph text.
 */
public static boolean requiresBidi(char[] text, int start, int limit) {
  if (limit < 0 || start < 0 || start > limit || limit > text.length) {
    throw new IllegalArgumentException();
  }
  Bidi bidi = new Bidi(text, start, null, 0, limit - start, 0);
  return !bidi.isLeftToRight();
}

代码示例来源:origin: robovm/robovm

Bidi temp = new Bidi(text, textStart, null, 0, paragraphLength, flags);
realEmbeddings = new byte[paragraphLength];
System.arraycopy(temp.offsetLevel, 0, realEmbeddings, 0, paragraphLength);

代码示例来源:origin: robovm/robovm

return createEmptyLineBidi(parent);
  return new Bidi(ubidi_setLine(parent, lineStart, lineLimit));
} finally {
  ubidi_close(parent);

代码示例来源:origin: sjwall/MaterialTapTargetPrompt

final int layoutDirection = resources.getConfiguration().getLayoutDirection();
if (text != null && layoutDirection == View.LAYOUT_DIRECTION_RTL
    && new Bidi(text.toString(), Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT).isRightToLeft())

代码示例来源:origin: geotools/geotools

/** Gets the glyph vector for the main font */
public GlyphVector getTextGlyphVector(Graphics2D graphics) {
  // arabic and hebrew are scripted and right to left, they do require full layout
  // whilst western chars are easier to deal with. Find out which case we're dealing with,
  // and create the glyph vector with the appropriate call
  final char[] chars = label.toCharArray();
  final int length = label.length();
  if (Bidi.requiresBidi(chars, 0, length)
      && new Bidi(label, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT).isRightToLeft()) {
    textGlyphVector =
        getFont()
            .layoutGlyphVector(
                graphics.getFontRenderContext(),
                chars,
                0,
                length,
                Font.LAYOUT_RIGHT_TO_LEFT);
  } else {
    textGlyphVector = getFont().createGlyphVector(graphics.getFontRenderContext(), chars);
  }
  return textGlyphVector;
}

代码示例来源:origin: apache/pdfbox

Bidi bidi = new Bidi(word, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);

代码示例来源:origin: geotools/geotools

final int length = label.length();
if (Bidi.requiresBidi(chars, 0, length)) {
  Bidi bidi = new Bidi(label, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
  if (bidi.isRightToLeft()) {
    return font.layoutGlyphVector(

代码示例来源:origin: ibinti/bugvm

private Bidi createEmptyLineBidi(long parent) {
  // ICU4C doesn't allow this case, but the RI does.
  Bidi result = new Bidi(parent);
  result.length = 0;
  result.offsetLevel = null;
  result.runs = null;
  result.unidirectional = true;
  return result;
}

代码示例来源:origin: MobiVM/robovm

private Bidi createEmptyLineBidi(long parent) {
  // ICU4C doesn't allow this case, but the RI does.
  Bidi result = new Bidi(parent);
  result.length = 0;
  result.offsetLevel = null;
  result.runs = null;
  result.unidirectional = true;
  return result;
}

代码示例来源:origin: com.bugvm/bugvm-rt

private Bidi createEmptyLineBidi(long parent) {
  // ICU4C doesn't allow this case, but the RI does.
  Bidi result = new Bidi(parent);
  result.length = 0;
  result.offsetLevel = null;
  result.runs = null;
  result.unidirectional = true;
  return result;
}

代码示例来源:origin: FlexoVM/flexovm

private Bidi createEmptyLineBidi(long parent) {
  // ICU4C doesn't allow this case, but the RI does.
  Bidi result = new Bidi(parent);
  result.length = 0;
  result.offsetLevel = null;
  result.runs = null;
  result.unidirectional = true;
  return result;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

private Bidi createEmptyLineBidi(long parent) {
  // ICU4C doesn't allow this case, but the RI does.
  Bidi result = new Bidi(parent);
  result.length = 0;
  result.offsetLevel = null;
  result.runs = null;
  result.unidirectional = true;
  return result;
}

代码示例来源:origin: com.gluonhq/robovm-rt

private Bidi createEmptyLineBidi(long parent) {
  // ICU4C doesn't allow this case, but the RI does.
  Bidi result = new Bidi(parent);
  result.length = 0;
  result.offsetLevel = null;
  result.runs = null;
  result.unidirectional = true;
  return result;
}

代码示例来源:origin: stackoverflow.com

@Override
 public View getView(final int position, View convertView, ViewGroup parent) {
   ViewHolder holder;
   Bidi bidi = new Bidi(userList.get(position).getName(), Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
   if(bidi.getBaseLevel() == 0)
     convertView = myInflater.inflate(R.layout.list_add_friends_row, null);
   else
     convertView = myInflater.inflate(R.layout.list_add_friends_row_mirror, null);

代码示例来源:origin: stackoverflow.com

Bidi bidi = new Bidi(userList.get(position).getName(), Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
if(bidi.baseIsLeftToRight())
        convertView = myInflater.inflate(R.layout.list_add_friends_row, null);
      else
        convertView = myInflater.inflate(R.layout.list_add_friends_row_mirror, null);

代码示例来源:origin: org.apache.abdera/abdera-i18n

/**
   * Algorithm that defers to the Java Bidi implementation to determine text direction.
   */
  public static Direction guessDirectionFromJavaBidi(String text) {
    if (text != null) {
      AttributedString s = new AttributedString(text);
      java.text.Bidi bidi = new java.text.Bidi(s.getIterator());
      return bidi.baseIsLeftToRight() ? Direction.LTR : Direction.RTL;
    }
    return Direction.UNSPECIFIED;
  }
}

代码示例来源:origin: stackoverflow.com

String paragraph = "hey what's up ضعيف";
int NO_FLAG = 0;
Bidi bidi = new Bidi(paragraph, NO_FLAG);
int runCount = bidi.getRunCount();
for (int i = 0; i < runCount; i++) {
  String ltrtl = bidi.getRunLevel(i) % 2 == 0 ? "ltr" : "rtl";
  String subString = paragraph.substring(bidi.getRunStart(i), bidi.getRunLimit(i));
  Log.d(">>bidi:" + i,  subString+" is "+ltrtl);
}

相关文章