Java Code Examples for java.awt.font.NumericShaper#shape()
The following examples show how to use
java.awt.font.NumericShaper#shape() .
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: ShapingTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private static void checkResult(String ranges, NumericShaper ns, String given, String expected) { char[] text = given.toCharArray(); ns.shape(text, 0, text.length); String got = new String(text); if (!expected.equals(got)) { err = true; System.err.println("Error with range(s) <" + ranges + ">."); System.err.println(" text = " + given); System.err.println(" got = " + got); System.err.println(" expected = " + expected); } else { System.out.println("OK with range(s) <" + ranges + ">."); System.out.println(" text = " + given); System.out.println(" got = " + got); System.out.println(" expected = " + expected); } }
Example 2
Source File: TextLayout.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // 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); } }
Example 3
Source File: TextLayout.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // 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); } }
Example 4
Source File: TextLayout.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // 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); } }
Example 5
Source File: TextLayout.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // 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); } }
Example 6
Source File: TextLayout.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // 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); } }
Example 7
Source File: TextLayout.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // 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); } }
Example 8
Source File: TextLayout.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // 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); } }
Example 9
Source File: TextLayout.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // 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); } }
Example 10
Source File: TextLayout.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // 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); } }
Example 11
Source File: TextLayout.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // 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); } }
Example 12
Source File: ShapingTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void checkResult(String ranges, NumericShaper ns, String given, String expected) { char[] text = given.toCharArray(); ns.shape(text, 0, text.length); String got = new String(text); if (!expected.equals(got)) { err = true; System.err.println("Error with range(s) <" + ranges + ">."); System.err.println(" text = " + given); System.err.println(" got = " + got); System.err.println(" expected = " + expected); } else { System.out.println("OK with range(s) <" + ranges + ">."); System.out.println(" text = " + given); System.out.println(" got = " + got); System.out.println(" expected = " + expected); } }
Example 13
Source File: ShapingTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void checkResult(String ranges, NumericShaper ns, String given, String expected) { char[] text = given.toCharArray(); ns.shape(text, 0, text.length); String got = new String(text); if (!expected.equals(got)) { err = true; System.err.println("Error with range(s) <" + ranges + ">."); System.err.println(" text = " + given); System.err.println(" got = " + got); System.err.println(" expected = " + expected); } else { System.out.println("OK with range(s) <" + ranges + ">."); System.out.println(" text = " + given); System.out.println(" got = " + got); System.out.println(" expected = " + expected); } }
Example 14
Source File: ShapingTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void test6943963() { // Needed to reproduce this bug. NumericShaper ns_dummy = getContextualShaper(ARABIC | TAMIL | ETHIOPIC, EUROPEAN); char[] c = "\u1200 1".toCharArray(); ns_dummy.shape(c, 0, c.length); String given = "\u0627\u0628 456"; String expected_ARABIC = "\u0627\u0628 \u0664\u0665\u0666"; String expected_EASTERN_ARABIC = "\u0627\u0628 \u06f4\u06f5\u06f6"; NumericShaper ns = getContextualShaper(ARABIC); checkResult("ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC)); checkResult("Range.ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EASTERN_ARABIC); checkResult("EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.EASTERN_ARABIC)); checkResult("Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(ARABIC | EASTERN_ARABIC); checkResult("ARABIC | EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC, Range.EASTERN_ARABIC)); checkResult("Range.ARABIC, Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); }
Example 15
Source File: ShapingTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void test6943963() { // Needed to reproduce this bug. NumericShaper ns_dummy = getContextualShaper(ARABIC | TAMIL | ETHIOPIC, EUROPEAN); char[] c = "\u1200 1".toCharArray(); ns_dummy.shape(c, 0, c.length); String given = "\u0627\u0628 456"; String expected_ARABIC = "\u0627\u0628 \u0664\u0665\u0666"; String expected_EASTERN_ARABIC = "\u0627\u0628 \u06f4\u06f5\u06f6"; NumericShaper ns = getContextualShaper(ARABIC); checkResult("ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC)); checkResult("Range.ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EASTERN_ARABIC); checkResult("EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.EASTERN_ARABIC)); checkResult("Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(ARABIC | EASTERN_ARABIC); checkResult("ARABIC | EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC, Range.EASTERN_ARABIC)); checkResult("Range.ARABIC, Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); }
Example 16
Source File: ShapingTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void test6943963() { // Needed to reproduce this bug. NumericShaper ns_dummy = getContextualShaper(ARABIC | TAMIL | ETHIOPIC, EUROPEAN); char[] c = "\u1200 1".toCharArray(); ns_dummy.shape(c, 0, c.length); String given = "\u0627\u0628 456"; String expected_ARABIC = "\u0627\u0628 \u0664\u0665\u0666"; String expected_EASTERN_ARABIC = "\u0627\u0628 \u06f4\u06f5\u06f6"; NumericShaper ns = getContextualShaper(ARABIC); checkResult("ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC)); checkResult("Range.ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EASTERN_ARABIC); checkResult("EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.EASTERN_ARABIC)); checkResult("Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(ARABIC | EASTERN_ARABIC); checkResult("ARABIC | EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC, Range.EASTERN_ARABIC)); checkResult("Range.ARABIC, Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); }
Example 17
Source File: ShapingTest.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void test6943963() { // Needed to reproduce this bug. NumericShaper ns_dummy = getContextualShaper(ARABIC | TAMIL | ETHIOPIC, EUROPEAN); char[] c = "\u1200 1".toCharArray(); ns_dummy.shape(c, 0, c.length); String given = "\u0627\u0628 456"; String expected_ARABIC = "\u0627\u0628 \u0664\u0665\u0666"; String expected_EASTERN_ARABIC = "\u0627\u0628 \u06f4\u06f5\u06f6"; NumericShaper ns = getContextualShaper(ARABIC); checkResult("ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC)); checkResult("Range.ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EASTERN_ARABIC); checkResult("EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.EASTERN_ARABIC)); checkResult("Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(ARABIC | EASTERN_ARABIC); checkResult("ARABIC | EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC, Range.EASTERN_ARABIC)); checkResult("Range.ARABIC, Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); }
Example 18
Source File: ShapingTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void test6943963() { // Needed to reproduce this bug. NumericShaper ns_dummy = getContextualShaper(ARABIC | TAMIL | ETHIOPIC, EUROPEAN); char[] c = "\u1200 1".toCharArray(); ns_dummy.shape(c, 0, c.length); String given = "\u0627\u0628 456"; String expected_ARABIC = "\u0627\u0628 \u0664\u0665\u0666"; String expected_EASTERN_ARABIC = "\u0627\u0628 \u06f4\u06f5\u06f6"; NumericShaper ns = getContextualShaper(ARABIC); checkResult("ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC)); checkResult("Range.ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EASTERN_ARABIC); checkResult("EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.EASTERN_ARABIC)); checkResult("Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(ARABIC | EASTERN_ARABIC); checkResult("ARABIC | EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC, Range.EASTERN_ARABIC)); checkResult("Range.ARABIC, Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); }
Example 19
Source File: ShapingTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void test6943963() { // Needed to reproduce this bug. NumericShaper ns_dummy = getContextualShaper(ARABIC | TAMIL | ETHIOPIC, EUROPEAN); char[] c = "\u1200 1".toCharArray(); ns_dummy.shape(c, 0, c.length); String given = "\u0627\u0628 456"; String expected_ARABIC = "\u0627\u0628 \u0664\u0665\u0666"; String expected_EASTERN_ARABIC = "\u0627\u0628 \u06f4\u06f5\u06f6"; NumericShaper ns = getContextualShaper(ARABIC); checkResult("ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC)); checkResult("Range.ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EASTERN_ARABIC); checkResult("EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.EASTERN_ARABIC)); checkResult("Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(ARABIC | EASTERN_ARABIC); checkResult("ARABIC | EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC, Range.EASTERN_ARABIC)); checkResult("Range.ARABIC, Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); }
Example 20
Source File: ShapingTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static void test6943963() { // Needed to reproduce this bug. NumericShaper ns_dummy = getContextualShaper(ARABIC | TAMIL | ETHIOPIC, EUROPEAN); char[] c = "\u1200 1".toCharArray(); ns_dummy.shape(c, 0, c.length); String given = "\u0627\u0628 456"; String expected_ARABIC = "\u0627\u0628 \u0664\u0665\u0666"; String expected_EASTERN_ARABIC = "\u0627\u0628 \u06f4\u06f5\u06f6"; NumericShaper ns = getContextualShaper(ARABIC); checkResult("ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC)); checkResult("Range.ARABIC", ns, given, expected_ARABIC); ns = getContextualShaper(EASTERN_ARABIC); checkResult("EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.EASTERN_ARABIC)); checkResult("Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(ARABIC | EASTERN_ARABIC); checkResult("ARABIC | EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); ns = getContextualShaper(EnumSet.of(Range.ARABIC, Range.EASTERN_ARABIC)); checkResult("Range.ARABIC, Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); }