TextAttr.java 86.8 KB
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 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 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.xfa.text;

import com.adobe.xfa.font.FontInfo;
import com.adobe.xfa.font.FontInstance;
import com.adobe.xfa.font.FontItem;
import com.adobe.xfa.font.FontService;
import com.adobe.xfa.gfx.GFXColour;
import com.adobe.xfa.gfx.GFXGraphicContext;
import com.adobe.xfa.gfx.GFXTextAttr;
import com.adobe.xfa.text.AttrCopy;
import com.adobe.xfa.text.Pkg;
import com.adobe.xfa.text.TextBaselineShift;
import com.adobe.xfa.text.TextGfxAttr;
import com.adobe.xfa.text.TextGfxSource;
import com.adobe.xfa.text.TextMeasurement;
import com.adobe.xfa.text.TextStream;
import com.adobe.xfa.text.TextTabList;
import com.adobe.xfa.text.Units;
import com.adobe.xfa.ut.LcData;
import com.adobe.xfa.ut.LcLocale;
import com.adobe.xfa.ut.StringUtils;
import com.adobe.xfa.ut.UnitSpan;
import java.io.PrintStream;

public class TextAttr
extends TextGfxAttr {
    public static final int JUST_V_UNKNOWN = 0;
    public static final int JUST_V_TOP = 1;
    public static final int JUST_V_MIDDLE = 2;
    public static final int JUST_V_BOTTOM = 3;
    public static final int JUST_H_UNKNOWN = 4;
    public static final int JUST_H_LEFT = 5;
    public static final int JUST_H_CENTRE = 6;
    public static final int JUST_H_RIGHT = 7;
    public static final int JUST_H_SPREAD = 8;
    public static final int JUST_H_SPREAD_ALL = 9;
    public static final int JUST_H_RADIX = 10;
    public static final int JUST_H_COMB_LEFT = 11;
    public static final int JUST_H_COMB_CENTRE = 12;
    public static final int JUST_H_COMB_RIGHT = 13;
    public static final int DIGITS_LOCALE = 0;
    public static final int DIGITS_ARABIC = 1;
    public static final int DIGITS_INDIC = 2;
    public static final int DIRECTION_NEUTRAL = 0;
    public static final int DIRECTION_LTR = 1;
    public static final int DIRECTION_RTL = 2;
    public static final int ORIENTATION_HORIZONTAL = 0;
    public static final int ORIENTATION_VERTICAL_LTR = 1;
    public static final int ORIENTATION_VERTICAL_RTL = 2;
    public static final int LIGATURE_MINIMUM = 0;
    public static final int LIGATURE_COMMON = 1;
    public static final int HYPHEN_OFF = 0;
    public static final int HYPHEN_PREFERRED = 1;
    public static final int HYPHEN_NORMAL = 2;
    public static final int HYPHEN_ALL = 3;
    public static final int LEADER_PATTERN_SPACE = 0;
    public static final int LEADER_PATTERN_RULE = 1;
    public static final int LEADER_PATTERN_DOTS = 2;
    public static final int LEADER_PATTERN_USE_CONTENT = 3;
    public static final int LEADER_ALIGN_NONE = 0;
    public static final int LEADER_ALIGN_PAGE = 1;
    public static final int RULE_STYLE_NONE = 0;
    public static final int RULE_STYLE_SOLID = 1;
    public static final int RULE_STYLE_DOTTED = 2;
    public static final int RULE_STYLE_DASHED = 3;
    public static final int DEFAULT_HYPH_LEVEL = 0;
    public static final int DEFAULT_HYPH_MIN_WORD = 7;
    public static final int DEFAULT_HYPH_MIN_PREFIX = 3;
    public static final int DEFAULT_HYPH_MIN_SUFFIX = 3;
    public static final int DEFAULT_HYPH_MAX_LINES = 2;
    public static final boolean DEFAULT_HYPH_SUPPRESS_NAMES = false;
    public static final boolean DEFAULT_HYPH_SUPPRESS_ACRONYMS = false;
    public static final int DEFAULT_LEADER_PATTERN = 0;
    public static final int DEFAULT_LEADER_ALIGN = 0;
    public static final int DEFAULT_RULE_STYLE = 1;
    private static final int UNIT_SPACING = 0;
    private static final int UNIT_MARGIN_L = 1;
    private static final int UNIT_MARGIN_R = 2;
    private static final int UNIT_RADIX_OFFSET = 3;
    private static final int UNIT_SPECIAL = 4;
    private static final int UNIT_SPACE_BEFORE = 5;
    private static final int UNIT_SPACE_AFTER = 6;
    private static final int UNIT_CHAR_SPACING = 7;
    private static final int UNIT_WORD_SPACING = 8;
    private static final int UNIT_LEADER_PATTERN_WIDTH = 9;
    private static final int UNIT_RULE_THICKNESS = 10;
    private static final int MAX_UNIT_INDEX = 11;
    private static final int INT_RADIX_POS = 0;
    private static final int INT_INVIS_CHAR = 1;
    private static final int INT_DIGITS = 2;
    private static final int INT_DIRECTION = 3;
    private static final int INT_PARA_DIRECTION = 4;
    private static final int INT_LAYOUT_ORIENTATION = 5;
    private static final int INT_LIGATURE = 6;
    private static final int INT_HYPH_LEVEL = 7;
    private static final int INT_HYPH_MIN_WORD = 8;
    private static final int INT_HYPH_MIN_PREFIX = 9;
    private static final int INT_HYPH_MIN_SUFFIX = 10;
    private static final int INT_HYPH_MAX_LINES = 11;
    private static final int INT_LEADER_PATTERN = 12;
    private static final int INT_LEADER_ALIGN = 13;
    private static final int INT_RULE_STYLE = 14;
    private static final int MAX_INT_INDEX = 15;
    private static final int BOOL_ITALIC = 0;
    private static final int BOOL_TRANSPARENT = 1;
    private static final int BOOL_INVISIBLE = 2;
    private static final int BOOL_KERNING = 3;
    private static final int BOOL_HYPH_SUPPRESS_NAMES = 4;
    private static final int BOOL_HYPH_SUPPRESS_ACRONYMS = 5;
    private static final int MAX_BOOL_INDEX = 6;
    private static final int FLOAT_HORIZONTAL_SCALE = 0;
    private static final int FLOAT_VERTICAL_SCALE = 1;
    private static final int MAX_FLOAT_INDEX = 2;
    private TextGfxSource moGfxSource;
    private AttrExtra mpoExtra;
    private FontInstance moFontInstance;
    private String msTypeface = "";
    private String msOriginalTypeface = "";
    private String msEncoding = "";
    private UnitSpan moSize = goDefaultUnitNeg;
    private int miWeight;
    private int meJustifyV = 1;
    private int meJustifyH = 5;
    private TextTabList mpoTabs;
    private String msLocale = "";
    private int mbUnitEnable;
    private int mbIntEnable;
    private int mbFloatEnable;
    private int mbBoolEnable;
    private int mbBoolValue;
    private boolean mbJustifyVEnable;
    private boolean mbJustifyHEnable;
    private boolean mbLocaleEnable;
    private boolean mbBaselineShiftEnable;
    private boolean mbLeaderContentEnable;
    private static final UnitSpan goDefaultUnitNeg = new UnitSpan(19, -1);
    private static final TextMeasurement goDefaultMeasureNeg = new TextMeasurement(goDefaultUnitNeg);
    private static final String gmsDefaultTypeface = "Courier Std";
    private static final String gsDefaultEncoding = "iso8859-1";
    public static final TextAttr defaultFull = new TextAttr(true);
    public static final TextAttr defaultEmpty = new TextAttr(false);

    public TextAttr() {
        this.initialize(false);
    }

    public TextAttr(boolean bDefault) {
        this.initialize(bDefault);
    }

    public TextAttr(TextAttr oSource) {
        this.initialize(false);
        this.moGfxSource = oSource.moGfxSource;
        this.copyFrom(oSource);
    }

    public TextAttr(TextAttr oSource, TextGfxSource oGfxSource) {
        this.initialize(false);
        this.moGfxSource = oGfxSource;
        if (oSource.moGfxSource != this.moGfxSource) {
            AttrCopy copier = new AttrCopy(oSource, 0);
            copier.copy(this);
        } else {
            this.copyFrom(oSource);
        }
    }

    public TextGfxSource gfxSource() {
        return this.moGfxSource;
    }

    public void gfxSource(TextGfxSource oNewGfxSource) {
        FontInstance oNewFontInstance = null;
        String sOriginalTypeface = this.originalTypeface();
        if (this.moFontInstance != null) {
            oNewFontInstance = this.moFontInstance;
        } else if (oNewGfxSource.getFontService() != null && this.typefaceEnable() && this.sizeEnable() && this.weightEnable() && this.italicEnable()) {
            FontDesc oFontDesc = new FontDesc(this);
            ReconcileInfo reconcile = this.reconcileFont(oNewGfxSource.getFontService(), oFontDesc);
            oNewFontInstance = reconcile.mFontInstance;
            sOriginalTypeface = reconcile.mOriginalTypeface;
        }
        this.moGfxSource = oNewGfxSource;
        if (oNewFontInstance != null) {
            this.updateFont(oNewFontInstance, sOriginalTypeface);
        }
        if (this.mpoExtra != null && this.mpoExtra.mpoLeaderContent != null) {
            this.mpoExtra.mpoLeaderContent.fontService(oNewGfxSource.getFontService());
        }
    }

    public FontService fontService() {
        return this.moGfxSource == null ? null : this.moGfxSource.getFontService();
    }

    public void fontService(FontService poNewFontService, boolean bSuppressReconcile) {
        if (poNewFontService == this.fontService()) {
            return;
        }
        if (bSuppressReconcile) {
            this.moGfxSource = new TextGfxSource(poNewFontService);
        } else {
            this.gfxSource(new TextGfxSource(poNewFontService));
        }
        if (this.mpoExtra != null && this.mpoExtra.mpoLeaderContent != null) {
            this.mpoExtra.mpoLeaderContent.fontService(poNewFontService);
        }
    }

    public void fontService(FontService poNewFontService) {
        this.fontService(poNewFontService, false);
    }

    public FontInstance fontInstance() {
        return this.moFontInstance;
    }

    public void fontInstance(FontInstance oNewFont, String sOriginalTypeface) {
        if (oNewFont != this.moFontInstance) {
            this.updateFont(oNewFont, sOriginalTypeface);
        }
    }

    public void fontInstance(FontInstance oNewFont) {
        this.fontInstance(oNewFont, "");
    }

    public boolean substituteFont() {
        return !StringUtils.isEmpty(this.msOriginalTypeface);
    }

    public boolean fontEnable() {
        return this.moFontInstance != null;
    }

    public void fontEnable(boolean bNewEnable) {
        if (!bNewEnable) {
            this.updateFont(null, "");
        }
    }

    public boolean anyFontEnable() {
        return this.typefaceEnable() || this.sizeEnable() || this.weightEnable() || this.italicEnable() || this.horizontalScaleEnable() || this.verticalScaleEnable();
    }

    public String typeface() {
        return this.msTypeface;
    }

    public void typeface(String sNewTypeface, int nWeight, boolean bItalic, String sEncoding) {
        this.msTypeface = sNewTypeface;
        FontDesc oFontDesc = new FontDesc();
        oFontDesc.setTypeface(sNewTypeface);
        oFontDesc.setWeight(nWeight);
        oFontDesc.setItalic(bItalic);
        oFontDesc.setEncoding(sEncoding);
        this.updateFont(oFontDesc);
    }

    public void typeface(String sNewTypeface) {
        FontDesc oFontDesc = new FontDesc(sNewTypeface);
        this.updateFont(oFontDesc);
    }

    public void typeface(String sNewTypeface, UnitSpan oSize, int nWeight, int nItalic) {
        FontDesc oFontDesc = new FontDesc();
        if (sNewTypeface != null && sNewTypeface.length() > 0) {
            oFontDesc.setTypeface(sNewTypeface);
        }
        if (oSize != null && oSize.value() > 0) {
            oFontDesc.setSize(oSize);
        }
        if (nWeight != 0) {
            oFontDesc.setWeight(nWeight);
        }
        if (nItalic != -1) {
            oFontDesc.setItalic(nItalic == 1);
        }
        this.updateFont(oFontDesc);
    }

    public boolean typefaceEnable() {
        return this.msTypeface.length() > 0;
    }

    public void typefaceEnable(boolean bNewEnable) {
        if (!bNewEnable) {
            this.typeface("");
        }
    }

    public String originalTypeface() {
        return this.msOriginalTypeface;
    }

    public String encoding() {
        return this.msEncoding;
    }

    public void encoding(String sNewEncoding) {
        FontDesc oFontDesc = new FontDesc();
        oFontDesc.setEncoding(sNewEncoding);
        this.updateFont(oFontDesc);
    }

    public boolean encodingEnable() {
        return this.msEncoding.length() > 0;
    }

    public void encodingEnable(boolean bNewEnable) {
        if (!bNewEnable) {
            this.encoding("");
        }
    }

    public UnitSpan size() {
        return this.moSize;
    }

    public void size(UnitSpan oNewSize) {
        FontDesc oFontDesc = new FontDesc(oNewSize);
        this.updateFont(oFontDesc);
    }

    public boolean sizeEnable() {
        return this.moSize.value() >= 0;
    }

    public void sizeEnable(boolean bNewEnable) {
        this.size(new UnitSpan(UnitSpan.defaultUnits(), -1));
    }

    public int weight() {
        return this.miWeight;
    }

    public void weight(int iNewWeight) {
        FontDesc oFontDesc = new FontDesc(iNewWeight);
        this.updateFont(oFontDesc);
    }

    public boolean weightEnable() {
        return this.miWeight != 0;
    }

    public void weightEnable(boolean bNewEnable) {
        this.weight(0);
    }

    public boolean italic() {
        return this.getBoolValue(0);
    }

    public void italic(boolean bNewItalic) {
        FontDesc oFontDesc = new FontDesc();
        oFontDesc.setItalic(bNewItalic);
        this.updateFont(oFontDesc);
    }

    public boolean italicEnable() {
        return this.isBoolEnabled(0);
    }

    public void italicEnable(boolean bNewEnable) {
        this.enableBool(0, bNewEnable);
        this.updateFont();
    }

    public GFXTextAttr gfxTextAttr() {
        return this.getGfxTextAttr();
    }

    public boolean transparent() {
        return this.getBoolValue(1);
    }

    public void transparent(boolean bNewTransparent) {
        this.setBoolValue(1, bNewTransparent);
    }

    public boolean transparentEnable() {
        return this.isBoolEnabled(1);
    }

    public void transparentEnable(boolean bNewEnable) {
        this.enableBool(1, bNewEnable);
    }

    public TextMeasurement spacing() {
        return this.getUnitValue(0);
    }

    public void spacing(TextMeasurement oNewSpacing) {
        this.setUnitValue(0, oNewSpacing);
    }

    public boolean spacingEnable() {
        return this.isUnitEnabled(0);
    }

    public void spacingEnable(boolean bNewEnable) {
        this.enableUnit(0, bNewEnable);
    }

    public TextMeasurement marginL() {
        return this.getUnitValue(1);
    }

    public void marginL(TextMeasurement oNewMarginL) {
        this.setUnitValue(1, oNewMarginL);
    }

    public boolean marginLEnable() {
        return this.isUnitEnabled(1);
    }

    public void marginLEnable(boolean bNewEnable) {
        this.enableUnit(1, bNewEnable);
    }

    public TextMeasurement marginR() {
        return this.getUnitValue(2);
    }

    public void marginR(TextMeasurement oNewMarginR) {
        this.setUnitValue(2, oNewMarginR);
    }

    public boolean marginREnable() {
        return this.isUnitEnabled(2);
    }

    public void marginREnable(boolean bNewEnable) {
        this.enableUnit(2, bNewEnable);
    }

    public int justifyV() {
        return this.meJustifyV;
    }

    public void justifyV(int eNewJustifyV) {
        this.meJustifyV = eNewJustifyV;
        this.mbJustifyVEnable = this.meJustifyV != 0;
    }

    public boolean justifyVEnable() {
        return this.mbJustifyVEnable;
    }

    public void justifyVEnable(boolean bNewEnable) {
        this.mbJustifyVEnable = bNewEnable;
        if (!this.mbJustifyVEnable) {
            this.meJustifyV = 0;
        }
    }

    public int justifyH() {
        return this.meJustifyH;
    }

    public void justifyH(int eNewJustifyH) {
        this.meJustifyH = eNewJustifyH;
        this.mbJustifyHEnable = this.meJustifyH != 4;
    }

    public boolean justifyHEnable() {
        return this.mbJustifyHEnable;
    }

    public void justifyHEnable(boolean bNewEnable) {
        this.mbJustifyHEnable = bNewEnable;
        if (!this.mbJustifyHEnable) {
            this.meJustifyH = 4;
        }
    }

    public TextMeasurement radixOffset() {
        return this.getUnitValue(3);
    }

    public void radixOffset(TextMeasurement oNewRadixOffset) {
        this.setUnitValue(3, oNewRadixOffset);
    }

    public boolean radixOffsetEnable() {
        return this.isUnitEnabled(3);
    }

    public void radixOffsetEnable(boolean bNewEnable) {
        this.enableUnit(3, bNewEnable);
    }

    public int radixPos() {
        return this.getIntValue(0);
    }

    public void radixPos(int nNewRadixPos) {
        this.setIntValue(0, nNewRadixPos);
    }

    public boolean radixPosEnable() {
        return this.isIntEnabled(0);
    }

    public void radixPosEnable(boolean bNewEnable) {
        this.enableInt(0, bNewEnable);
    }

    public TextTabList tabs() {
        return this.mpoTabs == null ? TextTabList.DEFAULT_TAB_LIST : this.mpoTabs;
    }

    public void tabs(TextTabList oNewTabs) {
        this.mpoTabs = oNewTabs == TextTabList.DEFAULT_TAB_LIST ? TextTabList.DEFAULT_TAB_LIST : new TextTabList(oNewTabs);
    }

    public boolean tabsEnable() {
        return this.mpoTabs != null;
    }

    public void tabsEnable(boolean bNewEnable) {
        if (bNewEnable) {
            if (this.mpoTabs == null) {
                this.mpoTabs = TextTabList.DEFAULT_TAB_LIST;
            }
        } else {
            this.mpoTabs = null;
        }
    }

    public TextMeasurement special() {
        return this.getUnitValue(4);
    }

    public void special(TextMeasurement oNewSpecial) {
        this.setUnitValue(4, oNewSpecial);
    }

    public boolean specialEnable() {
        return this.isUnitEnabled(4);
    }

    public void specialEnable(boolean bNewEnable) {
        this.enableUnit(4, bNewEnable);
    }

    public TextMeasurement spaceBefore() {
        return this.getUnitValue(5);
    }

    public void spaceBefore(TextMeasurement oNewSpaceBefore) {
        this.setUnitValue(5, oNewSpaceBefore);
    }

    public boolean spaceBeforeEnable() {
        return this.isUnitEnabled(5);
    }

    public void spaceBeforeEnable(boolean bNewEnable) {
        this.enableUnit(5, bNewEnable);
    }

    public TextMeasurement spaceAfter() {
        return this.getUnitValue(6);
    }

    public void spaceAfter(TextMeasurement oNewSpaceAfter) {
        this.setUnitValue(6, oNewSpaceAfter);
    }

    public boolean spaceAfterEnable() {
        return this.isUnitEnabled(6);
    }

    public void spaceAfterEnable(boolean bNewEnable) {
        this.enableUnit(6, bNewEnable);
    }

    public boolean invisible() {
        return this.getBoolValue(2);
    }

    public void invisible(boolean bNewInvisible) {
        this.setBoolValue(2, bNewInvisible);
    }

    public boolean invisibleEnable() {
        return this.isBoolEnabled(2);
    }

    public void invisibleEnable(boolean bNewEnable) {
        this.enableBool(2, bNewEnable);
    }

    public char invisChar() {
        return (char)this.getIntValue(1);
    }

    public void invisChar(char cNewInvisChar) {
        this.setIntValue(1, cNewInvisChar);
    }

    public boolean invisCharEnable() {
        return this.isIntEnabled(1);
    }

    public void invisCharEnable(boolean bNewEnable) {
        this.enableInt(1, bNewEnable);
    }

    public TextBaselineShift baselineShift() {
        return this.mpoExtra == null || this.mpoExtra.moShift == null ? TextBaselineShift.DEFAULT_SHIFT : this.mpoExtra.moShift;
    }

    public void baselineShift(TextBaselineShift oNewShift) {
        if (oNewShift != this.baselineShift()) {
            this.needExtra();
            this.mpoExtra.moShift = oNewShift;
        }
        this.mbBaselineShiftEnable = oNewShift != null;
    }

    public boolean baselineShiftEnable() {
        return this.mbBaselineShiftEnable;
    }

    public void baselineShiftEnable(boolean bNewEnable) {
        this.mbBaselineShiftEnable = bNewEnable;
    }

    public UnitSpan flattenMeasurement(TextMeasurement oMeasurement) {
        if (this.fontEnable() && this.moFontInstance != null) {
            return oMeasurement.flatten(this.moFontInstance);
        }
        return oMeasurement.flatten(this.moSize);
    }

    public boolean flatten() {
        if (!this.sizeEnable()) {
            return false;
        }
        UnitSpan oFontSize = this.size();
        if (oFontSize.value() == 0) {
            return false;
        }
        boolean bFlattened = false;
        if (this.canFlattenBaselineShift()) {
            TextBaselineShift oOldShift = this.baselineShift();
            UnitSpan oOldSize = oFontSize;
            UnitSpan[] flat = oOldShift.flatten(UnitSpan.ZERO, oOldSize, oFontSize);
            this.size(flat[1]);
            this.baselineShift(new TextBaselineShift(flat[0]));
            bFlattened = true;
        }
        FontInstance oFontInstance = null;
        if (this.fontEnable()) {
            oFontInstance = this.fontInstance();
        }
        if (this.mpoExtra != null) {
            for (int i = 0; i < 11; ++i) {
                TextMeasurement oMeasurement = this.mpoExtra.moUnit[i];
                if (oMeasurement.getType() == 0) continue;
                UnitSpan oFlat = oFontInstance == null ? oMeasurement.flatten(oFontSize) : oMeasurement.flatten(oFontInstance);
                this.mpoExtra.moUnit[i] = new TextMeasurement(oFlat);
            }
        }
        return bFlattened;
    }

    public TextAttr conditionalFlatten() {
        if (!this.sizeEnable() || this.size().value() == 0) {
            return null;
        }
        boolean bFlatten = false;
        if (this.canFlattenBaselineShift()) {
            bFlatten = true;
        } else if (this.mpoExtra != null) {
            for (int i = 0; i < 11; ++i) {
                if (this.mpoExtra.moUnit[i].getType() == 0) continue;
                bFlatten = true;
                break;
            }
        }
        if (!bFlatten) {
            return null;
        }
        TextAttr poNewAttr = new TextAttr(this);
        poNewAttr.flatten();
        poNewAttr.needExtra();
        poNewAttr.mpoExtra.mpoOriginalAttr = this;
        return poNewAttr;
    }

    public TextAttr getOriginalAttr() {
        return this.mpoExtra == null ? null : this.mpoExtra.mpoOriginalAttr;
    }

    public String locale() {
        return this.msLocale;
    }

    public void locale(String sNewLocale) {
        this.msLocale = sNewLocale;
        this.mbLocaleEnable = true;
    }

    public boolean localeEnable() {
        return this.mbLocaleEnable;
    }

    public void localeEnable(boolean bNewEnable) {
        this.mbLocaleEnable = bNewEnable;
    }

    public String actualLocale() {
        String sLocale = !this.mbLocaleEnable ? "en_US" : (this.msLocale.length() == 0 ? LcLocale.getLocale() : this.msLocale);
        return sLocale;
    }

    public String radixText() {
        String sRadixText;
        LcLocale oLocale = new LcLocale(this.actualLocale());
        if (oLocale.isValid()) {
            LcData oLocaleData = new LcData(oLocale.getName());
            sRadixText = oLocaleData.getRadixSymbol();
        } else {
            sRadixText = ".";
        }
        return sRadixText;
    }

    public char radixChar() {
        String sRadixText = this.radixText();
        char c = sRadixText.charAt(0);
        return c == '\u0000' ? '.' : (char)c;
    }

    public int digits() {
        return this.getIntValue(2);
    }

    public void digits(int eNewDigits) {
        this.setIntValue(2, eNewDigits);
    }

    public boolean digitsEnable() {
        return this.isIntEnabled(2);
    }

    public void digitsEnable(boolean bNewEnable) {
        this.enableInt(2, bNewEnable);
    }

    public int direction() {
        return this.getIntValue(3);
    }

    public void direction(int eNewDirection) {
        this.setIntValue(3, eNewDirection);
    }

    public boolean directionEnable() {
        return this.isIntEnabled(3);
    }

    public void directionEnable(boolean bNewEnable) {
        this.enableInt(3, bNewEnable);
    }

    public int paraDirection() {
        return this.getIntValue(4);
    }

    public void paraDirection(int eNewDirection) {
        this.setIntValue(4, eNewDirection);
    }

    public boolean paraDirectionEnable() {
        return this.isIntEnabled(4);
    }

    public void paraDirectionEnable(boolean bNewEnable) {
        this.enableInt(4, bNewEnable);
    }

    public int layoutOrientation() {
        return this.getIntValue(5);
    }

    public void layoutOrientation(int eNewLayoutOrientation) {
        this.setIntValue(5, eNewLayoutOrientation);
    }

    public boolean layoutOrientationEnable() {
        return this.isIntEnabled(5);
    }

    public void layoutOrientationEnable(boolean bNewEnable) {
        this.enableInt(5, bNewEnable);
    }

    public int ligature() {
        return this.getIntValue(6);
    }

    public void ligature(int eNewLigature) {
        this.setIntValue(6, eNewLigature);
    }

    public boolean ligatureEnable() {
        return this.isIntEnabled(6);
    }

    public void ligatureEnable(boolean bNewEnable) {
        this.enableInt(6, bNewEnable);
    }

    public TextMeasurement charSpacing() {
        return this.getUnitValue(7);
    }

    public void charSpacing(TextMeasurement nNewCharSpacing) {
        this.setUnitValue(7, nNewCharSpacing);
    }

    public boolean charSpacingEnable() {
        return this.isUnitEnabled(7);
    }

    public void charSpacingEnable(boolean bNewEnable) {
        this.enableUnit(7, bNewEnable);
    }

    public TextMeasurement wordSpacing() {
        return this.getUnitValue(8);
    }

    public void wordSpacing(TextMeasurement nNewWordSpacing) {
        this.setUnitValue(8, nNewWordSpacing);
    }

    public boolean wordSpacingEnable() {
        return this.isUnitEnabled(8);
    }

    public void wordSpacingEnable(boolean bNewEnable) {
        this.enableUnit(8, bNewEnable);
    }

    public boolean kerning() {
        return this.getBoolValue(3);
    }

    public void kerning(boolean bNewKerning) {
        this.setBoolValue(3, bNewKerning);
    }

    public boolean kerningEnable() {
        return this.isBoolEnabled(3);
    }

    public void kerningEnable(boolean bNewEnable) {
        this.enableBool(3, bNewEnable);
    }

    public int hyphLevel() {
        return this.getIntValue(7);
    }

    public void hyphLevel(int eNewHyphLevel) {
        this.setIntValue(7, eNewHyphLevel);
    }

    public boolean hyphLevelEnable() {
        return this.isIntEnabled(7);
    }

    public void hyphLevelEnable(boolean bNewEnable) {
        this.enableInt(7, bNewEnable);
    }

    public int hyphMinWord() {
        return this.getIntValue(8);
    }

    public void hyphMinWord(int nNewHyphMinWord) {
        this.setIntValue(8, nNewHyphMinWord);
    }

    public boolean hyphMinWordEnable() {
        return this.isIntEnabled(8);
    }

    public void hyphMinWordEnable(boolean bNewEnable) {
        this.enableInt(8, bNewEnable);
    }

    public int hyphMinPrefix() {
        return this.getIntValue(9);
    }

    public void hyphMinPrefix(int nNewHyphMinPrefix) {
        this.setIntValue(9, nNewHyphMinPrefix);
    }

    public boolean hyphMinPrefixEnable() {
        return this.isIntEnabled(9);
    }

    public void hyphMinPrefixEnable(boolean bNewEnable) {
        this.enableInt(9, bNewEnable);
    }

    public int hyphMinSuffix() {
        return this.getIntValue(10);
    }

    public void hyphMinSuffix(int nNewHyphMinSuffix) {
        this.setIntValue(10, nNewHyphMinSuffix);
    }

    public boolean hyphMinSuffixEnable() {
        return this.isIntEnabled(10);
    }

    public void hyphMinSuffixEnable(boolean bNewEnable) {
        this.enableInt(10, bNewEnable);
    }

    public int hyphMaxLines() {
        return this.getIntValue(11);
    }

    public void hyphMaxLines(int nNewHyphMaxLines) {
        this.setIntValue(11, nNewHyphMaxLines);
    }

    public boolean hyphMaxLinesEnable() {
        return this.isIntEnabled(11);
    }

    public void hyphMaxLinesEnable(boolean bNewEnable) {
        this.enableInt(11, bNewEnable);
    }

    public boolean hyphSuppressNames() {
        return this.getBoolValue(4);
    }

    public void hyphSuppressNames(boolean bNewHyphSuppressNames) {
        this.setBoolValue(4, bNewHyphSuppressNames);
    }

    public boolean hyphSuppressNamesEnable() {
        return this.isBoolEnabled(4);
    }

    public void hyphSuppressNamesEnable(boolean bNewEnable) {
        this.enableBool(4, bNewEnable);
    }

    public boolean hyphSuppressAcronyms() {
        return this.getBoolValue(5);
    }

    public void hyphSuppressAcronyms(boolean bNewHyphSuppressAcronyms) {
        this.setBoolValue(5, bNewHyphSuppressAcronyms);
    }

    public boolean hyphSuppressAcronymsEnable() {
        return this.isBoolEnabled(5);
    }

    public void hyphSuppressAcronymsEnable(boolean bNewEnable) {
        this.enableBool(5, bNewEnable);
    }

    public int leaderPattern() {
        return this.getIntValue(12);
    }

    public void leaderPattern(int eNewLeaderPattern) {
        this.setIntValue(12, eNewLeaderPattern);
    }

    public boolean leaderPatternEnable() {
        return this.isIntEnabled(12);
    }

    public void leaderPatternEnable(boolean bNewEnable) {
        this.enableInt(12, bNewEnable);
    }

    public TextMeasurement leaderPatternWidth() {
        return this.getUnitValue(9);
    }

    public void leaderPatternWidth(TextMeasurement oNewLeaderPatternWidth) {
        this.setUnitValue(9, oNewLeaderPatternWidth);
    }

    public boolean leaderPatternWidthEnable() {
        return this.isUnitEnabled(9);
    }

    public void leaderPatternWidthEnable(boolean bNewEnable) {
        this.enableUnit(9, bNewEnable);
    }

    public int leaderAlign() {
        return this.getIntValue(13);
    }

    public void leaderAlign(int eNewLeaderAlign) {
        this.setIntValue(13, eNewLeaderAlign);
    }

    public boolean leaderAlignEnable() {
        return this.isIntEnabled(13);
    }

    public void leaderAlignEnable(boolean bNewEnable) {
        this.enableInt(13, bNewEnable);
    }

    public TextStream leaderContent() {
        if (!this.mbLeaderContentEnable || this.mpoExtra == null || this.mpoExtra.mpoLeaderContent == null) {
            return TextStream.defaultStream();
        }
        return this.mpoExtra.mpoLeaderContent;
    }

    public void leaderContent(TextStream oNewLeaderContent) {
        if (oNewLeaderContent.posnCount() == 0) {
            if (this.mpoExtra != null) {
                this.mpoExtra.clearLeaderContent();
            }
        } else {
            this.needExtra();
            this.mpoExtra.setLeaderContent(oNewLeaderContent, this.fontService());
        }
        this.mbLeaderContentEnable = true;
    }

    public boolean leaderContentEnable() {
        return this.mbLeaderContentEnable;
    }

    public void leaderContentEnable(boolean bNewEnable) {
        this.mbLeaderContentEnable = bNewEnable;
    }

    public int ruleStyle() {
        return this.getIntValue(14);
    }

    public void ruleStyle(int eNewRuleStyle) {
        this.setIntValue(14, eNewRuleStyle);
    }

    public boolean ruleStyleEnable() {
        return this.isIntEnabled(14);
    }

    public void ruleStyleEnable(boolean bNewEnable) {
        this.enableInt(14, bNewEnable);
    }

    public TextMeasurement ruleThickness() {
        return this.getUnitValue(10);
    }

    public void ruleThickness(TextMeasurement oNewRuleThickness) {
        this.setUnitValue(10, oNewRuleThickness);
    }

    public boolean ruleThicknessEnable() {
        return this.isUnitEnabled(10);
    }

    public void ruleThicknessEnable(boolean bNewEnable) {
        this.enableUnit(10, bNewEnable);
    }

    public double horizontalScale() {
        return this.getFloatValue(0);
    }

    public void horizontalScale(double nNewHorizontalScale) {
        this.setFloatValue(0, nNewHorizontalScale);
        FontDesc oFontDesc = new FontDesc();
        oFontDesc.setHorizontalScale(nNewHorizontalScale);
        this.updateFont(oFontDesc);
    }

    public boolean horizontalScaleEnable() {
        return this.isFloatEnabled(0);
    }

    public void horizontalScaleEnable(boolean bNewEnable) {
        this.enableFloat(0, bNewEnable);
        this.updateFont();
    }

    public double verticalScale() {
        return this.getFloatValue(1);
    }

    public void verticalScale(double nNewVerticalScale) {
        this.setFloatValue(1, nNewVerticalScale);
        FontDesc oFontDesc = new FontDesc();
        oFontDesc.setVerticalScale(nNewVerticalScale);
        this.updateFont(oFontDesc);
    }

    public boolean verticalScaleEnable() {
        return this.isFloatEnabled(1);
    }

    public void verticalScaleEnable(boolean bNewEnable) {
        this.enableFloat(1, bNewEnable);
        this.updateFont();
    }

    public void setDefault(boolean bDefault) {
        if (bDefault) {
            UnitSpan o12pt = new UnitSpan(19, 12000);
            int iWeight = 400;
            boolean bItalic = false;
            this.moFontInstance = null;
            String sDefaultTypeface = "Courier Std";
            FontDesc oFontDesc = new FontDesc();
            oFontDesc.setTypeface(sDefaultTypeface);
            oFontDesc.setSize(o12pt);
            oFontDesc.setWeight(iWeight);
            oFontDesc.setItalic(bItalic);
            oFontDesc.setEncoding("iso8859-1");
            oFontDesc.setHorizontalScale(1.0);
            oFontDesc.setVerticalScale(1.0);
            this.updateFont(oFontDesc);
            this.setGfxTextAttrDefault(true);
            this.transparent(false);
            this.justifyV(1);
            this.justifyH(5);
            this.tabs(TextTabList.DEFAULT_TAB_LIST);
            this.invisible(false);
            this.localeEnable(true);
            if (this.mpoExtra != null) {
                this.mpoExtra.initialize();
            }
            this.spacingEnable(true);
            this.marginLEnable(true);
            this.marginREnable(true);
            this.radixOffsetEnable(true);
            this.radixPosEnable(true);
            this.specialEnable(true);
            this.spaceBeforeEnable(true);
            this.spaceAfterEnable(true);
            this.invisCharEnable(true);
            this.baselineShiftEnable(true);
            this.digitsEnable(true);
            this.directionEnable(true);
            this.paraDirectionEnable(true);
            this.layoutOrientationEnable(true);
            this.ligatureEnable(true);
            this.charSpacingEnable(true);
            this.wordSpacingEnable(true);
            this.kerning(false);
            this.hyphLevelEnable(true);
            this.hyphMinWordEnable(true);
            this.hyphMinPrefixEnable(true);
            this.hyphMinSuffixEnable(true);
            this.hyphMaxLinesEnable(true);
            this.hyphSuppressNames(false);
            this.hyphSuppressAcronyms(false);
            this.leaderPatternEnable(true);
            this.leaderPatternWidthEnable(true);
            this.leaderAlignEnable(true);
            this.leaderContentEnable(true);
            this.ruleStyleEnable(true);
            this.ruleThicknessEnable(true);
        } else {
            this.fontEnable(false);
            this.typefaceEnable(false);
            this.encodingEnable(false);
            this.sizeEnable(false);
            this.weightEnable(false);
            this.italicEnable(false);
            this.horizontalScaleEnable(false);
            this.verticalScaleEnable(false);
            this.setGfxTextAttrDefault(false);
            this.transparent(false);
            this.transparentEnable(false);
            this.spacingEnable(false);
            this.marginLEnable(false);
            this.marginREnable(false);
            this.justifyVEnable(false);
            this.justifyHEnable(false);
            this.radixOffsetEnable(false);
            this.radixPosEnable(false);
            this.tabsEnable(false);
            this.specialEnable(false);
            this.spaceBeforeEnable(false);
            this.spaceAfterEnable(false);
            this.invisible(false);
            this.invisibleEnable(false);
            this.invisCharEnable(false);
            this.baselineShiftEnable(false);
            this.localeEnable(false);
            this.digitsEnable(false);
            this.directionEnable(false);
            this.paraDirectionEnable(false);
            this.layoutOrientationEnable(false);
            this.ligatureEnable(false);
            this.charSpacingEnable(false);
            this.wordSpacingEnable(false);
            this.kerning(false);
            this.kerningEnable(false);
            this.hyphLevelEnable(false);
            this.hyphMinWordEnable(false);
            this.hyphMinPrefixEnable(false);
            this.hyphMinSuffixEnable(false);
            this.hyphMaxLinesEnable(false);
            this.hyphSuppressNamesEnable(false);
            this.hyphSuppressAcronymsEnable(false);
            this.leaderPatternEnable(false);
            this.leaderPatternWidthEnable(false);
            this.leaderAlignEnable(false);
            this.leaderContentEnable(false);
            this.ruleStyleEnable(false);
            this.ruleThicknessEnable(false);
        }
    }

    public void addDisabled(TextAttr oSource) {
        AttrCopy copier = new AttrCopy(oSource, 2);
        copier.copy(this);
    }

    public void override(TextAttr oOverride, TextAttr poDiffs) {
        AttrCopy copier = new AttrCopy(oOverride, 1);
        copier.copy(this, poDiffs);
    }

    public void override(TextAttr oOverride) {
        this.override(oOverride, null);
    }

    public void dropDiff(TextAttr oCompare) {
        int i;
        if (oCompare.fontEnable() && !FontInstance.match(this.moFontInstance, oCompare.moFontInstance)) {
            this.fontEnable(false);
        }
        if (this.typefaceEnable() && oCompare.typefaceEnable() && !this.typeface().equals(oCompare.typeface())) {
            this.typefaceEnable(false);
        }
        if (this.encodingEnable() && oCompare.encodingEnable() && this.encoding() != oCompare.encoding()) {
            this.encodingEnable(false);
        }
        if (this.sizeEnable() && oCompare.sizeEnable() && this.size() != oCompare.size()) {
            this.sizeEnable(false);
        }
        if (this.weightEnable() && oCompare.weightEnable() && this.weight() != oCompare.weight()) {
            this.weightEnable(false);
        }
        if (this.italicEnable() && oCompare.italicEnable() && this.italic() != oCompare.italic()) {
            this.italicEnable(false);
        }
        if (this.horizontalScaleEnable() && oCompare.horizontalScaleEnable() && this.horizontalScale() != oCompare.horizontalScale()) {
            this.horizontalScaleEnable(false);
        }
        if (this.verticalScaleEnable() && oCompare.verticalScaleEnable() && this.verticalScale() != oCompare.verticalScale()) {
            this.verticalScaleEnable(false);
        }
        if (this.underlineEnable() && oCompare.underlineEnable() && this.underline() != oCompare.underline()) {
            this.underlineEnable(false);
        }
        if (this.overlineEnable() && oCompare.overlineEnable() && this.overline() != oCompare.overline()) {
            this.overlineEnable(false);
        }
        if (this.strikeoutEnable() && oCompare.strikeoutEnable() && this.strikeout() != oCompare.strikeout()) {
            this.strikeoutEnable(false);
        }
        if (this.overlineEnable() && oCompare.overlineEnable() && this.overline() != oCompare.overline()) {
            this.overlineEnable(false);
        }
        if (this.colourEnable() && oCompare.colourEnable() && this.colour() != oCompare.colour()) {
            this.colourEnable(false);
        }
        if (this.colourBgEnable() && oCompare.colourBgEnable() && this.colourBg() != oCompare.colourBg()) {
            this.colourBgEnable(false);
        }
        if (this.styleEnable() && oCompare.styleEnable() && this.style() != oCompare.style()) {
            this.styleEnable(false);
        }
        if (this.shadeEnable() && oCompare.shadeEnable() && this.shade() != oCompare.shade()) {
            this.shadeEnable(false);
        }
        if (this.shadeScaleEnable() && oCompare.shadeScaleEnable() && this.shadeScale() != oCompare.shadeScale()) {
            this.shadeScaleEnable(false);
        }
        if (this.graphicContextEnable() && oCompare.graphicContextEnable() && this.graphicContext() != oCompare.graphicContext()) {
            this.graphicContextEnable(false);
        }
        if (this.justifyVEnable() && oCompare.justifyVEnable() && this.justifyV() != oCompare.justifyV()) {
            this.justifyVEnable(false);
        }
        if (this.justifyHEnable() && oCompare.justifyHEnable() && this.justifyH() != oCompare.justifyH()) {
            this.justifyHEnable(false);
        }
        if (this.tabsEnable() && oCompare.tabsEnable() && this.tabs() != oCompare.tabs()) {
            this.tabsEnable(false);
        }
        if (this.baselineShiftEnable() && oCompare.baselineShiftEnable() && this.baselineShift() != oCompare.baselineShift()) {
            this.baselineShiftEnable(false);
        }
        if (this.localeEnable() && oCompare.localeEnable() && this.locale() != oCompare.locale()) {
            this.localeEnable(false);
        }
        if (this.leaderContentEnable() && oCompare.leaderContentEnable() && this.leaderContent() != oCompare.leaderContent()) {
            this.leaderContentEnable(false);
        }
        for (i = 0; i < 6; ++i) {
            if (i == 0 || !this.isBoolEnabled(i) || !oCompare.isBoolEnabled(i) || this.getBoolValue(i) == oCompare.getBoolValue(i)) continue;
            this.enableBool(i, false);
        }
        for (i = 0; i < 11; ++i) {
            if (!this.isUnitEnabled(i) || !oCompare.isUnitEnabled(i) || this.getUnitValue(i) == oCompare.getUnitValue(i)) continue;
            this.enableUnit(i, false);
        }
        for (i = 0; i < 15; ++i) {
            if (!this.isIntEnabled(i) || !oCompare.isIntEnabled(i) || this.getIntValue(i) == oCompare.getIntValue(i)) continue;
            this.enableInt(i, false);
        }
        for (i = 0; i < 2; ++i) {
            if (i == 0 || i == 1 || !this.isFloatEnabled(i) || !oCompare.isFloatEnabled(i) || this.getFloatValue(i) == oCompare.getFloatValue(i)) continue;
            this.enableFloat(i, false);
        }
    }

    public void dropSame(TextAttr oCompare, boolean bPreserveGfx) {
        int i;
        boolean bPreserving = bPreserveGfx;
        if (this.fontEnable() && oCompare.fontEnable() && FontInstance.match(this.moFontInstance, oCompare.moFontInstance)) {
            this.fontEnable(false);
        }
        if (this.typefaceEnable() && oCompare.typefaceEnable() && this.typeface().equals(oCompare.typeface())) {
            this.typefaceEnable(false);
        }
        if (this.sizeEnable() && oCompare.sizeEnable() && UnitSpan.match(this.size(), oCompare.size())) {
            this.sizeEnable(false);
        }
        if (this.weightEnable() && oCompare.weightEnable() && this.weight() == oCompare.weight()) {
            this.weightEnable(false);
        }
        if (this.italicEnable() && oCompare.italicEnable() && this.italic() == oCompare.italic()) {
            this.italicEnable(false);
        }
        if (this.horizontalScaleEnable() && oCompare.horizontalScaleEnable() && this.horizontalScale() == oCompare.horizontalScale()) {
            this.horizontalScaleEnable(false);
        }
        if (this.verticalScaleEnable() && oCompare.verticalScaleEnable() && this.verticalScale() == oCompare.verticalScale()) {
            this.verticalScaleEnable(false);
        }
        if (this.encodingEnable() && oCompare.encodingEnable() && this.encoding() == oCompare.encoding()) {
            this.encodingEnable(false);
        }
        if (!(this.typefaceEnable() && this.sizeEnable() && this.weightEnable() && this.italicEnable() && this.horizontalScaleEnable() && this.verticalScaleEnable())) {
            this.fontEnable(false);
        }
        boolean bSkipGfx = false;
        if (bPreserving) {
            // empty if block
        }
        if (!bSkipGfx) {
            if (this.underlineEnable() && oCompare.underlineEnable() && this.underline() == oCompare.underline()) {
                this.underlineEnable(false);
            }
            if (this.overlineEnable() && oCompare.overlineEnable() && this.overline() == oCompare.overline()) {
                this.overlineEnable(false);
            }
            if (this.strikeoutEnable() && oCompare.strikeoutEnable() && this.strikeout() == oCompare.strikeout()) {
                this.strikeoutEnable(false);
            }
            if (this.overlineEnable() && oCompare.overlineEnable() && this.overline() == oCompare.overline()) {
                this.overlineEnable(false);
            }
            if (this.colourEnable() && oCompare.colourEnable() && this.colour() == oCompare.colour()) {
                this.colourEnable(false);
            }
            if (this.colourBgEnable() && oCompare.colourBgEnable() && this.colourBg() == oCompare.colourBg()) {
                this.colourBgEnable(false);
            }
            if (this.styleEnable() && oCompare.styleEnable() && this.style() == oCompare.style()) {
                this.styleEnable(false);
            }
            if (this.shadeEnable() && oCompare.shadeEnable() && this.shade() == oCompare.shade()) {
                this.shadeEnable(false);
            }
            if (this.shadeScaleEnable() && oCompare.shadeScaleEnable() && this.shadeScale() == oCompare.shadeScale()) {
                this.shadeScaleEnable(false);
            }
            if (this.graphicContextEnable() && oCompare.graphicContextEnable() && this.graphicContext() == oCompare.graphicContext()) {
                this.graphicContextEnable(false);
            }
        }
        if (this.justifyVEnable() && oCompare.justifyVEnable() && this.justifyV() == oCompare.justifyV()) {
            this.justifyVEnable(false);
        }
        if (this.justifyHEnable() && oCompare.justifyHEnable() && this.justifyH() == oCompare.justifyH()) {
            this.justifyHEnable(false);
        }
        if (this.tabsEnable() && oCompare.tabsEnable() && this.tabs() == oCompare.tabs()) {
            this.tabsEnable(false);
        }
        if (this.baselineShiftEnable() && oCompare.baselineShiftEnable() && this.baselineShift() == oCompare.baselineShift()) {
            this.baselineShiftEnable(false);
        }
        if (this.localeEnable() && oCompare.localeEnable() && this.locale() == oCompare.locale()) {
            this.localeEnable(false);
        }
        if (this.leaderContentEnable() && oCompare.leaderContentEnable() && this.leaderContent() == oCompare.leaderContent()) {
            this.leaderContentEnable(false);
        }
        for (i = 0; i < 6; ++i) {
            if (i == 0 || !this.isBoolEnabled(i) || !oCompare.isBoolEnabled(i) || this.getBoolValue(i) != oCompare.getBoolValue(i)) continue;
            this.enableBool(i, false);
        }
        for (i = 0; i < 11; ++i) {
            if (!this.isUnitEnabled(i) || !oCompare.isUnitEnabled(i) || this.getUnitValue(i) != oCompare.getUnitValue(i)) continue;
            this.enableUnit(i, false);
        }
        for (i = 0; i < 15; ++i) {
            if (!this.isIntEnabled(i) || !oCompare.isIntEnabled(i) || this.getIntValue(i) != oCompare.getIntValue(i)) continue;
            this.enableInt(i, false);
        }
        for (i = 0; i < 2; ++i) {
            if (i == 0 || i == 1 || !this.isFloatEnabled(i) || !oCompare.isFloatEnabled(i) || this.getFloatValue(i) != oCompare.getFloatValue(i)) continue;
            this.enableFloat(i, false);
        }
    }

    public void dropSame(TextAttr oCompare) {
        this.dropSame(oCompare, false);
    }

    public void isolatePara(boolean bKeep, boolean bLegacyPositioning) {
        if (bKeep) {
            this.fontEnable(false);
            this.typefaceEnable(false);
            this.encodingEnable(false);
            this.sizeEnable(false);
            this.weightEnable(false);
            this.italicEnable(false);
            this.horizontalScaleEnable(false);
            this.verticalScaleEnable(false);
            this.underlineEnable(false);
            this.overlineEnable(false);
            this.strikeoutEnable(false);
            this.overlineEnable(false);
            this.colourEnable(false);
            this.colourBgEnable(false);
            this.styleEnable(false);
            this.shadeEnable(false);
            this.shadeScaleEnable(false);
            this.graphicContextEnable(false);
            this.transparentEnable(false);
            this.invisibleEnable(false);
            this.invisCharEnable(false);
            this.baselineShiftEnable(false);
            this.localeEnable(false);
            this.digitsEnable(false);
            this.directionEnable(false);
            this.ligatureEnable(false);
            this.charSpacingEnable(false);
            this.wordSpacingEnable(false);
            this.kerningEnable(false);
            this.leaderPatternEnable(false);
            this.leaderPatternWidthEnable(false);
            this.leaderAlignEnable(false);
            this.leaderContentEnable(false);
            this.ruleStyleEnable(false);
            this.ruleThicknessEnable(false);
        } else {
            this.marginLEnable(false);
            this.marginREnable(false);
            this.justifyVEnable(false);
            this.justifyHEnable(false);
            this.radixOffsetEnable(false);
            this.radixPosEnable(false);
            this.tabsEnable(false);
            this.specialEnable(false);
            this.spaceBeforeEnable(false);
            this.spaceAfterEnable(false);
            this.paraDirectionEnable(false);
            this.layoutOrientationEnable(false);
            this.hyphLevelEnable(false);
            this.hyphMinWordEnable(false);
            this.hyphMinPrefixEnable(false);
            this.hyphMinSuffixEnable(false);
            this.hyphMaxLinesEnable(false);
            this.hyphSuppressNamesEnable(false);
            this.hyphSuppressAcronymsEnable(false);
        }
        if (bKeep == bLegacyPositioning) {
            this.spacingEnable(false);
        }
    }

    public void isolatePara(boolean bKeep) {
        this.isolatePara(bKeep, false);
    }

    public boolean isComplete() {
        return this.typefaceEnable() && this.encodingEnable() && this.sizeEnable() && this.weightEnable() && this.italicEnable() && this.horizontalScaleEnable() && this.verticalScaleEnable() && this.gfxTextAttrEnable() && this.transparentEnable() && this.spacingEnable() && this.marginLEnable() && this.marginREnable() && this.justifyVEnable() && this.justifyHEnable() && this.radixOffsetEnable() && this.radixPosEnable() && this.tabsEnable() && this.specialEnable() && this.spaceBeforeEnable() && this.spaceAfterEnable() && this.invisibleEnable() && this.invisCharEnable() && this.baselineShiftEnable() && this.localeEnable() && this.digitsEnable() && this.directionEnable() && this.paraDirectionEnable() && this.layoutOrientationEnable() && this.ligatureEnable() && this.charSpacingEnable() && this.wordSpacingEnable() && this.kerningEnable() && this.hyphLevelEnable() && this.hyphMinWordEnable() && this.hyphMinPrefixEnable() && this.hyphMinSuffixEnable() && this.hyphMaxLinesEnable() && this.hyphSuppressNamesEnable() && this.hyphSuppressAcronymsEnable() && this.leaderPatternEnable() && this.leaderPatternWidthEnable() && this.leaderAlignEnable() && this.leaderContentEnable() && this.ruleStyleEnable() && this.ruleThicknessEnable();
    }

    public boolean isEmpty() {
        return !this.typefaceEnable() && !this.encodingEnable() && !this.sizeEnable() && !this.weightEnable() && !this.italicEnable() && !this.horizontalScaleEnable() && !this.verticalScaleEnable() && !this.underlineEnable() && !this.overlineEnable() && !this.strikeoutEnable() && !this.overlineEnable() && !this.colourEnable() && !this.colourBgEnable() && !this.styleEnable() && !this.shadeEnable() && !this.shadeScaleEnable() && !this.graphicContextEnable() && !this.transparentEnable() && !this.spacingEnable() && !this.marginLEnable() && !this.marginREnable() && !this.justifyVEnable() && !this.justifyHEnable() && !this.radixOffsetEnable() && !this.radixPosEnable() && !this.tabsEnable() && !this.specialEnable() && !this.spaceBeforeEnable() && !this.spaceAfterEnable() && !this.invisibleEnable() && !this.invisCharEnable() && !this.baselineShiftEnable() && !this.localeEnable() && !this.digitsEnable() && !this.directionEnable() && !this.paraDirectionEnable() && !this.layoutOrientationEnable() && !this.ligatureEnable() && !this.charSpacingEnable() && !this.wordSpacingEnable() && !this.kerningEnable() && !this.hyphLevelEnable() && !this.hyphMinWordEnable() && !this.hyphMinPrefixEnable() && !this.hyphMinSuffixEnable() && !this.hyphMaxLinesEnable() && !this.hyphSuppressNamesEnable() && !this.hyphSuppressAcronymsEnable() && !this.leaderPatternEnable() && !this.leaderPatternWidthEnable() && !this.leaderAlignEnable() && !this.leaderContentEnable() && !this.ruleStyleEnable() && !this.ruleThicknessEnable();
    }

    public boolean hasParaAttrs() {
        return this.marginLEnable() || this.marginREnable() || this.justifyVEnable() || this.justifyHEnable() || this.radixOffsetEnable() || this.radixPosEnable() || this.tabsEnable() || this.specialEnable() || this.spacingEnable() || this.spaceBeforeEnable() || this.spaceAfterEnable() || this.paraDirectionEnable() || this.layoutOrientationEnable() || this.hyphLevelEnable() || this.hyphMinWordEnable() || this.hyphMinPrefixEnable() || this.hyphMinSuffixEnable() || this.hyphMaxLinesEnable() || this.hyphSuppressNamesEnable() || this.hyphSuppressAcronymsEnable();
    }

    public static String formatPercent(double dRelative) {
        return Units.doubleToString(dRelative, 3) + '%';
    }

    public static double parsePercent(String sText, boolean bAllowNegative) {
        int last;
        double dValue = 0.0;
        StringBuilder sContent = new StringBuilder(sText);
        for (last = sContent.length() - 1; last > 0 && sContent.charAt(last) == ' '; --last) {
        }
        if (last >= 0 && sContent.charAt(last) == '%') {
            --last;
        }
        sContent.delete(last + 1, sContent.length());
        try {
            dValue = Double.parseDouble(sContent.toString());
        }
        catch (NumberFormatException e) {
            return Double.NaN;
        }
        if (!bAllowNegative && dValue < 0.0) {
            return Double.NaN;
        }
        return dValue / 100.0;
    }

    public void copyFrom(TextAttr oSource) {
        this.moGfxSource = oSource.moGfxSource;
        this.moFontInstance = oSource.moFontInstance;
        this.msTypeface = oSource.msTypeface;
        this.msOriginalTypeface = oSource.msOriginalTypeface;
        assert (this.msOriginalTypeface != null);
        this.msEncoding = oSource.msEncoding;
        this.moSize = oSource.moSize;
        this.miWeight = oSource.miWeight;
        super.copyFrom(oSource);
        if (oSource.mpoExtra == null) {
            if (this.mpoExtra != null) {
                this.mpoExtra.initialize();
            }
        } else {
            this.needExtra();
            this.mpoExtra.copyFrom(oSource.mpoExtra);
        }
        this.meJustifyV = oSource.meJustifyV;
        this.meJustifyH = oSource.meJustifyH;
        if (oSource.mpoTabs == null) {
            this.tabsEnable(false);
        } else {
            this.mpoTabs = oSource.mpoTabs;
        }
        this.msLocale = oSource.msLocale;
        this.mbBoolValue = oSource.mbBoolValue;
        this.mbBoolEnable = oSource.mbBoolEnable;
        this.mbUnitEnable = oSource.mbUnitEnable;
        this.mbIntEnable = oSource.mbIntEnable;
        this.mbFloatEnable = oSource.mbFloatEnable;
        this.mbBaselineShiftEnable = oSource.mbBaselineShiftEnable;
        this.mbJustifyVEnable = oSource.mbJustifyVEnable;
        this.mbJustifyHEnable = oSource.mbJustifyHEnable;
        this.mbLocaleEnable = oSource.mbLocaleEnable;
        this.mbLeaderContentEnable = oSource.mbLeaderContentEnable;
    }

    @Override
    public boolean equals(Object object) {
        int i;
        if (this == object) {
            return true;
        }
        if (!super.equals(object)) {
            return false;
        }
        TextAttr oCompare = (TextAttr)object;
        if (this.fontEnable() != oCompare.fontEnable()) {
            return false;
        }
        if (this.typefaceEnable() != oCompare.typefaceEnable()) {
            return false;
        }
        if (this.encodingEnable() != oCompare.encodingEnable()) {
            return false;
        }
        if (this.sizeEnable() != oCompare.sizeEnable()) {
            return false;
        }
        if (this.weightEnable() != oCompare.weightEnable()) {
            return false;
        }
        if (this.justifyVEnable() != oCompare.justifyVEnable()) {
            return false;
        }
        if (this.justifyHEnable() != oCompare.justifyHEnable()) {
            return false;
        }
        if (this.tabsEnable() != oCompare.tabsEnable()) {
            return false;
        }
        if (this.baselineShiftEnable() != oCompare.baselineShiftEnable()) {
            return false;
        }
        if (this.localeEnable() != oCompare.localeEnable()) {
            return false;
        }
        if (this.leaderContentEnable() != oCompare.leaderContentEnable()) {
            return false;
        }
        if (this.mbUnitEnable != oCompare.mbUnitEnable) {
            return false;
        }
        if (this.mbIntEnable != oCompare.mbIntEnable) {
            return false;
        }
        if (this.mbBoolEnable != oCompare.mbBoolEnable) {
            return false;
        }
        if (this.mbFloatEnable != oCompare.mbFloatEnable) {
            return false;
        }
        if (this.fontEnable() && !FontInstance.match(this.fontInstance(), oCompare.fontInstance())) {
            return false;
        }
        if (this.typefaceEnable() && this.typeface() != oCompare.typeface()) {
            return false;
        }
        if (this.encodingEnable() && this.encoding() != oCompare.encoding()) {
            return false;
        }
        if (this.sizeEnable() && this.size() != oCompare.size()) {
            return false;
        }
        if (this.weightEnable() && this.weight() != oCompare.weight()) {
            return false;
        }
        if (this.justifyVEnable() && this.justifyV() != oCompare.justifyV()) {
            return false;
        }
        if (this.justifyHEnable() && this.justifyH() != oCompare.justifyH()) {
            return false;
        }
        if (this.tabsEnable() && this.tabs() != oCompare.tabs()) {
            return false;
        }
        if (this.baselineShiftEnable() && this.baselineShift() != oCompare.baselineShift()) {
            return false;
        }
        if (this.localeEnable() && this.locale() != oCompare.locale()) {
            return false;
        }
        for (i = 0; i < 11; ++i) {
            if (!this.isUnitEnabled(i) || TextMeasurement.match(this.getUnitValue(i), oCompare.getUnitValue(i))) continue;
            return false;
        }
        for (i = 0; i < 15; ++i) {
            if (!this.isIntEnabled(i) || this.getIntValue(i) == oCompare.getIntValue(i)) continue;
            return false;
        }
        for (i = 0; i < 6; ++i) {
            if (!this.isBoolEnabled(i) || this.getBoolValue(i) == oCompare.getBoolValue(i)) continue;
            return false;
        }
        for (i = 0; i < 2; ++i) {
            if (!this.isFloatEnabled(i) || this.getFloatValue(i) == oCompare.getFloatValue(i)) continue;
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int i;
        int hashCode = 13;
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.fontEnable()).hashCode();
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.typefaceEnable()).hashCode();
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.encodingEnable()).hashCode();
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.sizeEnable()).hashCode();
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.weightEnable()).hashCode();
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.justifyVEnable()).hashCode();
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.justifyHEnable()).hashCode();
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.tabsEnable()).hashCode();
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.baselineShiftEnable()).hashCode();
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.localeEnable()).hashCode();
        hashCode = hashCode * 31 ^ Boolean.valueOf(this.leaderContentEnable()).hashCode();
        hashCode = hashCode * 31 ^ this.mbUnitEnable;
        hashCode = hashCode * 31 ^ this.mbIntEnable;
        hashCode = hashCode * 31 ^ this.mbBoolEnable;
        hashCode = hashCode * 31 ^ this.mbFloatEnable;
        if (this.fontEnable()) {
            hashCode = hashCode * 31 ^ this.fontInstance().hashCode();
        }
        if (this.typefaceEnable()) {
            hashCode = hashCode * 31 ^ this.typeface().hashCode();
        }
        if (this.encodingEnable()) {
            hashCode = hashCode * 31 ^ this.encoding().hashCode();
        }
        if (this.sizeEnable()) {
            hashCode = hashCode * 31 ^ this.size().hashCode();
        }
        if (this.weightEnable()) {
            hashCode = hashCode * 31 ^ this.weight();
        }
        if (this.justifyVEnable()) {
            hashCode = hashCode * 31 ^ this.justifyV();
        }
        if (this.justifyHEnable()) {
            hashCode = hashCode * 31 ^ this.justifyH();
        }
        if (this.tabsEnable()) {
            hashCode = hashCode * 31 ^ this.tabs().hashCode();
        }
        if (this.baselineShiftEnable()) {
            hashCode = hashCode * 31 ^ this.baselineShift().hashCode();
        }
        if (this.localeEnable()) {
            hashCode = hashCode * 31 ^ this.locale().hashCode();
        }
        for (i = 0; i < 11; ++i) {
            if (!this.isUnitEnabled(i)) continue;
            hashCode = hashCode * 31 ^ this.getUnitValue(i).hashCode();
        }
        for (i = 0; i < 15; ++i) {
            if (!this.isIntEnabled(i)) continue;
            hashCode = hashCode * 31 ^ this.getIntValue(i);
        }
        for (i = 0; i < 6; ++i) {
            if (!this.isBoolEnabled(i)) continue;
            hashCode = hashCode * 31 ^ Boolean.valueOf(this.getBoolValue(i)).hashCode();
        }
        for (i = 0; i < 2; ++i) {
            if (!this.isFloatEnabled(i)) continue;
            long bits = Double.doubleToLongBits(this.getFloatValue(i));
            hashCode = hashCode * 31 ^ (int)(bits ^ bits >>> 32);
        }
        return hashCode;
    }

    public boolean notEqual(TextAttr oCompare) {
        return !this.equals(oCompare);
    }

    public static boolean match(TextAttr poAttr1, TextAttr poAttr2) {
        if (poAttr1 == poAttr2) {
            return true;
        }
        if (poAttr1 == null || poAttr2 == null) {
            return false;
        }
        return poAttr1.equals(poAttr2);
    }

    public static TextAttr defaultAttr(boolean bDefault) {
        return bDefault ? defaultFull : defaultEmpty;
    }

    public void updateFont() {
        this.updateFont((FontDesc)null);
    }

    public void updateFont(FontDesc oNewFontDesc) {
        FontDesc oFontDesc = new FontDesc(this);
        if (oNewFontDesc != null) {
            if (oNewFontDesc.hasTypeface() != 0) {
                this.msTypeface = oNewFontDesc.getTypeface();
                oFontDesc.setTypeface(this.msTypeface);
            }
            if (oNewFontDesc.hasEncoding() != 0) {
                this.msEncoding = oNewFontDesc.getEncoding();
                oFontDesc.setEncoding(this.msEncoding);
            }
            if (oNewFontDesc.hasSize() != 0) {
                this.moSize = oNewFontDesc.getSize();
                oFontDesc.setSize(this.moSize);
            }
            if (oNewFontDesc.hasWeight() != 0) {
                this.miWeight = oNewFontDesc.getWeight();
                oFontDesc.setWeight(this.miWeight);
            }
            if (oNewFontDesc.hasItalic() != 0) {
                this.setBoolValue(0, oNewFontDesc.getItalic());
                oFontDesc.setItalic(this.italic());
            }
            if (oNewFontDesc.hasHorizontalScale() != 0) {
                this.setFloatValue(0, oNewFontDesc.getHorizontalScale());
                oFontDesc.setHorizontalScale(this.horizontalScale());
            }
            if (oNewFontDesc.hasVerticalScale() != 0) {
                this.setFloatValue(1, oNewFontDesc.getVerticalScale());
                oFontDesc.setVerticalScale(this.verticalScale());
            }
        }
        if (!oFontDesc.isValid() || this.fontService() == null) {
            this.cleanupFont();
            return;
        }
        ReconcileInfo reconcile = this.reconcileFont(this.fontService(), oFontDesc);
        if (reconcile.mFontInstance != null) {
            this.updateFont(reconcile.mFontInstance, reconcile.mOriginalTypeface);
        }
    }

    public void updateFont(FontInstance oNewFont, String sOriginalTypeface, boolean bUpdateOptional) {
        if (oNewFont == null && this.moFontInstance == null) {
            return;
        }
        this.cleanupFont();
        if (oNewFont == null) {
            return;
        }
        this.moFontInstance = oNewFont;
        this.msTypeface = this.moFontInstance.getTypeface();
        this.moSize = this.moFontInstance.getSize();
        this.miWeight = FontDesc.coerceWeight(this.moFontInstance.getWeight());
        this.setBoolValue(0, this.moFontInstance.getItalic());
        double dHorizontalScale = this.moFontInstance.getHorizontalScale();
        this.setFloatValue(0, dHorizontalScale, bUpdateOptional || dHorizontalScale != 1.0);
        double dVerticalScale = this.moFontInstance.getVerticalScale();
        this.setFloatValue(1, dVerticalScale, bUpdateOptional || dVerticalScale != 1.0);
        this.msOriginalTypeface = sOriginalTypeface == null ? "" : sOriginalTypeface;
    }

    public void updateFont(FontInstance oNewFont, String sOriginalTypeface) {
        this.updateFont(oNewFont, sOriginalTypeface, false);
    }

    public void updateFont(TextAttr oSource) {
        this.moFontInstance = oSource.fontInstance();
        this.msTypeface = oSource.typeface();
        this.msOriginalTypeface = oSource.originalTypeface();
        assert (this.msOriginalTypeface != null);
        this.msEncoding = oSource.encoding();
        this.moSize = oSource.size();
        this.miWeight = oSource.weight();
        this.setBoolValue(0, oSource.italic());
        this.enableBool(0, oSource.italicEnable());
        this.setFloatValue(0, oSource.horizontalScale(), oSource.horizontalScaleEnable());
        this.setFloatValue(1, oSource.verticalScale(), oSource.verticalScaleEnable());
    }

    void updateGfxTextAttr(TextGfxAttr oNewAttr) {
        this.cleanupGfxTextAttr();
        super.copyFrom(oNewAttr);
    }

    static int getDefaultIntValue(int nIndex) {
        switch (nIndex) {
            case 0: {
                return -1;
            }
            case 1: {
                return 32;
            }
            case 2: {
                return 0;
            }
            case 3: {
                return 0;
            }
            case 4: {
                return 0;
            }
            case 5: {
                return 0;
            }
            case 6: {
                return 0;
            }
            case 7: {
                return 0;
            }
            case 8: {
                return 7;
            }
            case 9: {
                return 3;
            }
            case 10: {
                return 3;
            }
            case 11: {
                return 2;
            }
            case 12: {
                return 0;
            }
            case 13: {
                return 0;
            }
            case 14: {
                return 1;
            }
        }
        return 0;
    }

    @Override
    protected void onUpdateGfxTextAttr() {
        this.updateGfxTextAttr(this);
    }

    private void initialize(boolean bDefault) {
        this.mpoExtra = null;
        this.mpoTabs = null;
        this.mbBoolValue = 0;
        this.mbBoolEnable = 0;
        this.mbUnitEnable = 0;
        this.mbIntEnable = 0;
        this.mbFloatEnable = 0;
        this.setDefault(bDefault);
    }

    private void needExtra() {
        if (this.mpoExtra == null) {
            this.mpoExtra = new AttrExtra();
            if (!this.spacingEnable()) {
                this.mpoExtra.moUnit[0] = goDefaultMeasureNeg;
            }
            if (!this.marginLEnable()) {
                this.mpoExtra.moUnit[1] = goDefaultMeasureNeg;
            }
            if (!this.marginREnable()) {
                this.mpoExtra.moUnit[2] = goDefaultMeasureNeg;
            }
            if (!this.spaceBeforeEnable()) {
                this.mpoExtra.moUnit[5] = goDefaultMeasureNeg;
            }
            if (!this.spaceAfterEnable()) {
                this.mpoExtra.moUnit[6] = goDefaultMeasureNeg;
            }
            if (!this.leaderPatternWidthEnable()) {
                this.mpoExtra.moUnit[9] = goDefaultMeasureNeg;
            }
            if (!this.ruleThicknessEnable()) {
                this.mpoExtra.moUnit[10] = goDefaultMeasureNeg;
            }
        }
    }

    public void debug() {
        this.debug(0);
    }

    void debug(int indent) {
        String prefix = Pkg.doIndent(indent + 1);
        System.out.println(prefix + "Text attribute");
        prefix = prefix + ' ';
        if (this.typefaceEnable()) {
            System.out.println(prefix + "Typeface:      " + this.typeface());
        }
        if (this.encodingEnable()) {
            System.out.println(prefix + "Encoding:      " + this.encoding());
        }
        if (this.sizeEnable()) {
            System.out.println(prefix + "Size:          " + this.size());
        }
        if (this.weightEnable()) {
            System.out.println(prefix + "Weight:        " + this.weight());
        }
        if (this.italicEnable()) {
            System.out.println(prefix + "Italic:        " + this.italic());
        }
        if (this.underlineEnable()) {
            System.out.println(prefix + "Underline:     " + this.underline());
        }
        if (this.overlineEnable()) {
            System.out.println(prefix + "Overline:      " + this.overline());
        }
        if (this.strikeoutEnable()) {
            System.out.println(prefix + "Strikeout:     " + this.strikeout());
        }
        if (this.colourEnable()) {
            System.out.println(prefix + "Colour:        " + this.colour().r() + " " + this.colour().g() + " " + this.colour().b());
        }
        if (this.colourBgEnable()) {
            System.out.println(prefix + "ColourBg:      " + this.colourBg().r() + " " + this.colourBg().g() + " " + this.colourBg().b());
        }
        if (this.styleEnable()) {
            System.out.println(prefix + "Style:         " + this.style());
        }
        if (this.shadeEnable()) {
            System.out.println(prefix + "Shade:         " + this.shade());
        }
        if (this.shadeScaleEnable()) {
            System.out.println(prefix + "ShadeScale:    " + this.shadeScale());
        }
        if (this.transparentEnable()) {
            System.out.println(prefix + "Transparent:   " + this.transparent());
        }
        if (this.spacingEnable()) {
            System.out.println(prefix + "Spacing:       " + this.spacing());
        }
        if (this.marginLEnable()) {
            System.out.println(prefix + "MarginL:       " + this.marginL());
        }
        if (this.marginREnable()) {
            System.out.println(prefix + "MarginR:       " + this.marginR());
        }
        if (this.justifyVEnable()) {
            System.out.println(prefix + "JustifyV:      " + this.justifyV());
        }
        if (this.justifyHEnable()) {
            System.out.println(prefix + "JustifyH:      " + this.justifyH());
        }
        if (this.radixOffsetEnable()) {
            System.out.println(prefix + "RadixOffset:   " + this.radixOffset());
        }
        if (this.radixPosEnable()) {
            System.out.println(prefix + "RadixPos:      " + this.radixPos());
        }
        if (this.specialEnable()) {
            System.out.println(prefix + "Special:       " + this.special());
        }
        if (this.spaceBeforeEnable()) {
            System.out.println(prefix + "SpaceBefore:   " + this.spaceBefore());
        }
        if (this.spaceAfterEnable()) {
            System.out.println(prefix + "SpaceAfter:    " + this.spaceAfter());
        }
        if (this.invisibleEnable()) {
            System.out.println(prefix + "Invisible:     " + this.invisible());
        }
        if (this.invisCharEnable()) {
            System.out.println(prefix + "InvisChar:     " + this.invisChar());
        }
        if (this.baselineShiftEnable()) {
            System.out.println(prefix + "BaselineShift: " + this.baselineShift().getString(false));
        }
        if (this.localeEnable()) {
            System.out.println(prefix + "Locale:        " + this.locale());
        }
        if (this.digitsEnable()) {
            System.out.println(prefix + "Digits:        " + this.digits());
        }
        if (this.directionEnable()) {
            System.out.println(prefix + "Direction:     " + this.direction());
        }
        if (this.ligatureEnable()) {
            System.out.println(prefix + "Ligature:      " + this.ligature());
        }
        if (this.tabsEnable()) {
            this.tabs().debug(indent + 1);
        }
    }

    private boolean bitTest(int nIndex, int nMask) {
        return (nMask & 1 << nIndex) != 0;
    }

    private int bitSet(int nIndex, int nMask, boolean bValue) {
        if (bValue) {
            return nMask | 1 << nIndex;
        }
        return nMask & ~ (1 << nIndex);
    }

    private boolean getBoolValue(int nIndex) {
        return this.bitTest(nIndex, this.mbBoolValue);
    }

    private void setBoolValue(int nIndex, boolean bNewValue) {
        this.mbBoolValue = this.bitSet(nIndex, this.mbBoolValue, bNewValue);
        this.enableBool(nIndex, true);
    }

    private boolean isBoolEnabled(int nIndex) {
        return this.bitTest(nIndex, this.mbBoolEnable);
    }

    private void enableBool(int nIndex, boolean bEnable) {
        this.mbBoolEnable = this.bitSet(nIndex, this.mbBoolEnable, bEnable);
    }

    private TextMeasurement getUnitValue(int nIndex) {
        if (this.mpoExtra == null) {
            if (!this.isUnitEnabled(nIndex)) {
                switch (nIndex) {
                    case 0: 
                    case 1: 
                    case 2: 
                    case 6: 
                    case 9: 
                    case 10: {
                        return goDefaultMeasureNeg;
                    }
                }
            }
            return TextMeasurement.zero();
        }
        return this.mpoExtra.moUnit[nIndex];
    }

    private void setUnitValue(int nIndex, TextMeasurement oNewValue) {
        boolean bEnable = true;
        boolean bSet = false;
        if (nIndex == 0 || nIndex == 1 || nIndex == 2 || nIndex == 6 || nIndex == 9 || nIndex == 10) {
            int nValue = oNewValue.getLength().value();
            double nScaleValue = oNewValue.getScale();
            if (nValue > 0) {
                bSet = true;
            } else if (nScaleValue > 0.0 && !this.baselineShiftEnable()) {
                bSet = true;
            } else {
                if (this.mpoExtra != null) {
                    bSet = true;
                }
                if (nValue < 0) {
                    bEnable = false;
                }
            }
        } else if (oNewValue != this.getUnitValue(nIndex)) {
            bSet = true;
        }
        if (bSet) {
            this.needExtra();
            this.mpoExtra.moUnit[nIndex] = oNewValue;
        }
        this.enableUnit(nIndex, bEnable);
    }

    private boolean isUnitEnabled(int nIndex) {
        return this.bitTest(nIndex, this.mbUnitEnable);
    }

    private void enableUnit(int nIndex, boolean bEnable) {
        this.mbUnitEnable = this.bitSet(nIndex, this.mbUnitEnable, bEnable);
    }

    private int getIntValue(int nIndex) {
        if (this.mpoExtra == null) {
            return TextAttr.getDefaultIntValue(nIndex);
        }
        return this.mpoExtra.moInt[nIndex];
    }

    private void setIntValue(int nIndex, int oNewValue) {
        if (oNewValue != this.getIntValue(nIndex)) {
            this.needExtra();
            this.mpoExtra.moInt[nIndex] = oNewValue;
        }
        this.enableInt(nIndex, true);
    }

    public double getFloatValue(int nIndex) {
        if (!this.isFloatEnabled(nIndex)) {
            return -1.0;
        }
        if (this.mpoExtra == null) {
            return 1.0;
        }
        return this.mpoExtra.moFloat[nIndex];
    }

    public void setFloatValue(int nIndex, double nNewValue, boolean bEnable) {
        if (nNewValue < 0.0) {
            bEnable = false;
        }
        if (nNewValue != this.getFloatValue(nIndex)) {
            this.needExtra();
            this.mpoExtra.moFloat[nIndex] = nNewValue;
        }
        if (bEnable) {
            this.enableFloat(nIndex, true);
        }
    }

    public void setFloatValue(int nIndex, double nNewValue) {
        this.setFloatValue(nIndex, nNewValue, true);
    }

    public boolean isFloatEnabled(int nIndex) {
        return this.bitTest(nIndex, this.mbFloatEnable);
    }

    public void enableFloat(int nIndex, boolean bEnable) {
        this.mbFloatEnable = this.bitSet(nIndex, this.mbFloatEnable, bEnable);
    }

    private boolean isIntEnabled(int nIndex) {
        return this.bitTest(nIndex, this.mbIntEnable);
    }

    private void enableInt(int nIndex, boolean bEnable) {
        this.mbIntEnable = this.bitSet(nIndex, this.mbIntEnable, bEnable);
    }

    private ReconcileInfo reconcileFont(FontService poFontService, FontDesc oFontDesc) {
        double dVerticalScale;
        FontInfo oFontInfo = new FontInfo(oFontDesc.getTypeface(), oFontDesc.getWeight(), oFontDesc.getItalic());
        double dHorizontalScale = oFontDesc.getHorizontalScale();
        if (dHorizontalScale < 0.0) {
            dHorizontalScale = 1.0;
        }
        if ((dVerticalScale = oFontDesc.getVerticalScale()) < 0.0) {
            dVerticalScale = 1.0;
        }
        FontInstance oFontInstance = poFontService.reconcile(oFontInfo, this.size(), dHorizontalScale, dVerticalScale);
        assert (oFontInstance != null);
        String sOriginalTypeface = oFontInfo.equals(oFontInstance.getFontItem()) ? "" : oFontDesc.getTypeface();
        return new ReconcileInfo(oFontInstance, sOriginalTypeface);
    }

    private void cleanupGfxTextAttr() {
    }

    private void cleanupFont() {
        if (this.moFontInstance != null) {
            this.msOriginalTypeface = "";
            this.moFontInstance = null;
        }
    }

    private boolean canFlattenBaselineShift() {
        if (!this.baselineShiftEnable()) {
            return false;
        }
        TextBaselineShift oOldShift = this.baselineShift();
        if (oOldShift.isNeutral()) {
            return false;
        }
        if (oOldShift.getType() != 3 && oOldShift.getType() != 4) {
            return false;
        }
        return true;
    }

    private static class ReconcileInfo {
        final FontInstance mFontInstance;
        final String mOriginalTypeface;

        ReconcileInfo(FontInstance fontInstance, String originalTypeface) {
            this.mFontInstance = fontInstance;
            this.mOriginalTypeface = originalTypeface;
        }
    }

    private static class AttrExtra {
        TextMeasurement[] moUnit;
        int[] moInt;
        boolean[] moBool;
        double[] moFloat;
        TextBaselineShift moShift;
        TextAttr mpoOriginalAttr;
        TextStream mpoLeaderContent;

        AttrExtra() {
            this.initialize();
        }

        void initialize() {
            int i;
            this.moUnit = new TextMeasurement[11];
            this.moInt = new int[15];
            this.moFloat = new double[2];
            this.moBool = new boolean[6];
            for (i = 0; i < 11; ++i) {
                this.moUnit[i] = TextMeasurement.zero();
            }
            for (i = 0; i < 15; ++i) {
                this.moInt[i] = TextAttr.getDefaultIntValue(i);
            }
            for (i = 0; i < 2; ++i) {
                this.moFloat[i] = 1.0;
            }
            for (i = 0; i < 6; ++i) {
                this.moBool[i] = false;
            }
        }

        public void setLeaderContent(TextStream oLeaderContent, FontService poFontService) {
            this.clearLeaderContent();
            this.mpoLeaderContent = new TextStream(oLeaderContent);
            this.mpoLeaderContent.fontService(poFontService);
        }

        public void clearLeaderContent() {
            this.mpoLeaderContent = null;
        }

        void copyFrom(AttrExtra oSource) {
            int i;
            for (i = 0; i < 11; ++i) {
                this.moUnit[i] = oSource.moUnit[i];
            }
            for (i = 0; i < 15; ++i) {
                this.moInt[i] = oSource.moInt[i];
            }
            for (i = 0; i < 2; ++i) {
                this.moFloat[i] = oSource.moFloat[i];
            }
            for (i = 0; i < 6; ++i) {
                this.moBool[i] = oSource.moBool[i];
            }
            this.moShift = oSource.moShift;
            this.mpoOriginalAttr = oSource.mpoOriginalAttr;
            if (oSource.mpoLeaderContent != null) {
                this.setLeaderContent(oSource.mpoLeaderContent, oSource.mpoLeaderContent.fontService());
            } else {
                this.clearLeaderContent();
            }
        }
    }

    static class FontDesc {
        public static final int VALUE_ABSENT = 0;
        public static final int VALUE_PRESENT = 1;
        public static final int VALUE_VALID = 2;
        private String msTypeface;
        private String msEncoding;
        private UnitSpan moSize;
        private int mnWeight;
        private double mnHorizontalScale;
        private double mnVerticalScale;
        private boolean mbItalic;
        private boolean mbTypefacePresent;
        private boolean mbEncodingPresent;
        private boolean mbSizePresent;
        private boolean mbWeightPresent;
        private boolean mbItalicPresent;
        private boolean mbHorizontalScalePresent;
        private boolean mbVerticalScalePresent;

        public FontDesc() {
            this.initialize();
        }

        public FontDesc(TextAttr oAttr) {
            this.initialize();
            this.setAttr(oAttr);
        }

        public FontDesc(String sTypeface) {
            this.initialize();
            this.setTypeface(sTypeface);
        }

        public FontDesc(UnitSpan oSize) {
            this.initialize();
            this.setSize(oSize);
        }

        public FontDesc(int nWeight) {
            this.initialize();
            this.setWeight(nWeight);
        }

        public void setAttr(TextAttr oAttr) {
            this.setTypeface(oAttr.typeface());
            this.setEncoding(oAttr.encoding());
            this.setSize(oAttr.size());
            this.setWeight(oAttr.weight());
            this.setItalic(oAttr.italic(), oAttr.italicEnable());
            this.setHorizontalScale(oAttr.horizontalScale(), oAttr.horizontalScaleEnable());
            this.setVerticalScale(oAttr.verticalScale(), oAttr.verticalScaleEnable());
        }

        public int hasTypeface() {
            if (!this.mbTypefacePresent) {
                return 0;
            }
            if (this.msTypeface == null || this.msTypeface.length() == 0) {
                return 1;
            }
            return 2;
        }

        public String getTypeface() {
            return this.msTypeface;
        }

        public void setTypeface(String sTypeface) {
            this.msTypeface = sTypeface;
            this.mbTypefacePresent = true;
        }

        public int hasEncoding() {
            if (!this.mbEncodingPresent) {
                return 0;
            }
            if (this.msEncoding == null || this.msEncoding.length() == 0) {
                return 1;
            }
            return 2;
        }

        public String getEncoding() {
            return this.msEncoding;
        }

        public void setEncoding(String sEncoding) {
            this.msEncoding = sEncoding;
            this.mbEncodingPresent = true;
        }

        public int hasSize() {
            if (!this.mbSizePresent) {
                return 0;
            }
            if (this.moSize.value() < 0) {
                return 1;
            }
            return 2;
        }

        public UnitSpan getSize() {
            return this.moSize;
        }

        public void setSize(UnitSpan oSize) {
            this.moSize = oSize;
            this.mbSizePresent = true;
        }

        public int hasWeight() {
            if (!this.mbWeightPresent) {
                return 0;
            }
            if (this.mnWeight == 0) {
                return 1;
            }
            return 2;
        }

        public int getWeight() {
            return this.mnWeight;
        }

        public void setWeight(int nWeight) {
            this.mnWeight = nWeight == 0 ? nWeight : FontDesc.coerceWeight(nWeight);
            this.mbWeightPresent = true;
        }

        public static int coerceWeight(int nWeight) {
            return nWeight >= 700 ? 700 : 400;
        }

        public int hasItalic() {
            if (!this.mbItalicPresent) {
                return 0;
            }
            return 2;
        }

        public boolean getItalic() {
            return this.mbItalic;
        }

        public void setItalic(boolean bItalic, boolean bEnable) {
            this.mbItalic = bItalic;
            this.mbItalicPresent = bEnable;
        }

        public void setItalic(boolean bItalic) {
            this.setItalic(bItalic, true);
        }

        public int hasHorizontalScale() {
            if (!this.mbHorizontalScalePresent) {
                return 0;
            }
            if (this.mnHorizontalScale <= 0.0) {
                return 1;
            }
            return 2;
        }

        public double getHorizontalScale() {
            return this.mnHorizontalScale;
        }

        public void setHorizontalScale(double nHorizontalScale, boolean bEnable) {
            this.mnHorizontalScale = nHorizontalScale;
            this.mbHorizontalScalePresent = bEnable;
        }

        public void setHorizontalScale(double nHorizontalScale) {
            this.setHorizontalScale(nHorizontalScale, true);
        }

        public int hasVerticalScale() {
            if (!this.mbVerticalScalePresent) {
                return 0;
            }
            if (this.mnVerticalScale <= 0.0) {
                return 1;
            }
            return 2;
        }

        public double getVerticalScale() {
            return this.mnVerticalScale;
        }

        public void setVerticalScale(double nVerticalScale, boolean bEnable) {
            this.mnVerticalScale = nVerticalScale;
            this.mbVerticalScalePresent = bEnable;
        }

        public void setVerticalScale(double nVerticalScale) {
            this.setVerticalScale(nVerticalScale, true);
        }

        public boolean isEmpty() {
            return this.hasTypeface() == 0 && this.hasEncoding() == 0 && this.hasSize() == 0 && this.hasWeight() == 0 && this.hasItalic() == 0 && this.hasHorizontalScale() == 0 && this.hasVerticalScale() == 0;
        }

        public boolean isValid() {
            return this.hasTypeface() == 2 && this.hasSize() == 2 && this.hasWeight() == 2 && this.hasItalic() == 2;
        }

        private void initialize() {
            this.moSize = new UnitSpan(19, -1);
            this.mnWeight = 0;
            this.mbItalic = false;
            this.mnHorizontalScale = -1.0;
            this.mnVerticalScale = -1.0;
            this.mbTypefacePresent = false;
            this.mbEncodingPresent = false;
            this.mbSizePresent = false;
            this.mbWeightPresent = false;
            this.mbItalicPresent = false;
            this.mbHorizontalScalePresent = false;
            this.mbVerticalScalePresent = false;
        }
    }

}