Package java.text

Examples of java.text.Bidi


                                  text.offset + text.count)) {

            return false;
        }

        final Bidi bidi = new Bidi(text.array, text.offset, null, 0, text.count,
                                   getDefaultDirection(offset));

        if (hasBidiInfo && !bidi.isMixed()
            && isLeftToRight(offset) == bidi.isLeftToRight()) {

            return false;
        }

        if (!hasBidiInfo) {
View Full Code Here


  /**
   * Apply Unicode Bidirectional Algorithm to string and return a new possibly reordered string for visual rendering.
   */
  private String bidiReorder(String par1Str) {
    if (par1Str != null && Bidi.requiresBidi(par1Str.toCharArray(), 0, par1Str.length())) {
      Bidi var2 = new Bidi(par1Str, -2);
      byte[] var3 = new byte[var2.getRunCount()];
      String[] var4 = new String[var3.length];
      int var7;

      for (int var5 = 0; var5 < var3.length; ++var5) {
        int var6 = var2.getRunStart(var5);
        var7 = var2.getRunLimit(var5);
        int var8 = var2.getRunLevel(var5);
        String var9 = par1Str.substring(var6, var7);
        var3[var5] = (byte)var8;
        var4[var5] = var9;
      }

View Full Code Here

        try {
            content.getChars(parStart, parLen, text);
        } catch (final BadLocationException e) { }

        Bidi bidi = new Bidi(text.array, text.offset, null, 0, text.count,
                             getDefaultDirection(par));

        final int runCount = bidi.getRunCount();
        for (int i = 0; i < runCount; i++) {
            int level = bidi.getRunLevel(i);

            if (i == 0 && added.size() > 0) {
                Element prevBidi = added.get(added.size() - 1);
                if (getBidiLevel(prevBidi) == level) {
                    added.remove(added.size() - 1);
                    added.add(new BidiElement(prevBidi.getAttributes(),
                                              prevBidi.getStartOffset(),
                                              parStart + bidi.getRunLimit(i)));
                    continue;
                }
            }

            added.add(
                new BidiElement(context.addAttribute(context.getEmptySet(),
                                                     StyleConstants.BidiLevel,
                                                     new Integer(level)),
                                parStart + bidi.getRunStart(i),
                                parStart + bidi.getRunLimit(i)));
        }

    }
View Full Code Here

                                  text.offset + text.count)) {

            return false;
        }

        final Bidi bidi = new Bidi(text.array, text.offset, null, 0, text.count,
                                   getDefaultDirection(offset));

        if (hasBidiInfo && !bidi.isMixed()
            && isLeftToRight(offset) == bidi.isLeftToRight()) {

            return false;
        }

        if (!hasBidiInfo) {
View Full Code Here

        try {
            content.getChars(parStart, parLen, text);
        } catch (final BadLocationException e) { }

        Bidi bidi = new Bidi(text.array, text.offset, null, 0, text.count,
                             getDefaultDirection(par));

        final int runCount = bidi.getRunCount();
        for (int i = 0; i < runCount; i++) {
            int level = bidi.getRunLevel(i);

            if (i == 0 && added.size() > 0) {
                Element prevBidi = added.get(added.size() - 1);
                if (getBidiLevel(prevBidi) == level) {
                    added.remove(added.size() - 1);
                    added.add(new BidiElement(prevBidi.getAttributes(),
                                              prevBidi.getStartOffset(),
                                              parStart + bidi.getRunLimit(i)));
                    continue;
                }
            }

            added.add(
                new BidiElement(context.addAttribute(context.getEmptySet(),
                                                     StyleConstants.BidiLevel,
                                                     new Integer(level)),
                                parStart + bidi.getRunStart(i),
                                parStart + bidi.getRunLimit(i)));
        }

    }
View Full Code Here

                                  text.offset + text.count)) {

            return false;
        }

        final Bidi bidi = new Bidi(text.array, text.offset, null, 0, text.count,
                                   getDefaultDirection(offset));

        if (hasBidiInfo && !bidi.isMixed()
            && isLeftToRight(offset) == bidi.isLeftToRight()) {

            return false;
        }

        if (!hasBidiInfo) {
View Full Code Here

     */
    private String bidiReorder(String par1Str)
    {
        if (par1Str != null && Bidi.requiresBidi(par1Str.toCharArray(), 0, par1Str.length()))
        {
            Bidi bidi = new Bidi(par1Str, -2);
            byte[] abyte = new byte[bidi.getRunCount()];
            String[] astring = new String[abyte.length];
            int i;

            for (int j = 0; j < abyte.length; ++j)
            {
                int k = bidi.getRunStart(j);
                i = bidi.getRunLimit(j);
                int l = bidi.getRunLevel(j);
                String s1 = par1Str.substring(k, i);
                abyte[j] = (byte) l;
                astring[j] = s1;
            }

View Full Code Here

    Direction dir = Direction.UNSPECIFIED;
    if (!ignoredir && hasDirection(element)) return getDirection(element);
    String text = element.getText();
    if (text != null) {
      AttributedString s = new AttributedString(text);
      Bidi bidi = new Bidi(s.getIterator());
      dir = (bidi.baseIsLeftToRight()) ? Direction.LTR : Direction.RTL;
    }
    return dir;
  }
View Full Code Here

      labelSize = 0;

      if (bidiRequired)
      {
        Bidi bidi = new Bidi(label,
            Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);

        int runCount = bidi.getRunCount();

        if (rtlGlyphVectors == null
            || rtlGlyphVectors.length != runCount)
        {
          rtlGlyphVectors = new GlyphVector[runCount];
        }

        for (int i = 0; i < bidi.getRunCount(); i++)
        {
          final String labelSection = label.substring(
              bidi.getRunStart(i), bidi.getRunLimit(i));
          rtlGlyphVectors[i] = font
              .layoutGlyphVector(mxCurveLabelShape.frc,
                  labelSection.toCharArray(), 0,
                  labelSection.length(),
                  Font.LAYOUT_RIGHT_TO_LEFT);
View Full Code Here

        if (par1Str == null || !Bidi.requiresBidi(par1Str.toCharArray(), 0, par1Str.length()))
        {
            return par1Str;
        }

        Bidi bidi = new Bidi(par1Str, -2);
        byte abyte0[] = new byte[bidi.getRunCount()];
        String as[] = new String[abyte0.length];

        for (int i = 0; i < abyte0.length; i++)
        {
            int j = bidi.getRunStart(i);
            int k = bidi.getRunLimit(i);
            int i1 = bidi.getRunLevel(i);
            String s = par1Str.substring(j, k);
            abyte0[i] = (byte)i1;
            as[i] = s;
        }
View Full Code Here

TOP

Related Classes of java.text.Bidi

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.