summaryrefslogtreecommitdiffstats
path: root/bower.json
blob: e3e95217b2104c97fb4d94d4ad0e88aa1821ad6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
  "name": "vaadin",
  "description": "Bundle containing all web components which are part of the Vaadin platform",
  "homepage": "https://github.com/vaadin/vaadin",
  "authors": [
    "Vaadin Ltd"
  ],
  "main": "vaadin.html",
  "license": [
    "Apache-2.0",
    "https://vaadin.com/license/cval-3.0"
  ],
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests",
    "update-core-version.js"
  ],
  "dependencies": {
    "cookieconsent": "cookieconsent#3.1.0",
    "vaadin-board": "vaadin/vaadin-board#2.2.2",
    "vaadin-charts": "vaadin/vaadin-charts#6.3.4",
    "vaadin-confirm-dialog": "vaadin/vaadin-confirm-dialog#1.3.1",
    "vaadin-cookie-consent": "vaadin/vaadin-cookie-consent#1.2.1",
    "vaadin-core": "vaadin/vaadin-core#14.11.2",
    "vaadin-crud": "vaadin/vaadin-crud#1.4.0",
    "vaadin-grid-pro": "vaadin/vaadin-grid-pro#2.4.1",
    "vaadin-license-checker": "vaadin/license-checker#2.1.2",
    "vaadin-rich-text-editor": "vaadin/vaadin-rich-text-editor#1.4.0"
  }
}
id='n219' href='#n219'>219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* $Id$ */

package org.apache.fop.complexscripts.fonts;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.apache.fop.complexscripts.scripts.ScriptProcessor;
import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.GlyphTester;

// CSOFF: LineLengthCheck

/**
 * <p>The <code>GlyphPositioningTable</code> class is a glyph table that implements
 * <code>GlyphPositioning</code> functionality.</p>
 *
 * <p>This work was originally authored by Glenn Adams (gadams@apache.org).</p>
 */
public class GlyphPositioningTable extends GlyphTable {

    /** logging instance */
    private static final Log log = LogFactory.getLog(GlyphPositioningTable.class);

    /** single positioning subtable type */
    public static final int GPOS_LOOKUP_TYPE_SINGLE = 1;
    /** multiple positioning subtable type */
    public static final int GPOS_LOOKUP_TYPE_PAIR = 2;
    /** cursive positioning subtable type */
    public static final int GPOS_LOOKUP_TYPE_CURSIVE = 3;
    /** mark to base positioning subtable type */
    public static final int GPOS_LOOKUP_TYPE_MARK_TO_BASE = 4;
    /** mark to ligature positioning subtable type */
    public static final int GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE = 5;
    /** mark to mark positioning subtable type */
    public static final int GPOS_LOOKUP_TYPE_MARK_TO_MARK = 6;
    /** contextual positioning subtable type */
    public static final int GPOS_LOOKUP_TYPE_CONTEXTUAL = 7;
    /** chained contextual positioning subtable type */
    public static final int GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL = 8;
    /** extension positioning subtable type */
    public static final int GPOS_LOOKUP_TYPE_EXTENSION_POSITIONING = 9;

    /**
     * Instantiate a <code>GlyphPositioningTable</code> object using the specified lookups
     * and subtables.
     * @param gdef glyph definition table that applies
     * @param lookups a map of lookup specifications to subtable identifier strings
     * @param subtables a list of identified subtables
     */
    public GlyphPositioningTable(GlyphDefinitionTable gdef, Map lookups, List subtables) {
        super(gdef, lookups);
        if ((subtables == null) || (subtables.size() == 0)) {
            throw new AdvancedTypographicTableFormatException("subtables must be non-empty");
        } else {
            for (Iterator it = subtables.iterator(); it.hasNext();) {
                Object o = it.next();
                if (o instanceof GlyphPositioningSubtable) {
                    addSubtable((GlyphSubtable) o);
                } else {
                    throw new AdvancedTypographicTableFormatException("subtable must be a glyph positioning subtable");
                }
            }
            freezeSubtables();
        }
    }

    /**
     * Map a lookup type name to its constant (integer) value.
     * @param name lookup type name
     * @return lookup type
     */
    public static int getLookupTypeFromName(String name) {
        int t;
        String s = name.toLowerCase();
        if ("single".equals(s)) {
            t = GPOS_LOOKUP_TYPE_SINGLE;
        } else if ("pair".equals(s)) {
            t = GPOS_LOOKUP_TYPE_PAIR;
        } else if ("cursive".equals(s)) {
            t = GPOS_LOOKUP_TYPE_CURSIVE;
        } else if ("marktobase".equals(s)) {
            t = GPOS_LOOKUP_TYPE_MARK_TO_BASE;
        } else if ("marktoligature".equals(s)) {
            t = GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE;
        } else if ("marktomark".equals(s)) {
            t = GPOS_LOOKUP_TYPE_MARK_TO_MARK;
        } else if ("contextual".equals(s)) {
            t = GPOS_LOOKUP_TYPE_CONTEXTUAL;
        } else if ("chainedcontextual".equals(s)) {
            t = GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL;
        } else if ("extensionpositioning".equals(s)) {
            t = GPOS_LOOKUP_TYPE_EXTENSION_POSITIONING;
        } else {
            t = -1;
        }
        return t;
    }

    /**
     * Map a lookup type constant (integer) value to its name.
     * @param type lookup type
     * @return lookup type name
     */
    public static String getLookupTypeName(int type) {
        String tn;
        switch (type) {
        case GPOS_LOOKUP_TYPE_SINGLE:
            tn = "single";
            break;
        case GPOS_LOOKUP_TYPE_PAIR:
            tn = "pair";
            break;
        case GPOS_LOOKUP_TYPE_CURSIVE:
            tn = "cursive";
            break;
        case GPOS_LOOKUP_TYPE_MARK_TO_BASE:
            tn = "marktobase";
            break;
        case GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE:
            tn = "marktoligature";
            break;
        case GPOS_LOOKUP_TYPE_MARK_TO_MARK:
            tn = "marktomark";
            break;
        case GPOS_LOOKUP_TYPE_CONTEXTUAL:
            tn = "contextual";
            break;
        case GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL:
            tn = "chainedcontextual";
            break;
        case GPOS_LOOKUP_TYPE_EXTENSION_POSITIONING:
            tn = "extensionpositioning";
            break;
        default:
            tn = "unknown";
            break;
        }
        return tn;
    }

    /**
     * Create a positioning subtable according to the specified arguments.
     * @param type subtable type
     * @param id subtable identifier
     * @param sequence subtable sequence
     * @param flags subtable flags
     * @param format subtable format
     * @param coverage subtable coverage table
     * @param entries subtable entries
     * @return a glyph subtable instance
     */
    public static GlyphSubtable createSubtable(int type, String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
        GlyphSubtable st = null;
        switch (type) {
        case GPOS_LOOKUP_TYPE_SINGLE:
            st = SingleSubtable.create(id, sequence, flags, format, coverage, entries);
            break;
        case GPOS_LOOKUP_TYPE_PAIR:
            st = PairSubtable.create(id, sequence, flags, format, coverage, entries);
            break;
        case GPOS_LOOKUP_TYPE_CURSIVE:
            st = CursiveSubtable.create(id, sequence, flags, format, coverage, entries);
            break;
        case GPOS_LOOKUP_TYPE_MARK_TO_BASE:
            st = MarkToBaseSubtable.create(id, sequence, flags, format, coverage, entries);
            break;
        case GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE:
            st = MarkToLigatureSubtable.create(id, sequence, flags, format, coverage, entries);
            break;
        case GPOS_LOOKUP_TYPE_MARK_TO_MARK:
            st = MarkToMarkSubtable.create(id, sequence, flags, format, coverage, entries);
            break;
        case GPOS_LOOKUP_TYPE_CONTEXTUAL:
            st = ContextualSubtable.create(id, sequence, flags, format, coverage, entries);
            break;
        case GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL:
            st = ChainedContextualSubtable.create(id, sequence, flags, format, coverage, entries);
            break;
        default:
            break;
        }
        return st;
    }

    /**
     * Create a positioning subtable according to the specified arguments.
     * @param type subtable type
     * @param id subtable identifier
     * @param sequence subtable sequence
     * @param flags subtable flags
     * @param format subtable format
     * @param coverage list of coverage table entries
     * @param entries subtable entries
     * @return a glyph subtable instance
     */
    public static GlyphSubtable createSubtable(int type, String id, int sequence, int flags, int format, List coverage, List entries) {
        return createSubtable(type, id, sequence, flags, format, GlyphCoverageTable.createCoverageTable(coverage), entries);
    }

    /**
     * Perform positioning processing using all matching lookups.
     * @param gs an input glyph sequence
     * @param script a script identifier
     * @param language a language identifier
     * @param fontSize size in device units
     * @param widths array of default advancements for each glyph
     * @param adjustments accumulated adjustments array (sequence) of 4-tuples of placement [PX,PY] and advance [AX,AY] adjustments, in that order,
     * with one 4-tuple for each element of glyph sequence
     * @return true if some adjustment is not zero; otherwise, false
     */
    public boolean position(GlyphSequence gs, String script, String language, int fontSize, int[] widths, int[][] adjustments) {
        Map/*<LookupSpec,List<LookupTable>>*/ lookups = matchLookups(script, language, "*");
        if ((lookups != null) && (lookups.size() > 0)) {
            ScriptProcessor sp = ScriptProcessor.getInstance(script);
            return sp.position(this, gs, script, language, fontSize, lookups, widths, adjustments);
        } else {
            return false;
        }
    }

    private abstract static class SingleSubtable extends GlyphPositioningSubtable {
        SingleSubtable(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage);
        }
        /** {@inheritDoc} */
        public int getType() {
            return GPOS_LOOKUP_TYPE_SINGLE;
        }
        /** {@inheritDoc} */
        public boolean isCompatible(GlyphSubtable subtable) {
            return subtable instanceof SingleSubtable;
        }
        /** {@inheritDoc} */
        public boolean position(GlyphPositioningState ps) {
            int gi = ps.getGlyph();
            int ci;
            if ((ci = getCoverageIndex(gi)) < 0) {
                return false;
            } else {
                Value v = getValue(ci, gi);
                if (v != null) {
                    if (ps.adjust(v)) {
                        ps.setAdjusted(true);
                    }
                    ps.consume(1);
                }
                return true;
            }
        }
        /**
         * Obtain positioning value for coverage index.
         * @param ci coverage index
         * @param gi input glyph index
         * @return positioning value or null if none applies
         */
        public abstract Value getValue(int ci, int gi);
        static GlyphPositioningSubtable create(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            if (format == 1) {
                return new SingleSubtableFormat1(id, sequence, flags, format, coverage, entries);
            } else if (format == 2) {
                return new SingleSubtableFormat2(id, sequence, flags, format, coverage, entries);
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }

    private static class SingleSubtableFormat1 extends SingleSubtable {
        private Value value;
        private int ciMax;
        SingleSubtableFormat1(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (value != null) {
                List entries = new ArrayList(1);
                entries.add(value);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public Value getValue(int ci, int gi) {
            if ((value != null) && (ci <= ciMax)) {
                return value;
            } else {
                return null;
            }
        }
        private void populate(List entries) {
            if ((entries == null) || (entries.size() != 1)) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null and contain exactly one entry");
            } else {
                Value v;
                Object o = entries.get(0);
                if (o instanceof Value) {
                    v = (Value) o;
                } else {
                    throw new AdvancedTypographicTableFormatException("illegal entries entry, must be Value, but is: " + ((o != null) ? o.getClass() : null));
                }
                assert this.value == null;
                this.value = v;
                this.ciMax = getCoverageSize() - 1;
            }
        }
    }

    private static class SingleSubtableFormat2 extends SingleSubtable {
        private Value[] values;
        SingleSubtableFormat2(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (values != null) {
                List entries = new ArrayList(values.length);
                for (int i = 0, n = values.length; i < n; i++) {
                    entries.add(values[i]);
                }
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public Value getValue(int ci, int gi) {
            if ((values != null) && (ci < values.length)) {
                return values [ ci ];
            } else {
                return null;
            }
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 1) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof Value[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, single entry must be a Value[], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    Value[] va = (Value[]) o;
                    if (va.length != getCoverageSize()) {
                        throw new AdvancedTypographicTableFormatException("illegal values array, " + entries.size() + " values present, but requires " + getCoverageSize() + " values");
                    } else {
                        assert this.values == null;
                        this.values = va;
                    }
                }
            }
        }
    }

    private abstract static class PairSubtable extends GlyphPositioningSubtable {
        PairSubtable(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage);
        }
        /** {@inheritDoc} */
        public int getType() {
            return GPOS_LOOKUP_TYPE_PAIR;
        }
        /** {@inheritDoc} */
        public boolean isCompatible(GlyphSubtable subtable) {
            return subtable instanceof PairSubtable;
        }
        /** {@inheritDoc} */
        public boolean position(GlyphPositioningState ps) {
            boolean applied = false;
            int gi = ps.getGlyph(0);
            int ci;
            if ((ci = getCoverageIndex(gi)) >= 0) {
                int[] counts = ps.getGlyphsAvailable(0);
                int nga = counts[0];
                if (nga > 1) {
                    int[] iga = ps.getGlyphs(0, 2, null, counts);
                    if ((iga != null) && (iga.length == 2)) {
                        PairValues pv = getPairValues(ci, iga[0], iga[1]);
                        if (pv != null) {
                            int offset = 0;
                            int offsetLast = counts[0] + counts[1];
                            // skip any ignored glyphs prior to first non-ignored glyph
                            for ( ; offset < offsetLast; ++offset) {
                                if (!ps.isIgnoredGlyph(offset)) {
                                    break;
                                } else {
                                    ps.consume(1);
                                }
                            }
                            // adjust first non-ignored glyph if first value isn't null
                            Value v1 = pv.getValue1();
                            if (v1 != null) {
                                if (ps.adjust(v1, offset)) {
                                    ps.setAdjusted(true);
                                }
                                ps.consume(1);          // consume first non-ignored glyph
                                ++offset;
                            }
                            // skip any ignored glyphs prior to second non-ignored glyph
                            for ( ; offset < offsetLast; ++offset) {
                                if (!ps.isIgnoredGlyph(offset)) {
                                    break;
                                } else {
                                    ps.consume(1);
                                }
                            }
                            // adjust second non-ignored glyph if second value isn't null
                            Value v2 = pv.getValue2();
                            if (v2 != null) {
                                if (ps.adjust(v2, offset)) {
                                    ps.setAdjusted(true);
                                }
                                ps.consume(1);          // consume second non-ignored glyph
                                ++offset;
                            }
                            applied = true;
                        }
                    }
                }
            }
            return applied;
        }
        /**
         * Obtain associated pair values.
         * @param ci coverage index
         * @param gi1 first input glyph index
         * @param gi2 second input glyph index
         * @return pair values or null if none applies
         */
        public abstract PairValues getPairValues(int ci, int gi1, int gi2);
        static GlyphPositioningSubtable create(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            if (format == 1) {
                return new PairSubtableFormat1(id, sequence, flags, format, coverage, entries);
            } else if (format == 2) {
                return new PairSubtableFormat2(id, sequence, flags, format, coverage, entries);
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }

    private static class PairSubtableFormat1 extends PairSubtable {
        private PairValues[][] pvm;                     // pair values matrix
        PairSubtableFormat1(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (pvm != null) {
                List entries = new ArrayList(1);
                entries.add(pvm);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public PairValues getPairValues(int ci, int gi1, int gi2) {
            if ((pvm != null) && (ci < pvm.length)) {
                PairValues[] pvt = pvm [ ci ];
                for (int i = 0, n = pvt.length; i < n; i++) {
                    PairValues pv = pvt [ i ];
                    if (pv != null) {
                        int g = pv.getGlyph();
                        if (g < gi2) {
                            continue;
                        } else if (g == gi2) {
                            return pv;
                        } else {
                            break;
                        }
                    }
                }
            }
            return null;
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 1) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof PairValues[][])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first (and only) entry must be a PairValues[][], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    pvm = (PairValues[][]) o;
                }
            }
        }
    }

    private static class PairSubtableFormat2 extends PairSubtable {
        private GlyphClassTable cdt1;                   // class def table 1
        private GlyphClassTable cdt2;                   // class def table 2
        private int nc1;                                // class 1 count
        private int nc2;                                // class 2 count
        private PairValues[][] pvm;                     // pair values matrix
        PairSubtableFormat2(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (pvm != null) {
                List entries = new ArrayList(5);
                entries.add(cdt1);
                entries.add(cdt2);
                entries.add(Integer.valueOf(nc1));
                entries.add(Integer.valueOf(nc2));
                entries.add(pvm);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public PairValues getPairValues(int ci, int gi1, int gi2) {
            if (pvm != null) {
                int c1 = cdt1.getClassIndex(gi1, 0);
                if ((c1 >= 0) && (c1 < nc1) && (c1 < pvm.length)) {
                    PairValues[] pvt = pvm [ c1 ];
                    if (pvt != null) {
                        int c2 = cdt2.getClassIndex(gi2, 0);
                        if ((c2 >= 0) && (c2 < nc2) && (c2 < pvt.length)) {
                            return pvt [ c2 ];
                        }
                    }
                }
            }
            return null;
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 5) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 5 entries");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof GlyphClassTable)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    cdt1 = (GlyphClassTable) o;
                }
                if (((o = entries.get(1)) == null) || !(o instanceof GlyphClassTable)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    cdt2 = (GlyphClassTable) o;
                }
                if (((o = entries.get(2)) == null) || !(o instanceof Integer)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    nc1 = ((Integer)(o)).intValue();
                }
                if (((o = entries.get(3)) == null) || !(o instanceof Integer)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    nc2 = ((Integer)(o)).intValue();
                }
                if (((o = entries.get(4)) == null) || !(o instanceof PairValues[][])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, fifth entry must be a PairValues[][], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    pvm = (PairValues[][]) o;
                }
            }
        }
    }

    private abstract static class CursiveSubtable extends GlyphPositioningSubtable {
        CursiveSubtable(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage);
        }
        /** {@inheritDoc} */
        public int getType() {
            return GPOS_LOOKUP_TYPE_CURSIVE;
        }
        /** {@inheritDoc} */
        public boolean isCompatible(GlyphSubtable subtable) {
            return subtable instanceof CursiveSubtable;
        }
        /** {@inheritDoc} */
        public boolean position(GlyphPositioningState ps) {
            boolean applied = false;
            int gi = ps.getGlyph(0);
            int ci;
            if ((ci = getCoverageIndex(gi)) >= 0) {
                int[] counts = ps.getGlyphsAvailable(0);
                int nga = counts[0];
                if (nga > 1) {
                    int[] iga = ps.getGlyphs(0, 2, null, counts);
                    if ((iga != null) && (iga.length == 2)) {
                        // int gi1 = gi;
                        int ci1 = ci;
                        int gi2 = iga [ 1 ];
                        int ci2 = getCoverageIndex(gi2);
                        Anchor[] aa = getExitEntryAnchors(ci1, ci2);
                        if (aa != null) {
                            Anchor exa = aa [ 0 ];
                            Anchor ena = aa [ 1 ];
                            // int exw = ps.getWidth ( gi1 );
                            int enw = ps.getWidth(gi2);
                            if ((exa != null) && (ena != null)) {
                                Value v = ena.getAlignmentAdjustment(exa);
                                v.adjust(-enw, 0, 0, 0);
                                if (ps.adjust(v)) {
                                    ps.setAdjusted(true);
                                }
                            }
                            // consume only first glyph of exit/entry glyph pair
                            ps.consume(1);
                            applied = true;
                        }
                    }
                }
            }
            return applied;
        }
        /**
         * Obtain exit anchor for first glyph with coverage index <code>ci1</code> and entry anchor for second
         * glyph with coverage index <code>ci2</code>.
         * @param ci1 coverage index of first glyph (may be negative)
         * @param ci2 coverage index of second glyph (may be negative)
         * @return array of two anchors or null if either coverage index is negative or corresponding anchor is
         * missing, where the first entry is the exit anchor of the first glyph and the second entry is the
         * entry anchor of the second glyph
         */
        public abstract Anchor[] getExitEntryAnchors(int ci1, int ci2);
        static GlyphPositioningSubtable create(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            if (format == 1) {
                return new CursiveSubtableFormat1(id, sequence, flags, format, coverage, entries);
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }

    private static class CursiveSubtableFormat1 extends CursiveSubtable {
        private Anchor[] aa;                            // anchor array, where even entries are entry anchors, and odd entries are exit anchors
        CursiveSubtableFormat1(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (aa != null) {
                List entries = new ArrayList(1);
                entries.add(aa);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public Anchor[] getExitEntryAnchors(int ci1, int ci2) {
            if ((ci1 >= 0) && (ci2 >= 0)) {
                int ai1 = (ci1 * 2) + 1; // ci1 denotes glyph with exit anchor
                int ai2 = (ci2 * 2) + 0; // ci2 denotes glyph with entry anchor
                if ((aa != null) && (ai1 < aa.length) && (ai2 < aa.length)) {
                    Anchor exa = aa [ ai1 ];
                    Anchor ena = aa [ ai2 ];
                    if ((exa != null) && (ena != null)) {
                        return new Anchor[] { exa, ena };
                    }
                }
            }
            return null;
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 1) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof Anchor[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first (and only) entry must be a Anchor[], but is: " + ((o != null) ? o.getClass() : null));
                } else if ((((Anchor[]) o) .length % 2) != 0) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, Anchor[] array must have an even number of entries, but has: " + ((Anchor[]) o) .length);
                } else {
                    aa = (Anchor[]) o;
                }
            }
        }
    }

    private abstract static class MarkToBaseSubtable extends GlyphPositioningSubtable {
        MarkToBaseSubtable(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage);
        }
        /** {@inheritDoc} */
        public int getType() {
            return GPOS_LOOKUP_TYPE_MARK_TO_BASE;
        }
        /** {@inheritDoc} */
        public boolean isCompatible(GlyphSubtable subtable) {
            return subtable instanceof MarkToBaseSubtable;
        }
        /** {@inheritDoc} */
        public boolean position(GlyphPositioningState ps) {
            boolean applied = false;
            int giMark = ps.getGlyph();
            int ciMark;
            if ((ciMark = getCoverageIndex(giMark)) >= 0) {
                MarkAnchor ma = getMarkAnchor(ciMark, giMark);
                if (ma != null) {
                    for (int i = 0, n = ps.getPosition(); i < n; i++) {
                        int gi = ps.getGlyph(-(i + 1));
                        if (ps.isMark(gi)) {
                            continue;
                        } else {
                            Anchor a = getBaseAnchor(gi, ma.getMarkClass());
                            if (a != null) {
                                Value v = a.getAlignmentAdjustment(ma);
                                // start experimental fix for END OF AYAH in Lateef/Scheherazade
                                int[] aa = ps.getAdjustment();
                                if (aa[2] == 0) {
                                    v.adjust(0, 0, -ps.getWidth(giMark), 0);
                                }
                                // end experimental fix for END OF AYAH in Lateef/Scheherazade
                                if (ps.adjust(v)) {
                                    ps.setAdjusted(true);
                                }
                            }
                            ps.consume(1);
                            applied = true;
                            break;
                        }
                    }
                }
            }
            return applied;
        }
        /**
         * Obtain mark anchor associated with mark coverage index.
         * @param ciMark coverage index
         * @param giMark input glyph index of mark glyph
         * @return mark anchor or null if none applies
         */
        public abstract MarkAnchor getMarkAnchor(int ciMark, int giMark);
        /**
         * Obtain anchor associated with base glyph index and mark class.
         * @param giBase input glyph index of base glyph
         * @param markClass class number of mark glyph
         * @return anchor or null if none applies
         */
        public abstract Anchor getBaseAnchor(int giBase, int markClass);
        static GlyphPositioningSubtable create(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            if (format == 1) {
                return new MarkToBaseSubtableFormat1(id, sequence, flags, format, coverage, entries);
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }

    private static class MarkToBaseSubtableFormat1 extends MarkToBaseSubtable {
        private GlyphCoverageTable bct;                 // base coverage table
        private int nmc;                                // mark class count
        private MarkAnchor[] maa;                       // mark anchor array, ordered by mark coverage index
        private Anchor[][] bam;                         // base anchor matrix, ordered by base coverage index, then by mark class
        MarkToBaseSubtableFormat1(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if ((bct != null) && (maa != null) && (nmc > 0) && (bam != null)) {
                List entries = new ArrayList(4);
                entries.add(bct);
                entries.add(Integer.valueOf(nmc));
                entries.add(maa);
                entries.add(bam);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public MarkAnchor getMarkAnchor(int ciMark, int giMark) {
            if ((maa != null) && (ciMark < maa.length)) {
                return maa [ ciMark ];
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public Anchor getBaseAnchor(int giBase, int markClass) {
            int ciBase;
            if ((bct != null) && ((ciBase = bct.getCoverageIndex(giBase)) >= 0)) {
                if ((bam != null) && (ciBase < bam.length)) {
                    Anchor[] ba = bam [ ciBase ];
                    if ((ba != null) && (markClass < ba.length)) {
                        return ba [ markClass ];
                    }
                }
            }
            return null;
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 4) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 4 entries");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof GlyphCoverageTable)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphCoverageTable, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    bct = (GlyphCoverageTable) o;
                }
                if (((o = entries.get(1)) == null) || !(o instanceof Integer)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    nmc = ((Integer)(o)).intValue();
                }
                if (((o = entries.get(2)) == null) || !(o instanceof MarkAnchor[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be a MarkAnchor[], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    maa = (MarkAnchor[]) o;
                }
                if (((o = entries.get(3)) == null) || !(o instanceof Anchor[][])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be a Anchor[][], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    bam = (Anchor[][]) o;
                }
            }
        }
    }

    private abstract static class MarkToLigatureSubtable extends GlyphPositioningSubtable {
        MarkToLigatureSubtable(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage);
        }
        /** {@inheritDoc} */
        public int getType() {
            return GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE;
        }
        /** {@inheritDoc} */
        public boolean isCompatible(GlyphSubtable subtable) {
            return subtable instanceof MarkToLigatureSubtable;
        }
        /** {@inheritDoc} */
        public boolean position(GlyphPositioningState ps) {
            boolean applied = false;
            int giMark = ps.getGlyph();
            int ciMark;
            if ((ciMark = getCoverageIndex(giMark)) >= 0) {
                MarkAnchor ma = getMarkAnchor(ciMark, giMark);
                int mxc = getMaxComponentCount();
                if (ma != null) {
                    for (int i = 0, n = ps.getPosition(); i < n; i++) {
                        int gi = ps.getGlyph(-(i + 1));
                        if (ps.isMark(gi)) {
                            continue;
                        } else {
                            Anchor a = getLigatureAnchor(gi, mxc, i, ma.getMarkClass());
                            if (a != null) {
                                if (ps.adjust(a.getAlignmentAdjustment(ma))) {
                                    ps.setAdjusted(true);
                                }
                            }
                            ps.consume(1);
                            applied = true;
                            break;
                        }
                    }
                }
            }
            return applied;
        }
        /**
         * Obtain mark anchor associated with mark coverage index.
         * @param ciMark coverage index
         * @param giMark input glyph index of mark glyph
         * @return mark anchor or null if none applies
         */
        public abstract MarkAnchor getMarkAnchor(int ciMark, int giMark);
        /**
         * Obtain maximum component count.
         * @return maximum component count (>=0)
         */
        public abstract int getMaxComponentCount();
        /**
         * Obtain anchor associated with ligature glyph index and mark class.
         * @param giLig input glyph index of ligature glyph
         * @param maxComponents maximum component count
         * @param component component number (0...maxComponents-1)
         * @param markClass class number of mark glyph
         * @return anchor or null if none applies
         */
        public abstract Anchor getLigatureAnchor(int giLig, int maxComponents, int component, int markClass);
        static GlyphPositioningSubtable create(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            if (format == 1) {
                return new MarkToLigatureSubtableFormat1(id, sequence, flags, format, coverage, entries);
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }

    private static class MarkToLigatureSubtableFormat1 extends MarkToLigatureSubtable {
        private GlyphCoverageTable lct;                 // ligature coverage table
        private int nmc;                                // mark class count
        private int mxc;                                // maximum ligature component count
        private MarkAnchor[] maa;                       // mark anchor array, ordered by mark coverage index
        private Anchor[][][] lam;                       // ligature anchor matrix, ordered by ligature coverage index, then ligature component, then mark class
        MarkToLigatureSubtableFormat1(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (lam != null) {
                List entries = new ArrayList(5);
                entries.add(lct);
                entries.add(Integer.valueOf(nmc));
                entries.add(Integer.valueOf(mxc));
                entries.add(maa);
                entries.add(lam);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public MarkAnchor getMarkAnchor(int ciMark, int giMark) {
            if ((maa != null) && (ciMark < maa.length)) {
                return maa [ ciMark ];
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public int getMaxComponentCount() {
            return mxc;
        }
        /** {@inheritDoc} */
        public Anchor getLigatureAnchor(int giLig, int maxComponents, int component, int markClass) {
            int ciLig;
            if ((lct != null) && ((ciLig = lct.getCoverageIndex(giLig)) >= 0)) {
                if ((lam != null) && (ciLig < lam.length)) {
                    Anchor[][] lcm = lam [ ciLig ];
                    if (component < maxComponents) {
                        Anchor[] la = lcm [ component ];
                        if ((la != null) && (markClass < la.length)) {
                            return la [ markClass ];
                        }
                    }
                }
            }
            return null;
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 5) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 5 entries");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof GlyphCoverageTable)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphCoverageTable, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    lct = (GlyphCoverageTable) o;
                }
                if (((o = entries.get(1)) == null) || !(o instanceof Integer)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    nmc = ((Integer)(o)).intValue();
                }
                if (((o = entries.get(2)) == null) || !(o instanceof Integer)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    mxc = ((Integer)(o)).intValue();
                }
                if (((o = entries.get(3)) == null) || !(o instanceof MarkAnchor[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be a MarkAnchor[], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    maa = (MarkAnchor[]) o;
                }
                if (((o = entries.get(4)) == null) || !(o instanceof Anchor[][][])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, fifth entry must be a Anchor[][][], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    lam = (Anchor[][][]) o;
                }
            }
        }
    }

    private abstract static class MarkToMarkSubtable extends GlyphPositioningSubtable {
        MarkToMarkSubtable(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage);
        }
        /** {@inheritDoc} */
        public int getType() {
            return GPOS_LOOKUP_TYPE_MARK_TO_MARK;
        }
        /** {@inheritDoc} */
        public boolean isCompatible(GlyphSubtable subtable) {
            return subtable instanceof MarkToMarkSubtable;
        }
        /** {@inheritDoc} */
        public boolean position(GlyphPositioningState ps) {
            boolean applied = false;
            int giMark1 = ps.getGlyph();
            int ciMark1;
            if ((ciMark1 = getCoverageIndex(giMark1)) >= 0) {
                MarkAnchor ma = getMark1Anchor(ciMark1, giMark1);
                if (ma != null) {
                    if (ps.hasPrev()) {
                        Anchor a = getMark2Anchor(ps.getGlyph(-1), ma.getMarkClass());
                        if (a != null) {
                            if (ps.adjust(a.getAlignmentAdjustment(ma))) {
                                ps.setAdjusted(true);
                            }
                        }
                        ps.consume(1);
                        applied = true;
                    }
                }
            }
            return applied;
        }
        /**
         * Obtain mark 1 anchor associated with mark 1 coverage index.
         * @param ciMark1 mark 1 coverage index
         * @param giMark1 input glyph index of mark 1 glyph
         * @return mark 1 anchor or null if none applies
         */
        public abstract MarkAnchor getMark1Anchor(int ciMark1, int giMark1);
        /**
         * Obtain anchor associated with mark 2 glyph index and mark 1 class.
         * @param giMark2 input glyph index of mark 2 glyph
         * @param markClass class number of mark 1 glyph
         * @return anchor or null if none applies
         */
        public abstract Anchor getMark2Anchor(int giBase, int markClass);
        static GlyphPositioningSubtable create(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            if (format == 1) {
                return new MarkToMarkSubtableFormat1(id, sequence, flags, format, coverage, entries);
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }

    private static class MarkToMarkSubtableFormat1 extends MarkToMarkSubtable {
        private GlyphCoverageTable mct2;                // mark 2 coverage table
        private int nmc;                                // mark class count
        private MarkAnchor[] maa;                       // mark1 anchor array, ordered by mark1 coverage index
        private Anchor[][] mam;                         // mark2 anchor matrix, ordered by mark2 coverage index, then by mark1 class
        MarkToMarkSubtableFormat1(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if ((mct2 != null) && (maa != null) && (nmc > 0) && (mam != null)) {
                List entries = new ArrayList(4);
                entries.add(mct2);
                entries.add(Integer.valueOf(nmc));
                entries.add(maa);
                entries.add(mam);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public MarkAnchor getMark1Anchor(int ciMark1, int giMark1) {
            if ((maa != null) && (ciMark1 < maa.length)) {
                return maa [ ciMark1 ];
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public Anchor getMark2Anchor(int giMark2, int markClass) {
            int ciMark2;
            if ((mct2 != null) && ((ciMark2 = mct2.getCoverageIndex(giMark2)) >= 0)) {
                if ((mam != null) && (ciMark2 < mam.length)) {
                    Anchor[] ma = mam [ ciMark2 ];
                    if ((ma != null) && (markClass < ma.length)) {
                        return ma [ markClass ];
                    }
                }
            }
            return null;
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 4) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 4 entries");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof GlyphCoverageTable)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphCoverageTable, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    mct2 = (GlyphCoverageTable) o;
                }
                if (((o = entries.get(1)) == null) || !(o instanceof Integer)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    nmc = ((Integer)(o)).intValue();
                }
                if (((o = entries.get(2)) == null) || !(o instanceof MarkAnchor[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be a MarkAnchor[], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    maa = (MarkAnchor[]) o;
                }
                if (((o = entries.get(3)) == null) || !(o instanceof Anchor[][])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be a Anchor[][], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    mam = (Anchor[][]) o;
                }
            }
        }
    }

    private abstract static class ContextualSubtable extends GlyphPositioningSubtable {
        ContextualSubtable(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage);
        }
        /** {@inheritDoc} */
        public int getType() {
            return GPOS_LOOKUP_TYPE_CONTEXTUAL;
        }
        /** {@inheritDoc} */
        public boolean isCompatible(GlyphSubtable subtable) {
            return subtable instanceof ContextualSubtable;
        }
        /** {@inheritDoc} */
        public boolean position(GlyphPositioningState ps) {
            boolean applied = false;
            int gi = ps.getGlyph();
            int ci;
            if ((ci = getCoverageIndex(gi)) >= 0) {
                int[] rv = new int[1];
                RuleLookup[] la = getLookups(ci, gi, ps, rv);
                if (la != null) {
                    ps.apply(la, rv[0]);
                    applied = true;
                }
            }
            return applied;
        }
        /**
         * Obtain rule lookups set associated current input glyph context.
         * @param ci coverage index of glyph at current position
         * @param gi glyph index of glyph at current position
         * @param ps glyph positioning state
         * @param rv array of ints used to receive multiple return values, must be of length 1 or greater,
         * where the first entry is used to return the input sequence length of the matched rule
         * @return array of rule lookups or null if none applies
         */
        public abstract RuleLookup[] getLookups(int ci, int gi, GlyphPositioningState ps, int[] rv);
        static GlyphPositioningSubtable create(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            if (format == 1) {
                return new ContextualSubtableFormat1(id, sequence, flags, format, coverage, entries);
            } else if (format == 2) {
                return new ContextualSubtableFormat2(id, sequence, flags, format, coverage, entries);
            } else if (format == 3) {
                return new ContextualSubtableFormat3(id, sequence, flags, format, coverage, entries);
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }

    private static class ContextualSubtableFormat1 extends ContextualSubtable {
        private RuleSet[] rsa;                          // rule set array, ordered by glyph coverage index
        ContextualSubtableFormat1(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (rsa != null) {
                List entries = new ArrayList(1);
                entries.add(rsa);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public void resolveLookupReferences(Map/*<String,LookupTable>*/ lookupTables) {
            GlyphTable.resolveLookupReferences(rsa, lookupTables);
        }
        /** {@inheritDoc} */
        public RuleLookup[] getLookups(int ci, int gi, GlyphPositioningState ps, int[] rv) {
            assert ps != null;
            assert (rv != null) && (rv.length > 0);
            assert rsa != null;
            if (rsa.length > 0) {
                RuleSet rs = rsa [ 0 ];
                if (rs != null) {
                    Rule[] ra = rs.getRules();
                    for (int i = 0, n = ra.length; i < n; i++) {
                        Rule r = ra [ i ];
                        if ((r != null) && (r instanceof ChainedGlyphSequenceRule)) {
                            ChainedGlyphSequenceRule cr = (ChainedGlyphSequenceRule) r;
                            int[] iga = cr.getGlyphs(gi);
                            if (matches(ps, iga, 0, rv)) {
                                return r.getLookups();
                            }
                        }
                    }
                }
            }
            return null;
        }
        static boolean matches(GlyphPositioningState ps, int[] glyphs, int offset, int[] rv) {
            if ((glyphs == null) || (glyphs.length == 0)) {
                return true;                            // match null or empty glyph sequence
            } else {
                boolean reverse = offset < 0;
                GlyphTester ignores = ps.getIgnoreDefault();
                int[] counts = ps.getGlyphsAvailable(offset, reverse, ignores);
                int nga = counts[0];
                int ngm = glyphs.length;
                if (nga < ngm) {
                    return false;                       // insufficient glyphs available to match
                } else {
                    int[] ga = ps.getGlyphs(offset, ngm, reverse, ignores, null, counts);
                    for (int k = 0; k < ngm; k++) {
                        if (ga [ k ] != glyphs [ k ]) {
                            return false;               // match fails at ga [ k ]
                        }
                    }
                    if (rv != null) {
                        rv[0] = counts[0] + counts[1];
                    }
                    return true;                        // all glyphs match
                }
            }
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 1) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    rsa = (RuleSet[]) o;
                }
            }
        }
    }

    private static class ContextualSubtableFormat2 extends ContextualSubtable {
        private GlyphClassTable cdt;                    // class def table
        private int ngc;                                // class set count
        private RuleSet[] rsa;                          // rule set array, ordered by class number [0...ngc - 1]
        ContextualSubtableFormat2(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (rsa != null) {
                List entries = new ArrayList(3);
                entries.add(cdt);
                entries.add(Integer.valueOf(ngc));
                entries.add(rsa);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public void resolveLookupReferences(Map/*<String,LookupTable>*/ lookupTables) {
            GlyphTable.resolveLookupReferences(rsa, lookupTables);
        }
        /** {@inheritDoc} */
        public RuleLookup[] getLookups(int ci, int gi, GlyphPositioningState ps, int[] rv) {
            assert ps != null;
            assert (rv != null) && (rv.length > 0);
            assert rsa != null;
            if (rsa.length > 0) {
                RuleSet rs = rsa [ 0 ];
                if (rs != null) {
                    Rule[] ra = rs.getRules();
                    for (int i = 0, n = ra.length; i < n; i++) {
                        Rule r = ra [ i ];
                        if ((r != null) && (r instanceof ChainedClassSequenceRule)) {
                            ChainedClassSequenceRule cr = (ChainedClassSequenceRule) r;
                            int[] ca = cr.getClasses(cdt.getClassIndex(gi, ps.getClassMatchSet(gi)));
                            if (matches(ps, cdt, ca, 0, rv)) {
                                return r.getLookups();
                            }
                        }
                    }
                }
            }
            return null;
        }
        static boolean matches(GlyphPositioningState ps, GlyphClassTable cdt, int[] classes, int offset, int[] rv) {
            if ((cdt == null) || (classes == null) || (classes.length == 0)) {
                return true;                            // match null class definitions, null or empty class sequence
            } else {
                boolean reverse = offset < 0;
                GlyphTester ignores = ps.getIgnoreDefault();
                int[] counts = ps.getGlyphsAvailable(offset, reverse, ignores);
                int nga = counts[0];
                int ngm = classes.length;
                if (nga < ngm) {
                    return false;                       // insufficient glyphs available to match
                } else {
                    int[] ga = ps.getGlyphs(offset, ngm, reverse, ignores, null, counts);
                    for (int k = 0; k < ngm; k++) {
                        int gi = ga [ k ];
                        int ms = ps.getClassMatchSet(gi);
                        int gc = cdt.getClassIndex(gi, ms);
                        if ((gc < 0) || (gc >= cdt.getClassSize(ms))) {
                            return false;               // none or invalid class fails mat ch
                        } else if (gc != classes [ k ]) {
                            return false;               // match fails at ga [ k ]
                        }
                    }
                    if (rv != null) {
                        rv[0] = counts[0] + counts[1];
                    }
                    return true;                        // all glyphs match
                }
            }
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 3) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 3 entries");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof GlyphClassTable)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    cdt = (GlyphClassTable) o;
                }
                if (((o = entries.get(1)) == null) || !(o instanceof Integer)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    ngc = ((Integer)(o)).intValue();
                }
                if (((o = entries.get(2)) == null) || !(o instanceof RuleSet[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    rsa = (RuleSet[]) o;
                    if (rsa.length != ngc) {
                        throw new AdvancedTypographicTableFormatException("illegal entries, RuleSet[] length is " + rsa.length + ", but expected " + ngc + " glyph classes");
                    }
                }
            }
        }
    }

    private static class ContextualSubtableFormat3 extends ContextualSubtable {
        private RuleSet[] rsa;                          // rule set array, containing a single rule set
        ContextualSubtableFormat3(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (rsa != null) {
                List entries = new ArrayList(1);
                entries.add(rsa);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public void resolveLookupReferences(Map/*<String,LookupTable>*/ lookupTables) {
            GlyphTable.resolveLookupReferences(rsa, lookupTables);
        }
        /** {@inheritDoc} */
        public RuleLookup[] getLookups(int ci, int gi, GlyphPositioningState ps, int[] rv) {
            assert ps != null;
            assert (rv != null) && (rv.length > 0);
            assert rsa != null;
            if (rsa.length > 0) {
                RuleSet rs = rsa [ 0 ];
                if (rs != null) {
                    Rule[] ra = rs.getRules();
                    for (int i = 0, n = ra.length; i < n; i++) {
                        Rule r = ra [ i ];
                        if ((r != null) && (r instanceof ChainedCoverageSequenceRule)) {
                            ChainedCoverageSequenceRule cr = (ChainedCoverageSequenceRule) r;
                            GlyphCoverageTable[] gca = cr.getCoverages();
                            if (matches(ps, gca, 0, rv)) {
                                return r.getLookups();
                            }
                        }
                    }
                }
            }
            return null;
        }
        static boolean matches(GlyphPositioningState ps, GlyphCoverageTable[] gca, int offset, int[] rv) {
            if ((gca == null) || (gca.length == 0)) {
                return true;                            // match null or empty coverage array
            } else {
                boolean reverse = offset < 0;
                GlyphTester ignores = ps.getIgnoreDefault();
                int[] counts = ps.getGlyphsAvailable(offset, reverse, ignores);
                int nga = counts[0];
                int ngm = gca.length;
                if (nga < ngm) {
                    return false;                       // insufficient glyphs available to match
                } else {
                    int[] ga = ps.getGlyphs(offset, ngm, reverse, ignores, null, counts);
                    for (int k = 0; k < ngm; k++) {
                        GlyphCoverageTable ct = gca [ k ];
                        if (ct != null) {
                            if (ct.getCoverageIndex(ga [ k ]) < 0) {
                                return false;           // match fails at ga [ k ]
                            }
                        }
                    }
                    if (rv != null) {
                        rv[0] = counts[0] + counts[1];
                    }
                    return true;                        // all glyphs match
                }
            }
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 1) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    rsa = (RuleSet[]) o;
                }
            }
        }
    }

    private abstract static class ChainedContextualSubtable extends GlyphPositioningSubtable {
        ChainedContextualSubtable(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage);
        }
        /** {@inheritDoc} */
        public int getType() {
            return GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL;
        }
        /** {@inheritDoc} */
        public boolean isCompatible(GlyphSubtable subtable) {
            return subtable instanceof ChainedContextualSubtable;
        }
        /** {@inheritDoc} */
        public boolean position(GlyphPositioningState ps) {
            boolean applied = false;
            int gi = ps.getGlyph();
            int ci;
            if ((ci = getCoverageIndex(gi)) >= 0) {
                int[] rv = new int[1];
                RuleLookup[] la = getLookups(ci, gi, ps, rv);
                if (la != null) {
                    ps.apply(la, rv[0]);
                    applied = true;
                }
            }
            return applied;
        }
        /**
         * Obtain rule lookups set associated current input glyph context.
         * @param ci coverage index of glyph at current position
         * @param gi glyph index of glyph at current position
         * @param ps glyph positioning state
         * @param rv array of ints used to receive multiple return values, must be of length 1 or greater,
         * where the first entry is used to return the input sequence length of the matched rule
         * @return array of rule lookups or null if none applies
         */
        public abstract RuleLookup[] getLookups(int ci, int gi, GlyphPositioningState ps, int[] rv);
        static GlyphPositioningSubtable create(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            if (format == 1) {
                return new ChainedContextualSubtableFormat1(id, sequence, flags, format, coverage, entries);
            } else if (format == 2) {
                return new ChainedContextualSubtableFormat2(id, sequence, flags, format, coverage, entries);
            } else if (format == 3) {
                return new ChainedContextualSubtableFormat3(id, sequence, flags, format, coverage, entries);
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }

    private static class ChainedContextualSubtableFormat1 extends ChainedContextualSubtable {
        private RuleSet[] rsa;                          // rule set array, ordered by glyph coverage index
        ChainedContextualSubtableFormat1(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (rsa != null) {
                List entries = new ArrayList(1);
                entries.add(rsa);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public void resolveLookupReferences(Map/*<String,LookupTable>*/ lookupTables) {
            GlyphTable.resolveLookupReferences(rsa, lookupTables);
        }
        /** {@inheritDoc} */
        public RuleLookup[] getLookups(int ci, int gi, GlyphPositioningState ps, int[] rv) {
            assert ps != null;
            assert (rv != null) && (rv.length > 0);
            assert rsa != null;
            if (rsa.length > 0) {
                RuleSet rs = rsa [ 0 ];
                if (rs != null) {
                    Rule[] ra = rs.getRules();
                    for (int i = 0, n = ra.length; i < n; i++) {
                        Rule r = ra [ i ];
                        if ((r != null) && (r instanceof ChainedGlyphSequenceRule)) {
                            ChainedGlyphSequenceRule cr = (ChainedGlyphSequenceRule) r;
                            int[] iga = cr.getGlyphs(gi);
                            if (matches(ps, iga, 0, rv)) {
                                int[] bga = cr.getBacktrackGlyphs();
                                if (matches(ps, bga, -1, null)) {
                                    int[] lga = cr.getLookaheadGlyphs();
                                    if (matches(ps, lga, rv[0], null)) {
                                        return r.getLookups();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return null;
        }
        private boolean matches(GlyphPositioningState ps, int[] glyphs, int offset, int[] rv) {
            return ContextualSubtableFormat1.matches(ps, glyphs, offset, rv);
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 1) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    rsa = (RuleSet[]) o;
                }
            }
        }
    }

    private static class ChainedContextualSubtableFormat2 extends ChainedContextualSubtable {
        private GlyphClassTable icdt;                   // input class def table
        private GlyphClassTable bcdt;                   // backtrack class def table
        private GlyphClassTable lcdt;                   // lookahead class def table
        private int ngc;                                // class set count
        private RuleSet[] rsa;                          // rule set array, ordered by class number [0...ngc - 1]
        ChainedContextualSubtableFormat2(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (rsa != null) {
                List entries = new ArrayList(5);
                entries.add(icdt);
                entries.add(bcdt);
                entries.add(lcdt);
                entries.add(Integer.valueOf(ngc));
                entries.add(rsa);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public void resolveLookupReferences(Map/*<String,LookupTable>*/ lookupTables) {
            GlyphTable.resolveLookupReferences(rsa, lookupTables);
        }
        /** {@inheritDoc} */
        public RuleLookup[] getLookups(int ci, int gi, GlyphPositioningState ps, int[] rv) {
            assert ps != null;
            assert (rv != null) && (rv.length > 0);
            assert rsa != null;
            if (rsa.length > 0) {
                RuleSet rs = rsa [ 0 ];
                if (rs != null) {
                    Rule[] ra = rs.getRules();
                    for (int i = 0, n = ra.length; i < n; i++) {
                        Rule r = ra [ i ];
                        if ((r != null) && (r instanceof ChainedClassSequenceRule)) {
                            ChainedClassSequenceRule cr = (ChainedClassSequenceRule) r;
                            int[] ica = cr.getClasses(icdt.getClassIndex(gi, ps.getClassMatchSet(gi)));
                            if (matches(ps, icdt, ica, 0, rv)) {
                                int[] bca = cr.getBacktrackClasses();
                                if (matches(ps, bcdt, bca, -1, null)) {
                                    int[] lca = cr.getLookaheadClasses();
                                    if (matches(ps, lcdt, lca, rv[0], null)) {
                                        return r.getLookups();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return null;
        }
        private boolean matches(GlyphPositioningState ps, GlyphClassTable cdt, int[] classes, int offset, int[] rv) {
            return ContextualSubtableFormat2.matches(ps, cdt, classes, offset, rv);
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 5) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 5 entries");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof GlyphClassTable)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    icdt = (GlyphClassTable) o;
                }
                if (((o = entries.get(1)) != null) && !(o instanceof GlyphClassTable)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an GlyphClassTable, but is: " + o.getClass());
                } else {
                    bcdt = (GlyphClassTable) o;
                }
                if (((o = entries.get(2)) != null) && !(o instanceof GlyphClassTable)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be an GlyphClassTable, but is: " + o.getClass());
                } else {
                    lcdt = (GlyphClassTable) o;
                }
                if (((o = entries.get(3)) == null) || !(o instanceof Integer)) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    ngc = ((Integer)(o)).intValue();
                }
                if (((o = entries.get(4)) == null) || !(o instanceof RuleSet[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, fifth entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    rsa = (RuleSet[]) o;
                    if (rsa.length != ngc) {
                        throw new AdvancedTypographicTableFormatException("illegal entries, RuleSet[] length is " + rsa.length + ", but expected " + ngc + " glyph classes");
                    }
                }
            }
        }
    }

    private static class ChainedContextualSubtableFormat3 extends ChainedContextualSubtable {
        private RuleSet[] rsa;                          // rule set array, containing a single rule set
        ChainedContextualSubtableFormat3(String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
            super(id, sequence, flags, format, coverage, entries);
            populate(entries);
        }
        /** {@inheritDoc} */
        public List getEntries() {
            if (rsa != null) {
                List entries = new ArrayList(1);
                entries.add(rsa);
                return entries;
            } else {
                return null;
            }
        }
        /** {@inheritDoc} */
        public void resolveLookupReferences(Map/*<String,LookupTable>*/ lookupTables) {
            GlyphTable.resolveLookupReferences(rsa, lookupTables);
        }
        /** {@inheritDoc} */
        public RuleLookup[] getLookups(int ci, int gi, GlyphPositioningState ps, int[] rv) {
            assert ps != null;
            assert (rv != null) && (rv.length > 0);
            assert rsa != null;
            if (rsa.length > 0) {
                RuleSet rs = rsa [ 0 ];
                if (rs != null) {
                    Rule[] ra = rs.getRules();
                    for (int i = 0, n = ra.length; i < n; i++) {
                        Rule r = ra [ i ];
                        if ((r != null) && (r instanceof ChainedCoverageSequenceRule)) {
                            ChainedCoverageSequenceRule cr = (ChainedCoverageSequenceRule) r;
                            GlyphCoverageTable[] igca = cr.getCoverages();
                            if (matches(ps, igca, 0, rv)) {
                                GlyphCoverageTable[] bgca = cr.getBacktrackCoverages();
                                if (matches(ps, bgca, -1, null)) {
                                    GlyphCoverageTable[] lgca = cr.getLookaheadCoverages();
                                    if (matches(ps, lgca, rv[0], null)) {
                                        return r.getLookups();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return null;
        }
        private boolean matches(GlyphPositioningState ps, GlyphCoverageTable[] gca, int offset, int[] rv) {
            return ContextualSubtableFormat3.matches(ps, gca, offset, rv);
        }
        private void populate(List entries) {
            if (entries == null) {
                throw new AdvancedTypographicTableFormatException("illegal entries, must be non-null");
            } else if (entries.size() != 1) {
                throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
            } else {
                Object o;
                if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
                    throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
                } else {
                    rsa = (RuleSet[]) o;
                }
            }
        }
    }

    /**
     * The <code>DeviceTable</code> class implements a positioning device table record, comprising
     * adjustments to be made to scaled design units according to the scaled size.
     */
    public static class DeviceTable {

        private final int startSize;
        private final int endSize;
        private final int[] deltas;

        /**
         * Instantiate a DeviceTable.
         * @param startSize the
         * @param endSize the ending (scaled) size
         * @param deltas adjustments for each scaled size
         */
        public DeviceTable(int startSize, int endSize, int[] deltas) {
            assert startSize >= 0;
            assert startSize <= endSize;
            assert deltas != null;
            assert deltas.length == (endSize - startSize) + 1;
            this.startSize = startSize;
            this.endSize = endSize;
            this.deltas = deltas;
        }

        /** @return the start size */
        public int getStartSize() {
            return startSize;
        }

        /** @return the end size */
        public int getEndSize() {
            return endSize;
        }

        /** @return the deltas */
        public int[] getDeltas() {
            return deltas;
        }

        /**
         * Find device adjustment.
         * @param fontSize the font size to search for
         * @return an adjustment if font size matches an entry
         */
        public int findAdjustment(int fontSize) {
            // [TODO] at present, assumes that 1 device unit equals one point
            int fs = fontSize / 1000;
            if (fs < startSize) {
                return 0;
            } else if (fs <= endSize) {
                return deltas [ fs - startSize ] * 1000;
            } else {
                return 0;
            }
        }

        /** {@inheritDoc} */
        public String toString() {
            return "{ start = " + startSize + ", end = " + endSize + ", deltas = " + Arrays.toString(deltas) + "}";
        }

    }

    /**
     * The <code>Value</code> class implements a positioning value record, comprising placement
     * and advancement information in X and Y axes, and optionally including device data used to
     * perform device (grid-fitted) specific fine grain adjustments.
     */
    public static class Value {

        /** X_PLACEMENT value format flag */
        public static final int X_PLACEMENT             = 0x0001;
        /** Y_PLACEMENT value format flag */
        public static final int Y_PLACEMENT             = 0x0002;
        /** X_ADVANCE value format flag */
        public static final int X_ADVANCE               = 0x0004;
        /** Y_ADVANCE value format flag */
        public static final int Y_ADVANCE               = 0x0008;
        /** X_PLACEMENT_DEVICE value format flag */
        public static final int X_PLACEMENT_DEVICE      = 0x0010;
        /** Y_PLACEMENT_DEVICE value format flag */
        public static final int Y_PLACEMENT_DEVICE      = 0x0020;
        /** X_ADVANCE_DEVICE value format flag */
        public static final int X_ADVANCE_DEVICE        = 0x0040;
        /** Y_ADVANCE_DEVICE value format flag */
        public static final int Y_ADVANCE_DEVICE        = 0x0080;

        /** X_PLACEMENT value index (within adjustments arrays) */
        public static final int IDX_X_PLACEMENT         = 0;
        /** Y_PLACEMENT value index (within adjustments arrays) */
        public static final int IDX_Y_PLACEMENT         = 1;
        /** X_ADVANCE value index (within adjustments arrays) */
        public static final int IDX_X_ADVANCE           = 2;
        /** Y_ADVANCE value index (within adjustments arrays) */
        public static final int IDX_Y_ADVANCE           = 3;

        private int xPlacement;                         // x placement
        private int yPlacement;                         // y placement
        private int xAdvance;                           // x advance
        private int yAdvance;                           // y advance
        private final DeviceTable xPlaDevice;           // x placement device table
        private final DeviceTable yPlaDevice;           // y placement device table
        private final DeviceTable xAdvDevice;           // x advance device table
        private final DeviceTable yAdvDevice;           // x advance device table

        /**
         * Instantiate a Value.
         * @param xPlacement the x placement or zero
         * @param yPlacement the y placement or zero
         * @param xAdvance the x advance or zero
         * @param yAdvance the y advance or zero
         * @param xPlaDevice the x placement device table or null
         * @param yPlaDevice the y placement device table or null
         * @param xAdvDevice the x advance device table or null
         * @param yAdvDevice the y advance device table or null
         */
        public Value(int xPlacement, int yPlacement, int xAdvance, int yAdvance, DeviceTable xPlaDevice, DeviceTable yPlaDevice, DeviceTable xAdvDevice, DeviceTable yAdvDevice) {
            this.xPlacement = xPlacement;
            this.yPlacement = yPlacement;
            this.xAdvance = xAdvance;
            this.yAdvance = yAdvance;
            this.xPlaDevice = xPlaDevice;
            this.yPlaDevice = yPlaDevice;
            this.xAdvDevice = xAdvDevice;
            this.yAdvDevice = yAdvDevice;
        }

        /** @return the x placement */
        public int getXPlacement() {
            return xPlacement;
        }

        /** @return the y placement */
        public int getYPlacement() {
            return yPlacement;
        }

        /** @return the x advance */
        public int getXAdvance() {
            return xAdvance;
        }

        /** @return the y advance */
        public int getYAdvance() {
            return yAdvance;
        }

        /** @return the x placement device table */
        public DeviceTable getXPlaDevice() {
            return xPlaDevice;
        }

        /** @return the y placement device table */
        public DeviceTable getYPlaDevice() {
            return yPlaDevice;
        }

        /** @return the x advance device table */
        public DeviceTable getXAdvDevice() {
            return xAdvDevice;
        }

        /** @return the y advance device table */
        public DeviceTable getYAdvDevice() {
            return yAdvDevice;
        }

        /**
         * Apply value to specific adjustments to without use of device table adjustments.
         * @param xPlacement the x placement or zero
         * @param yPlacement the y placement or zero
         * @param xAdvance the x advance or zero
         * @param yAdvance the y advance or zero
         */
        public void adjust(int xPlacement, int yPlacement, int xAdvance, int yAdvance) {
            this.xPlacement += xPlacement;
            this.yPlacement += yPlacement;
            this.xAdvance += xAdvance;
            this.yAdvance += yAdvance;
        }

        /**
         * Apply value to adjustments using font size for device table adjustments.
         * @param adjustments array of four integers containing X,Y placement and X,Y advance adjustments
         * @param fontSize font size for device table adjustments
         * @return true if some adjustment was made
         */
        public boolean adjust(int[] adjustments, int fontSize) {
            boolean adjust = false;
            int dv;
            if ((dv = xPlacement) != 0) {
                adjustments [ IDX_X_PLACEMENT ] += dv;
                adjust = true;
            }
            if ((dv = yPlacement) != 0) {
                adjustments [ IDX_Y_PLACEMENT ] += dv;
                adjust = true;
            }
            if ((dv = xAdvance) != 0) {
                adjustments [ IDX_X_ADVANCE ] += dv;
                adjust = true;
            }
            if ((dv = yAdvance) != 0) {
                adjustments [ IDX_Y_ADVANCE ] += dv;
                adjust = true;
            }
            if (fontSize != 0) {
                DeviceTable dt;
                if ((dt = xPlaDevice) != null) {
                    if ((dv = dt.findAdjustment(fontSize)) != 0) {
                        adjustments [ IDX_X_PLACEMENT ] += dv;
                        adjust = true;
                    }
                }
                if ((dt = yPlaDevice) != null) {
                    if ((dv = dt.findAdjustment(fontSize)) != 0) {
                        adjustments [ IDX_Y_PLACEMENT ] += dv;
                        adjust = true;
                    }
                }
                if ((dt = xAdvDevice) != null) {
                    if ((dv = dt.findAdjustment(fontSize)) != 0) {
                        adjustments [ IDX_X_ADVANCE ] += dv;
                        adjust = true;
                    }
                }
                if ((dt = yAdvDevice) != null) {
                    if ((dv = dt.findAdjustment(fontSize)) != 0) {
                        adjustments [ IDX_Y_ADVANCE ] += dv;
                        adjust = true;
                    }
                }
            }
            return adjust;
        }

        /** {@inheritDoc} */
        public String toString() {
            StringBuffer sb = new StringBuffer();
            boolean first = true;
            sb.append("{ ");
            if (xPlacement != 0) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("xPlacement = " + xPlacement);
            }
            if (yPlacement != 0) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("yPlacement = " + yPlacement);
            }
            if (xAdvance != 0) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("xAdvance = " + xAdvance);
            }
            if (yAdvance != 0) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("yAdvance = " + yAdvance);
            }
            if (xPlaDevice != null) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("xPlaDevice = " + xPlaDevice);
            }
            if (yPlaDevice != null) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("xPlaDevice = " + yPlaDevice);
            }
            if (xAdvDevice != null) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("xAdvDevice = " + xAdvDevice);
            }
            if (yAdvDevice != null) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("xAdvDevice = " + yAdvDevice);
            }
            sb.append(" }");
            return sb.toString();
        }

    }

    /**
     * The <code>PairValues</code> class implements a pair value record, comprising a glyph id (or zero)
     * and two optional positioning values.
     */
    public static class PairValues {

        private final int glyph;                        // glyph id (or 0)
        private final Value value1;                     // value for first glyph in pair (or null)
        private final Value value2;                     // value for second glyph in pair (or null)

        /**
         * Instantiate a PairValues.
         * @param glyph the glyph id (or zero)
         * @param value1 the value of the first glyph in pair (or null)
         * @param value2 the value of the second glyph in pair (or null)
         */
        public PairValues(int glyph, Value value1, Value value2) {
            assert glyph >= 0;
            this.glyph = glyph;
            this.value1 = value1;
            this.value2 = value2;
        }

        /** @return the glyph id */
        public int getGlyph() {
            return glyph;
        }

        /** @return the first value */
        public Value getValue1() {
            return value1;
        }

        /** @return the second value */
        public Value getValue2() {
            return value2;
        }

        /** {@inheritDoc} */
        public String toString() {
            StringBuffer sb = new StringBuffer();
            boolean first = true;
            sb.append("{ ");
            if (glyph != 0) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("glyph = " + glyph);
            }
            if (value1 != null) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("value1 = " + value1);
            }
            if (value2 != null) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                sb.append("value2 = " + value2);
            }
            sb.append(" }");
            return sb.toString();
        }

    }

    /**
     * The <code>Anchor</code> class implements a anchor record, comprising an X,Y coordinate pair,
     * an optional anchor point index (or -1), and optional X or Y device tables (or null if absent).
     */
    public static class Anchor {

        private final int x;                            // xCoordinate (in design units)
        private final int y;                            // yCoordinate (in design units)
        private final int anchorPoint;                  // anchor point index (or -1)
        private final DeviceTable xDevice;              // x device table
        private final DeviceTable yDevice;              // y device table

        /**
         * Instantiate an Anchor (format 1).
         * @param x the x coordinate
         * @param y the y coordinate
         */
        public Anchor(int x, int y) {
            this (x, y, -1, null, null);
        }

        /**
         * Instantiate an Anchor (format 2).
         * @param x the x coordinate
         * @param y the y coordinate
         * @param anchorPoint anchor index (or -1)
         */
        public Anchor(int x, int y, int anchorPoint) {
            this (x, y, anchorPoint, null, null);
        }

        /**
         * Instantiate an Anchor (format 3).
         * @param x the x coordinate
         * @param y the y coordinate
         * @param xDevice the x device table (or null if not present)
         * @param yDevice the y device table (or null if not present)
         */
        public Anchor(int x, int y, DeviceTable xDevice, DeviceTable yDevice) {
            this (x, y, -1, xDevice, yDevice);
        }

        /**
         * Instantiate an Anchor based on an existing anchor.
         * @param a the existing anchor
         */
        protected Anchor(Anchor a) {
            this (a.x, a.y, a.anchorPoint, a.xDevice, a.yDevice);
        }

        private Anchor(int x, int  y, int anchorPoint, DeviceTable xDevice, DeviceTable yDevice) {
            assert (anchorPoint >= 0) || (anchorPoint == -1);
            this.x = x;
            this.y = y;
            this.anchorPoint = anchorPoint;
            this.xDevice = xDevice;
            this.yDevice = yDevice;
        }

        /** @return the x coordinate */
        public int getX() {
            return x;
        }

        /** @return the y coordinate */
        public int getY() {
            return y;
        }

        /** @return the anchor point index (or -1 if not specified) */
        public int getAnchorPoint() {
            return anchorPoint;
        }

        /** @return the x device table (or null if not specified) */
        public DeviceTable getXDevice() {
            return xDevice;
        }

        /** @return the y device table (or null if not specified) */
        public DeviceTable getYDevice() {
            return yDevice;
        }

        /**
         * Obtain adjustment value required to align the specified anchor
         * with this anchor.
         * @param a the anchor to align
         * @return the adjustment value needed to effect alignment
         */
        public Value getAlignmentAdjustment(Anchor a) {
            assert a != null;
            // TODO - handle anchor point
            // TODO - handle device tables
            return new Value(x - a.x, y - a.y, 0, 0, null, null, null, null);
        }

        /** {@inheritDoc} */
        public String toString() {
            StringBuffer sb = new StringBuffer();
            sb.append("{ [" + x + "," + y + "]");
            if (anchorPoint != -1) {
                sb.append(", anchorPoint = " + anchorPoint);
            }
            if (xDevice != null) {
                sb.append(", xDevice = " + xDevice);
            }
            if (yDevice != null) {
                sb.append(", yDevice = " + yDevice);
            }
            sb.append(" }");
            return sb.toString();
        }

    }

    /**
     * The <code>MarkAnchor</code> class is a subclass of the <code>Anchor</code> class, adding a mark
     * class designation.
     */
    public static class MarkAnchor extends Anchor {

        private final int markClass;                            // mark class

        /**
         * Instantiate a MarkAnchor
         * @param markClass the mark class
         * @param a the underlying anchor (whose fields are copied)
         */
        public MarkAnchor(int markClass, Anchor a) {
            super(a);
            this.markClass = markClass;
        }

        /** @return the mark class */
        public int getMarkClass() {
            return markClass;
        }

        /** {@inheritDoc} */
        public String toString() {
            return "{ markClass = " + markClass + ", anchor = " + super.toString() + " }";
        }

    }

}