Java Code Examples for java.text.Bidi#requiresBidi()

The following examples show how to use java.text.Bidi#requiresBidi() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextMeasureTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init(TestEnvironment env, Result results) {
    super.init(env, results);

    int flags = Font.LAYOUT_LEFT_TO_RIGHT;
    if (Bidi.requiresBidi(chars, 0, chars.length)) { // assume rtl
        flags = Font.LAYOUT_RIGHT_TO_LEFT;
    }
    gv = font.layoutGlyphVector(frc, chars, 0, chars.length, flags);

    // gv options
}
 
Example 2
Source File: TextMeasureTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TestEnvironment env, Result results) {
    super.init(env, results);

    int flags = Font.LAYOUT_LEFT_TO_RIGHT;
    if (Bidi.requiresBidi(chars, 0, chars.length)) { // assume rtl
        flags = Font.LAYOUT_RIGHT_TO_LEFT;
    }
    gv = font.layoutGlyphVector(frc, chars, 0, chars.length, flags);

    // gv options
}
 
Example 3
Source File: TextConstructionTests.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void init(TestEnvironment env, Result results) {
    super.init(env, results);

    chars1 = new char[chars.length + 2];
    System.arraycopy(chars, 0, chars1, 1, chars.length);
    ci = new ArrayCI(chars1, 1, chars.length);
    gv = font.createGlyphVector(frc, text);
    glyphs = gv.getGlyphCodes(0, gv.getNumGlyphs(), null);
    flags = Bidi.requiresBidi(chars, 0, chars.length)
        ? Font.LAYOUT_LEFT_TO_RIGHT
        : Font.LAYOUT_RIGHT_TO_LEFT;
}
 
Example 4
Source File: TextMeasureTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init(TestEnvironment env, Result results) {
    super.init(env, results);

    int flags = Font.LAYOUT_LEFT_TO_RIGHT;
    if (Bidi.requiresBidi(chars, 0, chars.length)) { // assume rtl
        flags = Font.LAYOUT_RIGHT_TO_LEFT;
    }
    gv = font.layoutGlyphVector(frc, chars, 0, chars.length, flags);

    // gv options
}
 
Example 5
Source File: TextMeasureTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TestEnvironment env, Result results) {
    super.init(env, results);

    int flags = Font.LAYOUT_LEFT_TO_RIGHT;
    if (Bidi.requiresBidi(chars, 0, chars.length)) { // assume rtl
        flags = Font.LAYOUT_RIGHT_TO_LEFT;
    }
    gv = font.layoutGlyphVector(frc, chars, 0, chars.length, flags);

    // gv options
}
 
Example 6
Source File: TextMeasureTests.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TestEnvironment env, Result results) {
    super.init(env, results);

    int flags = Font.LAYOUT_LEFT_TO_RIGHT;
    if (Bidi.requiresBidi(chars, 0, chars.length)) { // assume rtl
        flags = Font.LAYOUT_RIGHT_TO_LEFT;
    }
    gv = font.layoutGlyphVector(frc, chars, 0, chars.length, flags);

    // gv options
}
 
Example 7
Source File: SimpleTextLineWrapper.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected boolean isLeftToRight(char[] chars)
{
	boolean leftToRight = true;
	if (Bidi.requiresBidi(chars, 0, chars.length))
	{
		// determining the text direction
		// using default LTR as there's no way to have other default in the text
		Bidi bidi = new Bidi(chars, 0, null, 0, chars.length, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
		leftToRight = bidi.baseIsLeftToRight();
	}
	return leftToRight;
}
 
Example 8
Source File: LineLayout.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void addRuns(List<BidiRun> runs, char[] text, int start, int end, int flags) {
  if (start < end && !Bidi.requiresBidi(text, start, end)) {
    addOrMergeRun(runs, new BidiRun((byte)0, start, end));
    return;
  }
  int afterLastTabPosition = start;
  for (int i = start; i < end; i++) {
    if (text[i] == '\t') {
      addRunsNoTabs(runs, text, afterLastTabPosition, i, flags);
      afterLastTabPosition = i + 1;
      addOrMergeRun(runs, new BidiRun((byte)0, i, i + 1));
    }
  }
  addRunsNoTabs(runs, text, afterLastTabPosition, end, flags);
}
 
Example 9
Source File: TextMeasureTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TestEnvironment env, Result results) {
    super.init(env, results);

    int flags = Font.LAYOUT_LEFT_TO_RIGHT;
    if (Bidi.requiresBidi(chars, 0, chars.length)) { // assume rtl
        flags = Font.LAYOUT_RIGHT_TO_LEFT;
    }
    gv = font.layoutGlyphVector(frc, chars, 0, chars.length, flags);

    // gv options
}
 
Example 10
Source File: TextMeasureTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void init(TestEnvironment env, Result results) {
    super.init(env, results);

    int flags = Font.LAYOUT_LEFT_TO_RIGHT;
    if (Bidi.requiresBidi(chars, 0, chars.length)) { // assume rtl
        flags = Font.LAYOUT_RIGHT_TO_LEFT;
    }
    gv = font.layoutGlyphVector(frc, chars, 0, chars.length, flags);

    // gv options
}
 
Example 11
Source File: TextConstructionTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void init(TestEnvironment env, Result results) {
    super.init(env, results);

    chars1 = new char[chars.length + 2];
    System.arraycopy(chars, 0, chars1, 1, chars.length);
    ci = new ArrayCI(chars1, 1, chars.length);
    gv = font.createGlyphVector(frc, text);
    glyphs = gv.getGlyphCodes(0, gv.getNumGlyphs(), null);
    flags = Bidi.requiresBidi(chars, 0, chars.length)
        ? Font.LAYOUT_LEFT_TO_RIGHT
        : Font.LAYOUT_RIGHT_TO_LEFT;
}
 
Example 12
Source File: BidiSurrogateTest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
void testRequiresBidi(String string, boolean requiresBidi) {
    char[] text = string.toCharArray();
    if (Bidi.requiresBidi(text, 0, text.length) != requiresBidi) {
        throw new RuntimeException("testRequiresBidi failed with '" + string + "', " + requiresBidi);
    }
}
 
Example 13
Source File: BidiSurrogateTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void testRequiresBidi(String string, boolean requiresBidi) {
    char[] text = string.toCharArray();
    if (Bidi.requiresBidi(text, 0, text.length) != requiresBidi) {
        throw new RuntimeException("testRequiresBidi failed with '" + string + "', " + requiresBidi);
    }
}
 
Example 14
Source File: BidiSurrogateTest.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
void testRequiresBidi(String string, boolean requiresBidi) {
    char[] text = string.toCharArray();
    if (Bidi.requiresBidi(text, 0, text.length) != requiresBidi) {
        throw new RuntimeException("testRequiresBidi failed with '" + string + "', " + requiresBidi);
    }
}
 
Example 15
Source File: BidiSurrogateTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
void testRequiresBidi(String string, boolean requiresBidi) {
    char[] text = string.toCharArray();
    if (Bidi.requiresBidi(text, 0, text.length) != requiresBidi) {
        throw new RuntimeException("testRequiresBidi failed with '" + string + "', " + requiresBidi);
    }
}
 
Example 16
Source File: BidiSurrogateTest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
void testRequiresBidi(String string, boolean requiresBidi) {
    char[] text = string.toCharArray();
    if (Bidi.requiresBidi(text, 0, text.length) != requiresBidi) {
        throw new RuntimeException("testRequiresBidi failed with '" + string + "', " + requiresBidi);
    }
}
 
Example 17
Source File: BidiSurrogateTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
void testRequiresBidi(String string, boolean requiresBidi) {
    char[] text = string.toCharArray();
    if (Bidi.requiresBidi(text, 0, text.length) != requiresBidi) {
        throw new RuntimeException("testRequiresBidi failed with '" + string + "', " + requiresBidi);
    }
}
 
Example 18
Source File: BidiSurrogateTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
void testRequiresBidi(String string, boolean requiresBidi) {
    char[] text = string.toCharArray();
    if (Bidi.requiresBidi(text, 0, text.length) != requiresBidi) {
        throw new RuntimeException("testRequiresBidi failed with '" + string + "', " + requiresBidi);
    }
}
 
Example 19
Source File: BidiSurrogateTest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
void testRequiresBidi(String string, boolean requiresBidi) {
    char[] text = string.toCharArray();
    if (Bidi.requiresBidi(text, 0, text.length) != requiresBidi) {
        throw new RuntimeException("testRequiresBidi failed with '" + string + "', " + requiresBidi);
    }
}
 
Example 20
Source File: BidiSurrogateTest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
void testRequiresBidi(String string, boolean requiresBidi) {
    char[] text = string.toCharArray();
    if (Bidi.requiresBidi(text, 0, text.length) != requiresBidi) {
        throw new RuntimeException("testRequiresBidi failed with '" + string + "', " + requiresBidi);
    }
}