1 /* 2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 6850113 27 * @summary confirm the behavior of new Bidi implementation. (Backward compatibility) 28 */ 29 30 import java.awt.font.NumericShaper; 31 import java.awt.font.TextAttribute; 32 import java.text.AttributedString; 33 import java.text.Bidi; 34 import java.util.Arrays; 35 36 public class BidiConformance { 37 38 /* internal flags */ 39 private static boolean error = false; 40 private static boolean verbose = false; 41 private static boolean abort = false; 42 43 public static void main(String[] args) { 44 for (int i = 0; i < args.length; i++) { 45 String arg = args[i]; 46 if (arg.equals("-verbose")) { 47 verbose = true; 48 } else if (arg.equals("-abort")) { 49 abort = true; 50 } 51 } 52 53 BidiConformance bc = new BidiConformance(); 54 bc.test(); 55 56 if (error) { 57 throw new RuntimeException("Failed."); 58 } else { 59 System.out.println("Passed."); 60 } 61 } 62 351 Bidi bidi; 352 353 try { 354 bidi = new Bidi(null); 355 errorHandling("Bidi((AttributedCharacterIterator)null) " + 356 "should throw an IAE."); 357 } 358 catch (IllegalArgumentException e) { 359 } 360 catch (NullPointerException e) { 361 errorHandling("Bidi((AttributedCharacterIterator)null) " + 362 "should not throw an NPE but an IAE."); 363 } 364 365 String paragraph = data4Constructor1[1][0]; 366 int start = paragraph.indexOf('<')+1; 367 int limit = paragraph.indexOf('>'); 368 AttributedString astr = new AttributedString(paragraph); 369 astr.addAttribute(TextAttribute.RUN_DIRECTION, 370 TextAttribute.RUN_DIRECTION_RTL); 371 astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-61), 372 start, limit); 373 try { 374 bidi = new Bidi(astr.getIterator()); 375 for (int i = start; i < limit; i++) { 376 if (bidi.getLevelAt(i) != 61) { 377 errorHandling("Bidi(AttributedCharacterIterator).getLevelAt(" + 378 i + ") should not be " + bidi.getLevelAt(i) + 379 " but 60 when BIDI_EMBEDDING is -61."); 380 } 381 } 382 } 383 catch (Exception e) { 384 errorHandling(" Unexpected exception: " + e); 385 } 386 387 astr = new AttributedString(paragraph); 388 astr.addAttribute(TextAttribute.RUN_DIRECTION, 389 TextAttribute.RUN_DIRECTION_RTL); 390 astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-62), 391 start, limit); 392 try { 393 bidi = new Bidi(astr.getIterator()); 394 for (int i = start; i < limit; i++) { 395 if (bidi.getLevelAt(i) != 1) { 396 errorHandling("Bidi(AttributedCharacterIterator).getLevelAt() " + 397 "should be 1 when BIDI_EMBEDDING is -62."); 398 } 399 } 400 } 401 catch (Exception e) { 402 errorHandling(" Unexpected exception: " + e); 403 } 404 405 astr = new AttributedString(paragraph); 406 astr.addAttribute(TextAttribute.RUN_DIRECTION, 407 TextAttribute.RUN_DIRECTION_RTL); 408 astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(60), 409 start, limit); 410 try { 411 bidi = new Bidi(astr.getIterator()); 412 for (int i = start; i < limit; i++) { 413 if (bidi.getLevelAt(i) != 61) { 414 errorHandling("Bidi(AttributedCharacterIterator).getLevelAt() " + 415 "should be 61 when BIDI_EMBEDDING is 60."); 416 } 417 } 418 } 419 catch (Exception e) { 420 errorHandling(" Unexpected exception: " + e); 421 } 422 423 astr = new AttributedString(paragraph); 424 astr.addAttribute(TextAttribute.RUN_DIRECTION, 425 TextAttribute.RUN_DIRECTION_RTL); 426 astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(61), 427 start, limit); 428 try { 429 bidi = new Bidi(astr.getIterator()); 430 for (int i = start; i < limit; i++) { 431 if (bidi.getLevelAt(i) != 61) { 432 errorHandling("Bidi(AttributedCharacterIterator).getLevelAt(" + 433 i + ") should not be " + bidi.getLevelAt(i) + 434 " but 61 when BIDI_EMBEDDING is 61."); 435 } 436 } 437 } 438 catch (Exception e) { 439 errorHandling(" Unexpected exception: " + e); 440 } 441 442 astr = new AttributedString(paragraph); 443 astr.addAttribute(TextAttribute.RUN_DIRECTION, 444 TextAttribute.RUN_DIRECTION_RTL); 445 astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(62), 446 start, limit); 447 try { 448 bidi = new Bidi(astr.getIterator()); 449 for (int i = start; i < limit; i++) { 450 if (bidi.getLevelAt(i) != 1) { 451 errorHandling("Bidi(AttributedCharacterIterator).getLevelAt()" + 452 " should not be " + bidi.getLevelAt(i) + 453 " but 1 when BIDI_EMBEDDING is 62."); 454 } 455 } 456 } 457 catch (Exception e) { 458 errorHandling(" Unexpected exception: " + e); 459 } 460 } 461 462 private void testConstructor2() { 463 Bidi bidi; 464 465 try { 466 bidi = new Bidi(null, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT); 467 errorHandling("Bidi((String)null, DIRECTION_DEFAULT_LEFT_TO_RIGHT)" + 468 " should throw an IAE."); 469 } 470 catch (IllegalArgumentException e) { 471 } 472 catch (NullPointerException e) { 473 errorHandling("Bidi((String)null, DIRECTION_DEFAULT_LEFT_TO_RIGHT) " + 519 } 520 catch (ArrayIndexOutOfBoundsException e) { 521 errorHandling("Bidi(char[], ...) should not throw an NPE " + 522 "but an IAE when textStart is incorrect(-1: too small)."); 523 } 524 525 try { 526 bidi = new Bidi(text, 4, embeddings, 0, 2, 527 Bidi.DIRECTION_LEFT_TO_RIGHT); 528 errorHandling("Bidi(char[], ...) should throw an IAE " + 529 "when textStart is incorrect(4: too large)."); 530 } 531 catch (IllegalArgumentException e) { 532 } 533 catch (ArrayIndexOutOfBoundsException e) { 534 errorHandling("Bidi(char[], ...) should not throw an NPE " + 535 "but an IAE when textStart is incorrect(4: too large)."); 536 } 537 538 byte[] actualLevels = new byte[text.length]; 539 byte[] validEmbeddings1 = {0, -61, -60, -2, -1}; 540 byte[] expectedLevels1 = {0, 61, 60, 2, 1}; 541 try { 542 bidi = new Bidi(text, 0, validEmbeddings1, 0, 5, 543 Bidi.DIRECTION_LEFT_TO_RIGHT); 544 for (int i = 0; i < text.length; i++) { 545 actualLevels[i] = (byte)bidi.getLevelAt(i); 546 } 547 if (!Arrays.equals(expectedLevels1, actualLevels)) { 548 errorHandling("Bidi(char[], ...).getLevelAt()" + 549 " should be {" + toString(actualLevels) + 550 "} when embeddings are {" + 551 toString(expectedLevels1) + "}."); 552 } 553 } 554 catch (Exception e) { 555 errorHandling("Bidi(char[], ...) should not throw an exception " + 556 "when embeddings is valid(-61)."); 557 } 558 559 byte[] validEmbeddings2 = {0, 61, 60, 2, 1}; 560 byte[] expectedLevels2 = {0, 62, 60, 2, 2}; 561 try { 562 bidi = new Bidi(text, 0, validEmbeddings2, 0, 5, 563 Bidi.DIRECTION_LEFT_TO_RIGHT); 564 for (int i = 0; i < text.length; i++) { 565 actualLevels[i] = (byte)bidi.getLevelAt(i); 566 } 567 if (!Arrays.equals(expectedLevels2, actualLevels)) { 568 errorHandling("Bidi(char[], ...).getLevelAt()" + 569 " should be {" + toString(actualLevels) + 570 "} when embeddings are {" + 571 toString(expectedLevels2) + "}."); 572 } 573 } 574 catch (Exception e) { 575 errorHandling("Bidi(char[], ...) should not throw an exception " + 576 "when embeddings is valid(61)."); 577 } 578 579 byte[] invalidEmbeddings1 = {0, -62, 0, 0, 0}; 580 try { 581 bidi = new Bidi(text, 0, invalidEmbeddings1, 0, 5, 582 Bidi.DIRECTION_LEFT_TO_RIGHT); 583 if (bidi.getLevelAt(1) != 0) { 584 errorHandling("Bidi(char[], ...).getLevelAt(1) should be 0 " + 585 "when embeddings[1] is -62."); 586 } 587 } 588 catch (Exception e) { 589 errorHandling("Bidi(char[], ...) should not throw an exception " + 590 "even when embeddings includes -62."); 591 } 592 593 byte[] invalidEmbeddings2 = {0, 62, 0, 0, 0}; 594 try { 595 bidi = new Bidi(text, 0, invalidEmbeddings2, 0, 5, 596 Bidi.DIRECTION_LEFT_TO_RIGHT); 597 if (bidi.getLevelAt(1) != 0) { 598 errorHandling("Bidi(char[], ...).getLevelAt(1) should be 0 " + 599 "when embeddings[1] is 62."); 600 } 601 } 602 catch (Exception e) { 603 errorHandling("Bidi(char[], ...) should not throw an exception " + 604 "even when embeddings includes 62."); 605 } 606 607 try { 608 bidi = new Bidi(text, 0, embeddings, 0, -1, 609 Bidi.DIRECTION_LEFT_TO_RIGHT); 610 errorHandling("Bidi(char[], ...) should throw an IAE " + 611 "when paragraphLength=-1(too small)."); 612 } 613 catch (IllegalArgumentException e) { 614 } 615 catch (NegativeArraySizeException e) { 616 errorHandling("Bidi(char[], ...) should not throw an NASE " + 617 "but an IAE when paragraphLength=-1(too small)."); 618 } 619 620 try { 621 bidi = new Bidi(text, 0, embeddings, 0, 6, 622 Bidi.DIRECTION_LEFT_TO_RIGHT); 623 errorHandling("Bidi(char[], ...) should throw an IAE " + 624 "when paragraphLength=6(too large)."); 1578 Bidi.DIRECTION_LEFT_TO_RIGHT, // 0 1579 Bidi.DIRECTION_RIGHT_TO_LEFT // 1 1580 }; 1581 1582 /* Bidi pubilc constants names */ 1583 private static final String[] FLAGNAMES = { 1584 "DIRECTION_DEFAULT_LEFT_TO_RIGHT", // -2 1585 "DIRECTION_DEFAULT_RIGHT_TO_LEFT", // -1 1586 "DIRECTION_LEFT_TO_RIGHT", // 0 1587 "DIRECTION_RIGHT_TO_LEFT", // 1 1588 }; 1589 1590 /* Bidirectional Character Types */ 1591 private static final char L = '\u200E'; 1592 private static final char R = '\u202F'; 1593 private static final char LRE = '\u202A'; 1594 private static final char RLE = '\u202B'; 1595 private static final char PDF = '\u202C'; 1596 private static final char LRO = '\u202D'; 1597 private static final char RLO = '\u202E'; 1598 1599 /* 1600 * 0x05D0-0x05EA: [R] Hewbrew letters (Strong) 1601 * 0x0627-0x063A: [AL] Arabic letters (Strong) 1602 * 0x0660-0x0669: [AN] Arabic-Indic digits (Weak) 1603 * 0x07CA-0x07E7: [R] NKo letters (Strong) 1604 * 0x07C0-0x07C9: [R] NKo digits (Strong) 1605 * 0xFE50-0xFEFF: [AL] Arabic presentaion form (Strong) 1606 * 0x10480-0x1049D: [L] Osmanya letters (Strong) 1607 * 0x104A0-0x104A9: [L] Osmanya digits (Strong) 1608 * 0x10A10-0x10A33: [R] Kharoshthi letters (Strong) 1609 * 0x10A40-0x10A43: [R] Kharoshthi digits (Strong) 1610 * 1611 * 0x200E: [L] Left-to-right mark (Implicit, Strong) 1612 * 0x200F: [R] Right-to-left mark (Implicit, Strong) 1613 * 0x202A: [LRE] Left-to-right embedding (Explicit, Strong) 1614 * 0x202B: [RLE] Right-to-left embedding (Explicit, Strong) 1615 * 0x202C: [PDF] Pop directional formatting (Explicit, Weak) 1616 * 0x202D: [LRO] Left-to-right override (Explicit, Strong) 1617 * 0x202E: [RLO] Right-to-left override (Explicit, Strong) 1985 "2222222222222222222222244443333333322111"}, 1986 1987 /* For Text #16 */ 1988 {RLO + "Did you say '" + LRE + "he said \"" + RLE + "ABC " + 1989 HebrewABC + " " + NKo123 + PDF + "\"" + PDF + "'?" + PDF, 1990 "111111111111112222222222444433333333221110", 1991 "111111111111112222222222444433333333221110", 1992 "111111111111112222222222444433333333221110", 1993 "333333333333334444444444666655555555443331"}, 1994 1995 /* For Text #17 */ 1996 {RLO + "Did you say '" + LRE + "he said \"" + RLE + "ABC " + 1997 HebrewABC + " " + NKo123 + PDF + "\"" + PDF + "'?", // PDF missing 1998 "11111111111111222222222244443333333322111", 1999 "11111111111111222222222244443333333322111", 2000 "11111111111111222222222244443333333322111", 2001 "33333333333333444444444466665555555544333"}, 2002 2003 /* For Text #18 */ 2004 {" ABC (" + ArabicABC + " " + Arabic123 + ") 123.", 2005 "0000001111222112220", "0000001111222112220", 2006 "0000001111222112220", "1222111111222112221"}, 2007 2008 /* For Text #19 */ 2009 {" " + HebrewABC + " (ABC 123) " + NKo123 + ".", 2010 "1111112222222111111", "1111112222222111111", 2011 "0111000000000001110", "1111112222222111111"}, 2012 2013 /* For Text #20 */ 2014 {" He said \"" + RLE + "ABC " + NKoABC + " " + NKo123 + PDF + ".\" ", 2015 "00000000002222111111110000", "00000000002222111111110000", 2016 "00000000002222111111110000", "12222222114444333333331111"}, 2017 2018 /* For Text #21 */ 2019 {" Did you say '" + LRE + "he said \"" + RLE + "ABC " + HebrewABC + 2020 " " + NKo123 + PDF + "\"" + PDF + "'? ", 2021 "000000000000002222222222444433333333220000", 2022 "000000000000002222222222444433333333220000", 2023 "000000000000002222222222444433333333220000", 2024 "122222222222222222222222444433333333221111"}, 2025 2026 /* For Text #22 */ 2027 {RLE + OsmanyaABC + " " + KharoshthiABC + " " + Kharoshthi123 + "." + 2028 PDF, 2029 "22222221111111111111110", "22222221111111111111110", 2030 "22222221111111111111110", "44444443333333333333331"}, 2031 }; 2032 2033 /* Golden data for baseIsLeftToRight() results */ 2034 private static boolean[][] baseIsLTR4Constructor2 = { 2035 /* For Text #0 - $4 */ 2036 {true, true, true, false}, 2037 {true, true, true, false}, 2038 {true, true, true, false}, 2039 {false, false, true, false}, 2040 {false, false, true, false}, 2041 2042 /* For Text #5 - $9 */ 2043 {false, false, true, false}, 2044 {false, false, true, false}, 2045 {false, false, true, false}, 2046 {true, true, true, false}, 2047 {true, true, true, false}, 2048 2049 /* For Text #10 - $14 */ 2050 {true, true, true, false}, 2051 {true, true, true, false}, 2052 {true, true, true, false}, 2053 {true, true, true, false}, 2054 {true, true, true, false}, 2055 2056 /* For Text #15 - $19 */ 2057 {true, true, true, false}, 2058 {true, true, true, false}, 2059 {true, true, true, false}, 2060 {true, true, true, false}, 2061 {false, false, true, false}, 2062 2063 /* For Text #20 - $22 */ 2064 {true, true, true, false}, 2065 {true, true, true, false}, 2066 {true, true, true, false}, 2067 }; 2068 2069 /* Golden data for isLeftToRight() & isRightToLeft() results */ 2070 private static boolean[][][] isLTR_isRTL4Constructor2 = { 2071 /* isLeftToRight() results & isRightToLeft() results */ 2072 /* For Text #0 - $4 */ 2073 {{true, true, true, false}, {false, false, false, false}}, 2074 {{false, false, false, false}, {false, false, false, false}}, 2075 {{false, false, false, false}, {false, false, false, false}}, 2076 {{false, false, false, false}, {false, false, false, false}}, 2077 {{false, false, false, false}, {false, false, false, false}}, 2078 2079 /* For Text #5 - $9 */ 2080 {{false, false, false, false}, {true, true, false, true }}, 2081 {{false, false, false, false}, {false, false, false, false}}, 2082 {{false, false, false, false}, {true, true, false, true }}, 2083 {{false, false, false, false}, {false, false, false, false}}, 2084 {{true, true, true, false}, {false, false, false, false}}, 2085 2086 /* For Text #10 - $14 */ 2087 {{false, false, false, false}, {false, false, false, false}}, 2088 {{false, false, false, false}, {false, false, false, false}}, 2089 {{false, false, false, false}, {false, false, false, false}}, 2090 {{false, false, false, false}, {false, false, false, false}}, 2091 {{false, false, false, false}, {false, false, false, false}}, 2092 2093 /* For Text #15 - $19 */ 2094 {{false, false, false, false}, {false, false, false, false}}, 2095 {{false, false, false, false}, {false, false, false, false}}, 2096 {{false, false, false, false}, {false, false, false, false}}, 2097 {{false, false, false, false}, {false, false, false, false}}, 2098 {{false, false, false, false}, {false, false, false, false}}, 2099 2100 /* For Text #20 - $22 */ 2101 {{false, false, false, false}, {false, false, false, false}}, 2102 {{false, false, false, false}, {false, false, false, false}}, 2103 {{false, false, false, false}, {false, false, false, false}}, 2104 }; 2105 2106 /* Golden data for requiresBidi() results */ 2107 private static boolean[] requiresBidi4Constructor2 = { 2108 /* For Text #0 - $9 */ 2109 false, true, true, true, true, 2110 true, true, true, true, false, 2111 2112 /* For Text #10 - $19 */ 2113 true, true, true, true, true, 2114 true, true, true, true, true, 2115 2116 /* For Text #20 - $22 */ 2117 true, true, true, 2118 }; 2119 2120 /* --------------------------------------------------------------------- */ 2121 2122 /* 2123 * Test data for Bidi(char[], ...) constructor and methods 2124 */ 2125 2126 /* Enbeddings */ 2127 private static byte[][][] emb4Constructor3 = { 2128 /* Embeddings for paragraphs which don't include surrogate pairs. */ 2129 {{0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, 2130 {0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0}, 2131 {0, 0, 0, 0, 0, -3, -3, -3, -3, -3, -3, -3, 0, 0, 0, 0, 0, 0}, 2132 {0, 0, 0, 0, 0, -4, -4, -4, -4, -4, -4, -4, 0, 0, 0, 0, 0, 0}}, 2133 2134 /* Embeddings for paragraphs which include surrogate pairs. */ 2135 {{ 0, 0, 0, 0, 0, 0, 0, 0, 2136 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2137 0, 0, 0, 0, 0, 0, 0, 0, 0}, | 1 /* 2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 6850113 8032446 27 * @summary confirm the behavior of new Bidi implementation. (Backward compatibility) 28 */ 29 30 import java.awt.font.NumericShaper; 31 import java.awt.font.TextAttribute; 32 import java.text.AttributedString; 33 import java.text.Bidi; 34 import java.util.Arrays; 35 36 public class BidiConformance { 37 38 /* internal flags */ 39 private static boolean error = false; 40 private static boolean verbose = false; 41 private static boolean abort = false; 42 43 private static final byte MAX_EXPLICIT_LEVEL = 125; 44 45 public static void main(String[] args) { 46 for (int i = 0; i < args.length; i++) { 47 String arg = args[i]; 48 if (arg.equals("-verbose")) { 49 verbose = true; 50 } else if (arg.equals("-abort")) { 51 abort = true; 52 } 53 } 54 55 BidiConformance bc = new BidiConformance(); 56 bc.test(); 57 58 if (error) { 59 throw new RuntimeException("Failed."); 60 } else { 61 System.out.println("Passed."); 62 } 63 } 64 353 Bidi bidi; 354 355 try { 356 bidi = new Bidi(null); 357 errorHandling("Bidi((AttributedCharacterIterator)null) " + 358 "should throw an IAE."); 359 } 360 catch (IllegalArgumentException e) { 361 } 362 catch (NullPointerException e) { 363 errorHandling("Bidi((AttributedCharacterIterator)null) " + 364 "should not throw an NPE but an IAE."); 365 } 366 367 String paragraph = data4Constructor1[1][0]; 368 int start = paragraph.indexOf('<')+1; 369 int limit = paragraph.indexOf('>'); 370 AttributedString astr = new AttributedString(paragraph); 371 astr.addAttribute(TextAttribute.RUN_DIRECTION, 372 TextAttribute.RUN_DIRECTION_RTL); 373 astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-MAX_EXPLICIT_LEVEL), 374 start, limit); 375 try { 376 bidi = new Bidi(astr.getIterator()); 377 for (int i = start; i < limit; i++) { 378 if (bidi.getLevelAt(i) != MAX_EXPLICIT_LEVEL) { 379 errorHandling("Bidi(AttributedCharacterIterator).getLevelAt(" + 380 i + ") should not be " + bidi.getLevelAt(i) + 381 " but MAX_EXPLICIT_LEVEL-1 when BIDI_EMBEDDING is -MAX_EXPLICIT_LEVEL."); 382 } 383 } 384 } 385 catch (Exception e) { 386 errorHandling(" Unexpected exception: " + e); 387 } 388 389 astr = new AttributedString(paragraph); 390 astr.addAttribute(TextAttribute.RUN_DIRECTION, 391 TextAttribute.RUN_DIRECTION_RTL); 392 astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-(MAX_EXPLICIT_LEVEL+1)), 393 start, limit); 394 try { 395 bidi = new Bidi(astr.getIterator()); 396 for (int i = start; i < limit; i++) { 397 if (bidi.getLevelAt(i) != 1) { 398 errorHandling("Bidi(AttributedCharacterIterator).getLevelAt() " + 399 "should be 1 when BIDI_EMBEDDING is -(MAX_EXPLICIT_LEVEL+1)."); 400 } 401 } 402 } 403 catch (Exception e) { 404 errorHandling(" Unexpected exception: " + e); 405 } 406 407 astr = new AttributedString(paragraph); 408 astr.addAttribute(TextAttribute.RUN_DIRECTION, 409 TextAttribute.RUN_DIRECTION_RTL); 410 astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(MAX_EXPLICIT_LEVEL-1), 411 start, limit); 412 try { 413 bidi = new Bidi(astr.getIterator()); 414 for (int i = start; i < limit; i++) { 415 if (bidi.getLevelAt(i) != MAX_EXPLICIT_LEVEL) { 416 errorHandling("Bidi(AttributedCharacterIterator).getLevelAt() " + 417 "should be MAX_EXPLICIT_LEVEL when BIDI_EMBEDDING is MAX_EXPLICIT_LEVEL-1."); 418 } 419 } 420 } 421 catch (Exception e) { 422 errorHandling(" Unexpected exception: " + e); 423 } 424 425 astr = new AttributedString(paragraph); 426 astr.addAttribute(TextAttribute.RUN_DIRECTION, 427 TextAttribute.RUN_DIRECTION_RTL); 428 astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(MAX_EXPLICIT_LEVEL), 429 start, limit); 430 try { 431 bidi = new Bidi(astr.getIterator()); 432 for (int i = start; i < limit; i++) { 433 if (bidi.getLevelAt(i) != MAX_EXPLICIT_LEVEL) { 434 errorHandling("Bidi(AttributedCharacterIterator).getLevelAt(" + 435 i + ") should not be " + bidi.getLevelAt(i) + 436 " but MAX_EXPLICIT_LEVEL when BIDI_EMBEDDING is MAX_EXPLICIT_LEVEL."); 437 } 438 } 439 } 440 catch (Exception e) { 441 errorHandling(" Unexpected exception: " + e); 442 } 443 444 astr = new AttributedString(paragraph); 445 astr.addAttribute(TextAttribute.RUN_DIRECTION, 446 TextAttribute.RUN_DIRECTION_RTL); 447 astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(MAX_EXPLICIT_LEVEL+1), 448 start, limit); 449 try { 450 bidi = new Bidi(astr.getIterator()); 451 for (int i = start; i < limit; i++) { 452 if (bidi.getLevelAt(i) != 1) { 453 errorHandling("Bidi(AttributedCharacterIterator).getLevelAt(" + 454 i + ") should not be " + bidi.getLevelAt(i) + 455 " but 1 when BIDI_EMBEDDING is MAX_EXPLICIT_LEVEL+1."); 456 } 457 } 458 } 459 catch (Exception e) { 460 errorHandling(" Unexpected exception: " + e); 461 } 462 } 463 464 private void testConstructor2() { 465 Bidi bidi; 466 467 try { 468 bidi = new Bidi(null, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT); 469 errorHandling("Bidi((String)null, DIRECTION_DEFAULT_LEFT_TO_RIGHT)" + 470 " should throw an IAE."); 471 } 472 catch (IllegalArgumentException e) { 473 } 474 catch (NullPointerException e) { 475 errorHandling("Bidi((String)null, DIRECTION_DEFAULT_LEFT_TO_RIGHT) " + 521 } 522 catch (ArrayIndexOutOfBoundsException e) { 523 errorHandling("Bidi(char[], ...) should not throw an NPE " + 524 "but an IAE when textStart is incorrect(-1: too small)."); 525 } 526 527 try { 528 bidi = new Bidi(text, 4, embeddings, 0, 2, 529 Bidi.DIRECTION_LEFT_TO_RIGHT); 530 errorHandling("Bidi(char[], ...) should throw an IAE " + 531 "when textStart is incorrect(4: too large)."); 532 } 533 catch (IllegalArgumentException e) { 534 } 535 catch (ArrayIndexOutOfBoundsException e) { 536 errorHandling("Bidi(char[], ...) should not throw an NPE " + 537 "but an IAE when textStart is incorrect(4: too large)."); 538 } 539 540 byte[] actualLevels = new byte[text.length]; 541 byte[] validEmbeddings1 = {0, -MAX_EXPLICIT_LEVEL, -(MAX_EXPLICIT_LEVEL-1), -2, -1}; 542 byte[] expectedLevels1 = {0, MAX_EXPLICIT_LEVEL, MAX_EXPLICIT_LEVEL-1, 2, 1}; 543 try { 544 bidi = new Bidi(text, 0, validEmbeddings1, 0, 5, 545 Bidi.DIRECTION_LEFT_TO_RIGHT); 546 for (int i = 0; i < text.length; i++) { 547 actualLevels[i] = (byte)bidi.getLevelAt(i); 548 } 549 if (!Arrays.equals(expectedLevels1, actualLevels)) { 550 errorHandling("Bidi(char[], ...).getLevelAt()" + 551 " should be {" + toString(actualLevels) + 552 "} when embeddings are {" + 553 toString(expectedLevels1) + "}."); 554 } 555 } 556 catch (Exception e) { 557 errorHandling("Bidi(char[], ...) should not throw an exception " + 558 "when embeddings is valid(-MAX_EXPLICIT_LEVEL)."); 559 } 560 561 byte[] validEmbeddings2 = {0, MAX_EXPLICIT_LEVEL, MAX_EXPLICIT_LEVEL-1, 2, 1}; 562 byte[] expectedLevels2 = {0, MAX_EXPLICIT_LEVEL+1, MAX_EXPLICIT_LEVEL-1, 2, 2}; 563 try { 564 bidi = new Bidi(text, 0, validEmbeddings2, 0, 5, 565 Bidi.DIRECTION_LEFT_TO_RIGHT); 566 for (int i = 0; i < text.length; i++) { 567 actualLevels[i] = (byte)bidi.getLevelAt(i); 568 } 569 if (!Arrays.equals(expectedLevels2, actualLevels)) { 570 errorHandling("Bidi(char[], ...).getLevelAt()" + 571 " should be {" + toString(actualLevels) + 572 "} when embeddings are {" + 573 toString(expectedLevels2) + "}."); 574 } 575 } 576 catch (Exception e) { 577 errorHandling("Bidi(char[], ...) should not throw an exception " + 578 "when embeddings is valid(MAX_EXPLICIT_LEVEL)."); 579 } 580 581 byte[] invalidEmbeddings1 = {0, -(MAX_EXPLICIT_LEVEL+1), 0, 0, 0}; 582 try { 583 bidi = new Bidi(text, 0, invalidEmbeddings1, 0, 5, 584 Bidi.DIRECTION_LEFT_TO_RIGHT); 585 if (bidi.getLevelAt(1) != 0) { 586 errorHandling("Bidi(char[], ...).getLevelAt(1) should be 0 " + 587 "when embeddings[1] is -(MAX_EXPLICIT_LEVEL+1)."); 588 } 589 } 590 catch (Exception e) { 591 errorHandling("Bidi(char[], ...) should not throw an exception " + 592 "even when embeddings includes -(MAX_EXPLICIT_LEVEL+1)."); 593 } 594 595 byte[] invalidEmbeddings2 = {0, MAX_EXPLICIT_LEVEL+1, 0, 0, 0}; 596 try { 597 bidi = new Bidi(text, 0, invalidEmbeddings2, 0, 5, 598 Bidi.DIRECTION_LEFT_TO_RIGHT); 599 if (bidi.getLevelAt(1) != 0) { 600 errorHandling("Bidi(char[], ...).getLevelAt(1) should be 0 " + 601 "when embeddings[1] is MAX_EXPLICIT_LEVEL+1."); 602 } 603 } 604 catch (Exception e) { 605 errorHandling("Bidi(char[], ...) should not throw an exception " + 606 "even when embeddings includes MAX_EXPLICIT_LEVEL+1."); 607 } 608 609 try { 610 bidi = new Bidi(text, 0, embeddings, 0, -1, 611 Bidi.DIRECTION_LEFT_TO_RIGHT); 612 errorHandling("Bidi(char[], ...) should throw an IAE " + 613 "when paragraphLength=-1(too small)."); 614 } 615 catch (IllegalArgumentException e) { 616 } 617 catch (NegativeArraySizeException e) { 618 errorHandling("Bidi(char[], ...) should not throw an NASE " + 619 "but an IAE when paragraphLength=-1(too small)."); 620 } 621 622 try { 623 bidi = new Bidi(text, 0, embeddings, 0, 6, 624 Bidi.DIRECTION_LEFT_TO_RIGHT); 625 errorHandling("Bidi(char[], ...) should throw an IAE " + 626 "when paragraphLength=6(too large)."); 1580 Bidi.DIRECTION_LEFT_TO_RIGHT, // 0 1581 Bidi.DIRECTION_RIGHT_TO_LEFT // 1 1582 }; 1583 1584 /* Bidi pubilc constants names */ 1585 private static final String[] FLAGNAMES = { 1586 "DIRECTION_DEFAULT_LEFT_TO_RIGHT", // -2 1587 "DIRECTION_DEFAULT_RIGHT_TO_LEFT", // -1 1588 "DIRECTION_LEFT_TO_RIGHT", // 0 1589 "DIRECTION_RIGHT_TO_LEFT", // 1 1590 }; 1591 1592 /* Bidirectional Character Types */ 1593 private static final char L = '\u200E'; 1594 private static final char R = '\u202F'; 1595 private static final char LRE = '\u202A'; 1596 private static final char RLE = '\u202B'; 1597 private static final char PDF = '\u202C'; 1598 private static final char LRO = '\u202D'; 1599 private static final char RLO = '\u202E'; 1600 private static final char LRI = '\u2066'; 1601 private static final char RLI = '\u2067'; 1602 private static final char FSI = '\u2068'; 1603 private static final char PDI = '\u2069'; 1604 1605 /* 1606 * 0x05D0-0x05EA: [R] Hewbrew letters (Strong) 1607 * 0x0627-0x063A: [AL] Arabic letters (Strong) 1608 * 0x0660-0x0669: [AN] Arabic-Indic digits (Weak) 1609 * 0x07CA-0x07E7: [R] NKo letters (Strong) 1610 * 0x07C0-0x07C9: [R] NKo digits (Strong) 1611 * 0xFE50-0xFEFF: [AL] Arabic presentaion form (Strong) 1612 * 0x10480-0x1049D: [L] Osmanya letters (Strong) 1613 * 0x104A0-0x104A9: [L] Osmanya digits (Strong) 1614 * 0x10A10-0x10A33: [R] Kharoshthi letters (Strong) 1615 * 0x10A40-0x10A43: [R] Kharoshthi digits (Strong) 1616 * 1617 * 0x200E: [L] Left-to-right mark (Implicit, Strong) 1618 * 0x200F: [R] Right-to-left mark (Implicit, Strong) 1619 * 0x202A: [LRE] Left-to-right embedding (Explicit, Strong) 1620 * 0x202B: [RLE] Right-to-left embedding (Explicit, Strong) 1621 * 0x202C: [PDF] Pop directional formatting (Explicit, Weak) 1622 * 0x202D: [LRO] Left-to-right override (Explicit, Strong) 1623 * 0x202E: [RLO] Right-to-left override (Explicit, Strong) 1991 "2222222222222222222222244443333333322111"}, 1992 1993 /* For Text #16 */ 1994 {RLO + "Did you say '" + LRE + "he said \"" + RLE + "ABC " + 1995 HebrewABC + " " + NKo123 + PDF + "\"" + PDF + "'?" + PDF, 1996 "111111111111112222222222444433333333221110", 1997 "111111111111112222222222444433333333221110", 1998 "111111111111112222222222444433333333221110", 1999 "333333333333334444444444666655555555443331"}, 2000 2001 /* For Text #17 */ 2002 {RLO + "Did you say '" + LRE + "he said \"" + RLE + "ABC " + 2003 HebrewABC + " " + NKo123 + PDF + "\"" + PDF + "'?", // PDF missing 2004 "11111111111111222222222244443333333322111", 2005 "11111111111111222222222244443333333322111", 2006 "11111111111111222222222244443333333322111", 2007 "33333333333333444444444466665555555544333"}, 2008 2009 /* For Text #18 */ 2010 {" ABC (" + ArabicABC + " " + Arabic123 + ") 123.", 2011 "0000001111222002220", "0000001111222002220", 2012 "0000001111222002220", "1222111111222112221"}, 2013 2014 /* For Text #19 */ 2015 {" " + HebrewABC + " (ABC 123) " + NKo123 + ".", 2016 "1111112222222111111", "1111112222222111111", 2017 "0111000000000001110", "1111112222222111111"}, 2018 2019 /* For Text #20 */ 2020 {" He said \"" + RLE + "ABC " + NKoABC + " " + NKo123 + PDF + ".\" ", 2021 "00000000002222111111110000", "00000000002222111111110000", 2022 "00000000002222111111110000", "12222222114444333333331111"}, 2023 2024 /* For Text #21 */ 2025 {" Did you say '" + LRE + "he said \"" + RLE + "ABC " + HebrewABC + 2026 " " + NKo123 + PDF + "\"" + PDF + "'? ", 2027 "000000000000002222222222444433333333220000", 2028 "000000000000002222222222444433333333220000", 2029 "000000000000002222222222444433333333220000", 2030 "122222222222222222222222444433333333221111"}, 2031 2032 /* For Text #22 */ 2033 {RLE + OsmanyaABC + " " + KharoshthiABC + " " + Kharoshthi123 + "." + 2034 PDF, 2035 "22222221111111111111110", "22222221111111111111110", 2036 "22222221111111111111110", "44444443333333333333331"}, 2037 2038 /* For Text #23 */ 2039 {" ABC (" + Arabic123 + " " + ArabicABC + ") 123.", 2040 "0000002221111002220", "0000002221111002220", 2041 "0000002221111002220", "1222112221111112221"}, 2042 2043 /* For Text #24 */ 2044 {" 123 (" + ArabicABC + " " + Arabic123 + ") ABC.", 2045 "1222111111222112221", "1222111111222112221", 2046 "0000001111222000000", "1222111111222112221"}, 2047 2048 /* For Text #25 */ 2049 {" 123 (" + Arabic123 + " " + ArabicABC + ") ABC.", 2050 "1222112221111112221", "1222112221111112221", 2051 "0000002221111000000", "1222112221111112221"}, 2052 2053 /* For Text #26 */ 2054 {" " + ArabicABC + " (ABC 123) " + Arabic123 + ".", 2055 "1111112222222112221", "1111112222222112221", 2056 "0111000000000002220", "1111112222222112221"}, 2057 2058 /* For Text #27 */ 2059 {" " + ArabicABC + " (123 ABC) " + Arabic123 + ".", 2060 "1111112221222112221", "1111112221222112221", 2061 "0111002220000002220", "1111112221222112221"}, 2062 2063 /* For Text #28 */ 2064 {" " + Arabic123 + " (ABC 123) " + ArabicABC + ".", 2065 "0222000000000001110", "0222000000000001110", 2066 "0222000000000001110", "1222112222222111111"}, 2067 2068 /* For Text #29 */ 2069 {" " + Arabic123 + " (123 ABC) " + ArabicABC + ".", 2070 "0222000000000001110", "0222000000000001110", 2071 "0222000000000001110", "1222112221222111111"}, 2072 2073 /* For Text #30 */ 2074 {RLI + "ABC " + ArabicABC + " " + ArabicABC + "." + PDI, 2075 "02221111111110", "14443333333331", 2076 "02221111111110", "14443333333331"}, 2077 2078 /* For Text #31 */ 2079 {"ABC abc \"" + RLI + "IJK " + ArabicABC + " " + ArabicABC + PDI + 2080 ".\" \"" + RLI + ArabicABC + " " + ArabicABC + PDI + ",\" xyz XYZ.", 2081 "0000000000222111111110000001111111000000000000", 2082 "0000000000222111111110000001111111000000000000", 2083 "0000000000222111111110000001111111000000000000", 2084 "2222222222444333333332222223333333222222222221"}, 2085 2086 /* For Text #32 */ 2087 {ArabicABC + " " + ArabicABC + " '" + LRI + "abc def \"" + RLI + 2088 "xyz " + ArabicABC + " " + ArabicABC + PDI + "\"" + PDI + "'?", 2089 "111111111122222222224443333333322111", 2090 "111111111122222222224443333333322111", 2091 "111111100022222222224443333333322000", 2092 "111111111122222222224443333333322111"}, 2093 2094 /* For Text #33 */ 2095 {FSI + Arabic123 + " ABC " + ArabicABC + " " + ArabicABC + "." + PDI, 2096 "044422222333333320", "144422222333333321", 2097 "044422222333333320", "144422222333333321"}, 2098 2099 /* For Text #34 */ 2100 {FSI + "123 ABC " + ArabicABC + " " + ArabicABC + "." + PDI, 2101 "022222222333333320", "122222222333333321", 2102 "022222222333333320", "122222222333333321"}, 2103 2104 /* For Text #35 */ 2105 {FSI + "123 " + ArabicABC + " ABC " + ArabicABC + "." + PDI, 2106 "022211111222111110", "144433333444333331", 2107 "022211111222111110", "144433333444333331"}, 2108 2109 /* For Text #36 */ 2110 {FSI + Arabic123 + " " + ArabicABC + " ABC " + ArabicABC + "." + PDI, 2111 "022211111222111110", "144433333444333331", 2112 "022211111222111110", "144433333444333331"}, 2113 2114 /* For Text #37 */ 2115 {FSI + Arabic123 + " 123." + PDI, 2116 "0444222220", "1444222221", "0444222220", "1444222221"}, 2117 2118 /* For Text #38 */ 2119 {FSI + "123 " + Arabic123 + "." + PDI, 2120 "0222244420", "1222244421", "0222244420", "1222244421"}, 2121 }; 2122 2123 /* Golden data for baseIsLeftToRight() results */ 2124 private static boolean[][] baseIsLTR4Constructor2 = { 2125 /* For Text #0 - $4 */ 2126 {true, true, true, false}, 2127 {true, true, true, false}, 2128 {true, true, true, false}, 2129 {false, false, true, false}, 2130 {false, false, true, false}, 2131 2132 /* For Text #5 - $9 */ 2133 {false, false, true, false}, 2134 {false, false, true, false}, 2135 {false, false, true, false}, 2136 {true, true, true, false}, 2137 {true, true, true, false}, 2138 2139 /* For Text #10 - $14 */ 2140 {true, true, true, false}, 2141 {true, true, true, false}, 2142 {true, true, true, false}, 2143 {true, true, true, false}, 2144 {true, true, true, false}, 2145 2146 /* For Text #15 - $19 */ 2147 {true, true, true, false}, 2148 {true, true, true, false}, 2149 {true, true, true, false}, 2150 {true, true, true, false}, 2151 {false, false, true, false}, 2152 2153 /* For Text #20 - $24 */ 2154 {true, true, true, false}, 2155 {true, true, true, false}, 2156 {true, true, true, false}, 2157 {true, true, true, false}, 2158 {false, false, true, false}, 2159 2160 /* For Text #25 - $29 */ 2161 {false, false, true, false}, 2162 {false, false, true, false}, 2163 {false, false, true, false}, 2164 {true, true, true, false}, 2165 {true, true, true, false}, 2166 2167 /* For Text #30 - $34 */ 2168 {true, false, true, false}, 2169 {true, true, true, false}, 2170 {false, false, true, false}, 2171 {true, false, true, false}, 2172 {true , false, true, false}, 2173 2174 /* For Text #35 - $38 */ 2175 {true, false, true, false}, 2176 {true, false, true, false}, 2177 {true, false, true, false}, 2178 {true, false, true, false}, 2179 }; 2180 2181 /* Golden data for isLeftToRight() & isRightToLeft() results */ 2182 private static boolean[][][] isLTR_isRTL4Constructor2 = { 2183 /* isLeftToRight() results & isRightToLeft() results */ 2184 /* For Text #0 - $4 */ 2185 {{true, true, true, false}, {false, false, false, false}}, 2186 {{false, false, false, false}, {false, false, false, false}}, 2187 {{false, false, false, false}, {false, false, false, false}}, 2188 {{false, false, false, false}, {false, false, false, false}}, 2189 {{false, false, false, false}, {false, false, false, false}}, 2190 2191 /* For Text #5 - $9 */ 2192 {{false, false, false, false}, {true, true, false, true }}, 2193 {{false, false, false, false}, {false, false, false, false}}, 2194 {{false, false, false, false}, {true, true, false, true }}, 2195 {{false, false, false, false}, {false, false, false, false}}, 2196 {{true, true, true, false}, {false, false, false, false}}, 2197 2198 /* For Text #10 - $14 */ 2199 {{false, false, false, false}, {false, false, false, false}}, 2200 {{false, false, false, false}, {false, false, false, false}}, 2201 {{false, false, false, false}, {false, false, false, false}}, 2202 {{false, false, false, false}, {false, false, false, false}}, 2203 {{false, false, false, false}, {false, false, false, false}}, 2204 2205 /* For Text #15 - $19 */ 2206 {{false, false, false, false}, {false, false, false, false}}, 2207 {{false, false, false, false}, {false, false, false, false}}, 2208 {{false, false, false, false}, {false, false, false, false}}, 2209 {{false, false, false, false}, {false, false, false, false}}, 2210 {{false, false, false, false}, {false, false, false, false}}, 2211 2212 /* For Text #20 - $24 */ 2213 {{false, false, false, false}, {false, false, false, false}}, 2214 {{false, false, false, false}, {false, false, false, false}}, 2215 {{false, false, false, false}, {false, false, false, false}}, 2216 {{false, false, false, false}, {false, false, false, false}}, 2217 {{false, false, false, false}, {false, false, false, false}}, 2218 2219 /* For Text #25 - $29 */ 2220 {{false, false, false, false}, {false, false, false, false}}, 2221 {{false, false, false, false}, {false, false, false, false}}, 2222 {{false, false, false, false}, {false, false, false, false}}, 2223 {{false, false, false, false}, {false, false, false, false}}, 2224 {{false, false, false, false}, {false, false, false, false}}, 2225 2226 /* For Text #30 - $34 */ 2227 {{false, false, false, false}, {false, false, false, false}}, 2228 {{false, false, false, false}, {false, false, false, false}}, 2229 {{false, false, false, false}, {false, false, false, false}}, 2230 {{false, false, false, false}, {false, false, false, false}}, 2231 {{false, false, false, false}, {false, false, false, false}}, 2232 2233 /* For Text #35 - $37 */ 2234 {{false, false, false, false}, {false, false, false, false}}, 2235 {{false, false, false, false}, {false, false, false, false}}, 2236 {{false, false, false, false}, {false, false, false, false}}, 2237 {{false, false, false, false}, {false, false, false, false}}, 2238 }; 2239 2240 /* Golden data for requiresBidi() results */ 2241 private static boolean[] requiresBidi4Constructor2 = { 2242 /* For Text #0 - $9 */ 2243 false, true, true, true, true, 2244 true, true, true, true, false, 2245 2246 /* For Text #10 - $19 */ 2247 true, true, true, true, true, 2248 true, true, true, true, true, 2249 2250 /* For Text #20 - $29 */ 2251 true, true, true, true, true, 2252 true, true, true, true, true, 2253 2254 /* For Text #30 - $37 */ 2255 true, true, true, true, true, 2256 true, true, true, true, 2257 }; 2258 2259 /* --------------------------------------------------------------------- */ 2260 2261 /* 2262 * Test data for Bidi(char[], ...) constructor and methods 2263 */ 2264 2265 /* Enbeddings */ 2266 private static byte[][][] emb4Constructor3 = { 2267 /* Embeddings for paragraphs which don't include surrogate pairs. */ 2268 {{0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, 2269 {0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0}, 2270 {0, 0, 0, 0, 0, -3, -3, -3, -3, -3, -3, -3, 0, 0, 0, 0, 0, 0}, 2271 {0, 0, 0, 0, 0, -4, -4, -4, -4, -4, -4, -4, 0, 0, 0, 0, 0, 0}}, 2272 2273 /* Embeddings for paragraphs which include surrogate pairs. */ 2274 {{ 0, 0, 0, 0, 0, 0, 0, 0, 2275 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2276 0, 0, 0, 0, 0, 0, 0, 0, 0}, |