Package java.awt.font

Examples of java.awt.font.NumericShaper


        // normalize to current baseline
        baselineOffsets = TextLine.getNormalizedOffsets(lm.baselineOffsets, baseline);
       
        justifyRatio = AttributeValues.getJustification(paragraphAttrs);
        NumericShaper shaper = AttributeValues.getNumericShaping(paragraphAttrs);
        if (shaper != null) {
            shaper.shape(text, 0, text.length);
        }
    }
View Full Code Here


        }
        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

  }

  public void test(TestHarness harness)
  {
    harness.checkPoint("non-contextual");
    NumericShaper nonc = NumericShaper.getShaper(NumericShaper.TIBETAN);
    harness.check(! nonc.isContextual());
    testOne(harness, "abc 0123", nonc,
        "abc \u0f20\u0f21\u0f22\u0f23", -1);
    testOne(harness, "abc 0123", nonc,
        "abc \u0f20\u0f21\u0f22\u0f23", NumericShaper.BENGALI);
   
    // Note that the JDK fails some of these, as ethiopic does not
    // have a digit zero.
    nonc = NumericShaper.getShaper(NumericShaper.ETHIOPIC);
    testOne(harness, "abc 0123", nonc,
        "abc 0\u1369\u136a\u136b", -1);
    testOne(harness, "abc 0123", nonc,
        "abc 0\u1369\u136a\u136b", NumericShaper.EASTERN_ARABIC);
   
    harness.checkPoint("contextual");
    NumericShaper contextualI
      = NumericShaper.getContextualShaper(NumericShaper.KHMER
                          | NumericShaper.ETHIOPIC);
    NumericShaper contextualE
      = NumericShaper.getContextualShaper(NumericShaper.KHMER
                          | NumericShaper.ETHIOPIC,
                          NumericShaper.EUROPEAN);
    harness.check(contextualE.equals(contextualI));
    harness.check(contextualE.isContextual());

    // Use built-in context.
    testOne(harness, "45", contextualE, "45", -1);
    // Explicit context.
    testOne(harness, "45", contextualE, "\u17e4\u17e5", NumericShaper.KHMER);
    // Explicit but unrecognized context.
    testOne(harness, "45", contextualE, "45", NumericShaper.ARABIC);
    // The other explicit context.
    testOne(harness, "45", contextualE, "\u136c\u136d", NumericShaper.ETHIOPIC);
    // Context from the text.  The first \\u is ethiopic, the second khmer.
    testOne(harness, "45 \u134d 045 \u1782 045", contextualI,
        "45 \u134d 0\u136c\u136d \u1782 \u17e0\u17e4\u17e5", -1);

    harness.checkPoint("arabic");
    NumericShaper arabic
      = NumericShaper.getContextualShaper(NumericShaper.ARABIC
          | NumericShaper.EASTERN_ARABIC);
    // According to testing, eastern arabic takes precedence here.
    testOne(harness, "\u062b 1", arabic, "\u062b \u06f1", -1);
    // This should choose eastern arabic.
View Full Code Here

        // normalize to current baseline
        baselineOffsets = TextLine.getNormalizedOffsets(lm.baselineOffsets, baseline);

        justifyRatio = AttributeValues.getJustification(paragraphAttrs);
        NumericShaper shaper = AttributeValues.getNumericShaping(paragraphAttrs);
        if (shaper != null) {
            shaper.shape(text, 0, text.length);
        }
    }
View Full Code Here

            ++i;
        }

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

            }
            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

    /*
     * Test method for 'java.awt.font.NumericShaper.equals(Object)'
     */
    public final void testEqualsObject() {
        NumericShaper ns;
        NumericShaper ns1;

        // Simple shapers are equal
        ns = NumericShaper.getShaper(NumericShaper.BENGALI);
        assertTrue("NonContextual object isn't equal to itself", ns.equals(ns));

View Full Code Here

    /*
     * Test method for 'java.awt.font.NumericShaper.getContextualShaper(int, int)'
     */
    public final void testGetContextualShaperIntInt() {
        NumericShaper ns;
        ns = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.TAMIL, NumericShaper.EASTERN_ARABIC);
        assertNotNull(ns);
       
        assertEquals("Ranges are different", NumericShaper.ARABIC | NumericShaper.TAMIL, ns.getRanges());
        assertTrue("Contextual shaper isContextual() method must return true value", ns.isContextual());

        try{
            // wrong ranges value
            ns = NumericShaper.getShaper(13);
            fail("IlligalArgumentException wasn't thrown with invalid shaper value");
View Full Code Here

    /*
     * Test method for 'java.awt.font.NumericShaper.getContextualShaper(int)'
     */
    public final void testGetContextualShaperInt() {
        NumericShaper ns;
        ns = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.TAMIL);
        assertNotNull(ns);
       
        assertEquals("Ranges are not the same", NumericShaper.ARABIC | NumericShaper.TAMIL, ns.getRanges());
        assertTrue("Default contextual shaper isContextual() method must return true value", ns.isContextual());
       
        try{
            // wrong ranges value
            ns = NumericShaper.getShaper(13);
            fail("IlligalArgumentException wasn't thrown with invalid shaper value");
View Full Code Here

    /*
     * Test method for 'java.awt.font.NumericShaper.getRanges()'
     */
    public final void testGetRanges() {
        NumericShaper ns;
        int ranges;
        ns = NumericShaper.getShaper(NumericShaper.ARABIC);
        ranges = ns.getRanges();
        assertEquals("Simple shaper ranges have differences", NumericShaper.ARABIC, ranges);
       
        ns = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.TAMIL, NumericShaper.EASTERN_ARABIC);

        ranges = ns.getRanges();
        assertEquals("Contextual shaper ranges have differences", NumericShaper.ARABIC | NumericShaper.TAMIL, ranges);
    }
View Full Code Here

TOP

Related Classes of java.awt.font.NumericShaper

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.