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

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

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

Bidi.isRightToLeft介绍

[英]Indicates whether the text is from right to left, that is, both the base direction and the text direction is from right to left.
[中]指示文本是否从右向左,即基本方向和文本方向都是从右向左。

代码示例

代码示例来源: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: geotools/geotools

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

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.ibm.icu.base

/**
 * Return true if the line is all right-to-left text, and the base direction
 * is right-to-left
 *
 * @return true if the line is all right-to-left text, and the base
 *         direction is right-to-left
 *
 * @throws IllegalStateException if this call is not preceded by a successful
 *         call to <code>setPara</code>
 * @stable ICU 3.8
 */
public boolean isRightToLeft()
{
  return bidi.isRightToLeft();
}

代码示例来源:origin: at.bestsolution.eclipse/com.ibm.icu.base

/**
 * Return true if the line is all right-to-left text, and the base direction
 * is right-to-left
 *
 * @return true if the line is all right-to-left text, and the base
 *         direction is right-to-left
 *
 * @throws IllegalStateException if this call is not preceded by a successful
 *         call to <code>setPara</code>
 * @stable ICU 3.8
 */
public boolean isRightToLeft()
{
  return bidi.isRightToLeft();
}

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

private void setRtl(){
  String languageToLoad  = "ar"; // rtl language Arabic
  Locale locale = new Locale(languageToLoad);  
  Locale.setDefault(locale); 

  Configuration config = new Configuration(); 
  config.locale = locale; 
  getBaseContext().getResources().updateConfiguration(config,  
      getBaseContext().getResources().getDisplayMetrics());
      //layout direction 
  Bidi b = new Bidi(languageToLoad,Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT);
      b.isRightToLeft();
  //save current locale in SharedPreferences
  SharedPreferences languagepref = getSharedPreferences("language",MODE_PRIVATE);
  SharedPreferences.Editor editor = languagepref.edit();
  editor.putString("languageToLoad",languageToLoad );
  editor.commit(); 

  startActivity(...);// refresh activity.
}

代码示例来源:origin: org.geotools/gt-render

/**
 * recompute each time
 */
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 = font.layoutGlyphVector(graphics.getFontRenderContext(), chars, 
        0, length, Font.LAYOUT_RIGHT_TO_LEFT);
  else
    textGlyphVector = font.createGlyphVector(graphics.getFontRenderContext(), chars);
  return textGlyphVector;
}

代码示例来源:origin: org.geotools/gt2-render

/**
 * recompute each time
 */
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 = font.layoutGlyphVector(graphics.getFontRenderContext(), chars, 
        0, length, Font.LAYOUT_RIGHT_TO_LEFT);
  else
    textGlyphVector = font.createGlyphVector(graphics.getFontRenderContext(), chars);
  return textGlyphVector;
}

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

Bidi bidi = new Bidi(app_locale,
 Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT);
bidi.isRightToLeft();
YourGlobalClass.updateLanguage(getActivity(), "ar");

代码示例来源:origin: org.geotools/gt-render

if (Bidi.requiresBidi(chars, 0, length)) {
  Bidi bidi = new Bidi(label, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
  if (bidi.isRightToLeft()) {
    return font.layoutGlyphVector(graphics.getFontRenderContext(), chars, 0, length,
        Font.LAYOUT_RIGHT_TO_LEFT);

代码示例来源:origin: google/sagetv

if (booty.isRightToLeft())

相关文章