Examples of NumericShaper


Examples of java.awt.font.NumericShaper

     * illegal parameters.
     */
    public final void testShapeCharArrayIntIntInt_IllegalArguments() {
        // regression test for Harmony-1584
        int ranges = NumericShaper.ARABIC;
        NumericShaper localNumericShaper = NumericShaper
                .getContextualShaper(ranges);
        char[] chars = new char[] {};
        int start = 0;
        int count = 1;
        int index = NumericShaper.ARABIC;
        try {
            localNumericShaper.shape(chars, start, count, index);
            fail("len = 0: ArrayIndexOutOfBoundsException expected!");
        } catch (ArrayIndexOutOfBoundsException expectedException) {
            //expected
        }

        chars = new char[] {'a', 'b', 'c'};
        start = -1;
        count = 1;
        try {
            localNumericShaper.shape(chars, start, count, index);
            fail("start < 0: ArrayIndexOutOfBoundsException expected!");
        } catch (ArrayIndexOutOfBoundsException expectedException) {
            // expected
        }

        // count < 0: silent run expected
        start = 1;
        count = -1;
        localNumericShaper.shape(chars, start, count, index);

        start = 3;
        count = 5;
        try {
            localNumericShaper.shape(chars, start, count, index);
            fail("start + count > len: ArrayIndexOutOfBoundsException expected!");
        } catch (ArrayIndexOutOfBoundsException expectedException) {
            // expected
        }

View Full Code Here

Examples of java.awt.font.NumericShaper

            }
            ch = paragraph.next();
            ++i;
        }

        NumericShaper shaper = (NumericShaper) paragraph.getAttribute(TextAttribute.NUMERIC_SHAPING);
        if (shaper != null) {
            shaper.shape(txt, 0, len);
        }
        setPara(txt, paraLvl, lvls);
    }
View Full Code Here

Examples of java.awt.font.NumericShaper

      this.flags = DIRECTION_DEFAULT_LEFT_TO_RIGHT;

    // Likewise this attribute should be specified on the whole text.
    // We read it here and then, if it is set, we apply the numeric shaper
    // to the text before processing it.
    NumericShaper shaper = null;
    val = iter.getAttribute(TextAttribute.NUMERIC_SHAPING);
    if (val instanceof NumericShaper)
      shaper = (NumericShaper) val;

    this.text = new char[iter.getEndIndex() - iter.getBeginIndex()];
    this.embeddings = new byte[this.text.length];
    this.embeddingOffset = 0;
    this.length = text.length;
    for (int i = 0; i < this.text.length; ++i)
      {
        this.text[i] = iter.current();

        val = iter.getAttribute(TextAttribute.BIDI_EMBEDDING);
        if (val instanceof Integer)
          {
            int ival = ((Integer) val).intValue();
            byte bval;
            if (ival < -62 || ival > 62)
              bval = 0;
            else
              bval = (byte) ival;
            this.embeddings[i] = bval;
          }
      }

    // Invoke the numeric shaper, if specified.
    if (shaper != null)
      shaper.shape(this.text, 0, this.length);

    runBidi();
  }
View Full Code Here

Examples of java.awt.font.NumericShaper

      this.flags = DIRECTION_DEFAULT_LEFT_TO_RIGHT;

    // Likewise this attribute should be specified on the whole text.
    // We read it here and then, if it is set, we apply the numeric shaper
    // to the text before processing it.
    NumericShaper shaper = null;
    val = iter.getAttribute(TextAttribute.NUMERIC_SHAPING);
    if (val instanceof NumericShaper)
      shaper = (NumericShaper) val;

    char[] text = new char[iter.getEndIndex() - iter.getBeginIndex()];
    this.embeddings = new byte[this.text.length];
    this.embeddingOffset = 0;
    this.length = text.length;
    for (int i = 0; i < this.text.length; ++i)
      {
        this.text[i] = iter.current();

        val = iter.getAttribute(TextAttribute.BIDI_EMBEDDING);
        if (val instanceof Integer)
          {
            int ival = ((Integer) val).intValue();
            byte bval;
            if (ival < -62 || ival > 62)
              bval = 0;
            else
              bval = (byte) ival;
            this.embeddings[i] = bval;
          }
      }

    // Invoke the numeric shaper, if specified.
    if (shaper != null)
      shaper.shape(this.text, 0, this.length);

    runBidi();
  }
View Full Code Here

Examples of java.awt.font.NumericShaper

        }
        catch (ClassCastException e) {
        }

        try {
            NumericShaper shaper = (NumericShaper)paragraph.getAttribute(TextAttribute.NUMERIC_SHAPING);
            if (shaper != null) {
                shaper.shape(text, 0, text.length);
            }
        }
        catch (ClassCastException e) {
        }
View Full Code Here

Examples of java.awt.font.NumericShaper

      this.flags = DIRECTION_DEFAULT_LEFT_TO_RIGHT;

    // Likewise this attribute should be specified on the whole text.
    // We read it here and then, if it is set, we apply the numeric shaper
    // to the text before processing it.
    NumericShaper shaper = null;
    val = iter.getAttribute(TextAttribute.NUMERIC_SHAPING);
    if (val instanceof NumericShaper)
      shaper = (NumericShaper) val;

    text = new char[iter.getEndIndex() - iter.getBeginIndex()];
    this.embeddings = new byte[this.text.length];
    this.embeddingOffset = 0;
    this.length = text.length;
    for (int i = 0; i < this.text.length; ++i)
      {
        this.text[i] = iter.current();

        val = iter.getAttribute(TextAttribute.BIDI_EMBEDDING);
        if (val instanceof Integer)
          {
            int ival = ((Integer) val).intValue();
            byte bval;
            if (ival < -62 || ival > 62)
              bval = 0;
            else
              bval = (byte) ival;
            this.embeddings[i] = bval;
          }
      }

    // Invoke the numeric shaper, if specified.
    if (shaper != null)
      shaper.shape(this.text, 0, this.length);

    runBidi();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.