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 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077
|
2025-09-11 Werner Lemberg <wl@gnu.org>
* Version 2.14.1 released.
==========================
Tag sources with `VER-2-14-1'.
* docs/VERSION.TXT: Add entry for version 2.14.1.
* docs/CHANGES: Updated.
* docs/release, docs/README, builds/macs/README: Updated.
* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.14.0/2.14.1/, s/2140/2141/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.
* builds/unix/configure.raw (version_info): Set to 26:4:20.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
2025-09-10 Behdad Esfahbod <behdad@behdad.org>
[base] Fix return values of two Font Variation functions.
* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): Do it.
Fixes issue #1355.
2025-09-10 Werner Lemberg <wl@gnu.org>
* src/autofit/afgsub.c (af_map_lookup): Fix handling of lookup type 7.
Fixes issue #1356.
2025-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (TT_Run_Context): Fix IUP tracking bits.
Correctly fixes #1353 and #1349.
2025-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
Typo!
2025-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (TT_Run_Context): Reset IUP tracking bits.
Fixes #1353.
2025-09-08 Behdad Esfahbod <behdad@behdad.org>
[autofit] Fix HarfBuzz calling.
* src/autofit/afadjust.c (af_reverse_character_map_new)
[FT_CONFIG_OPTION_USE_HARFBUZZ]: Use `ft_hb_enabled`.
Fixes issue #1354.
2025-09-08 Werner Lemberg <wl@gnu.org>
* docs/release: Use `sshpass` for SourceForge.net password.
2025-09-08 Werner Lemberg <wl@gnu.org>
* docs/release: Fix `scp` usage with OpenSSH version >= 9.0.
Starting with this version, OpenSSH uses `scp` with the SFTP protocol as the
default. However, SFTP is disabled on savannah.gnu.org since January 2025.
2025-09-06 Werner Lemberg <wl@gnu.org>
* Version 2.14.0 released.
==========================
Tag sources with `VER-2-14-0'.
* docs/VERSION.TXT: Add entry for version 2.14.0.
* docs/CHANGES: Updated.
* docs/release, docs/README, builds/macs/README: Updated.
* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.13.3/2.14.0/, s/2133/2140/.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 14.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.raw (version_info): Set to 26:3:20.
* CMakeLists.txt (VERSION_MINOR): Set to 14.
(VERSION_PATCH): Set to 0.
2025-09-06 Werner Lemberg <wl@gnu.org>
* builds/toplevel.mk (do-dist): Download shallow clone of `config.git`.
No need for any other commit than the current one.
2025-09-06 Werner Lemberg <wl@gnu.org>
Update all copyright notices.
2025-09-05 Werner Lemberg <wl@gnu.org>
src/sfnt/ttload.c (tt_face_load_any): Correctly handle font containers.
Reported as
https://issues.oss-fuzz.com/issues/424613326
2025-09-05 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
Clean up OpenVMS support.
This avoids cluttering the source code with VMS-specific changes.
* include/freetype/internal/ftcalc.h [__VMS], src/base/ftcalc.c
[vms_auto64_source]: Remove.
* builds/vms/patch_ftcalc.sed: New file.
* vms_make.com: Change macro definitions while this script is running; we
use `GNU sed` to inject the necessary preprocessor code on the fly.
2025-09-01 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/psaux/psauxmod.h (psaux_driver_class): Removed declaration.
2025-08-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Use const FT_Module_Class.
This is intended to warn against modifying any fields in the class,
at compile-time and avoid crashes at run-time.
* include/freetype/internal/ftobjs.h (FT_ModuleRec): Do it.
* src/base/ftobjs.c (Destroy_Module, FT_Add_Module): Updated.
2025-08-27 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftobjs.c (FT_Load_Glyph): Reduces scope of 'ttface'.
2025-08-25 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c: Fix some builds.
2025-08-23 Werner Lemberg <wl@gnu.org>
* subprojects/*.wrap: Updated.
2025-08-23 Werner Lemberg <wl@gnu.org>
Updating `CHANGES` file; minor fixes elsewhere (mostly formatting).
2025-08-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Fix compilation without bytecode.
Fixes #1351 and various warnings about unused variables.
* src/truetype/ttinterp.c: Put the entire body under #ifdef.
* src/truetype/ttgload.c (TT_Process_Composite_Glyph): Relocate
some declarations.
* src/truetype/ttinterp.h: Remove some #ifdef conditions.
* src/truetype/ttobjs.c (tt_size_done): Modified.
2025-08-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Small fix in the incremental interface (again).
Fixes #1299, last [-Wdangling-pointer=] warning.
* src/truetype/ttgload.c (load_truetype_glyph): Restore original stream
on exit unconditionally.
2025-08-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Small fix in the incremental interface.
Fixes #1299, last [-Wdangling-pointer=] warning.
* src/truetype/ttgload.c (load_truetype_glyph): Restore original stream
on exit.
2025-08-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/autofit/afgsub.c: Fix a warning.
Fixes [-Wunused-function] warning without HarfBuzz.
2025-08-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* */ftoption.h: Update C99 wording.
2025-08-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* */ftoption.h: Note C99 compliance.
2025-08-08 Behdad Esfahbod <behdad@behdad.org>
[ttgxvar] Fix caching of scalars when there are intermediate tuples.
For example, with `GoogleSansFlex-Regular.ttf` at ROND=100, the 'Q' glyph
was misrendering.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Reset `tupleScalars`
earlier.
2025-08-05 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
Improvements to OpenVMS support.
* include/freetype/internal/ftcalc.h [__VMS]: Undefine `FT_MulFix`.
* src/base/ftcalc.c [vms_auto64_source]: Define `FT_MulFix`.
* vms_make.com: Also create 32bit version of the FreeType library.
2025-08-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* docs/CHANGES: Mention 'ftmulti' improvements.
2025-08-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[type1/MM] Correctly reset the default instance.
Call T1_Set_MM_WeightVector, which actually sets default weights,
instead of TT_Set_MM_Blend, which just centers the axes.
* src/type1/t1load.c (T1_Reset_MM_Blend): Do it.
2025-08-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype/v40] Fix ROUND_XY_TO_GRID handling.
Fixes #1346.
* src/truetype/ttgload.c (TT_Process_Composite_Component): Round
the x-position unless in backward_compatibility mode.
2025-07-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (Ins_MDRP,MIRP): Small tweak.
2025-07-30 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Tweak size management.
* include/freetype/internal/services/svmetric.h (FT_Size_Reset_Func):
Update typedef, do not return error.
* src/truetype/ttobjs.c (tt_size_reset_height): Move the PPem error
handling from here...
(tt_size_reset): ... to here to improve readability.
src/truetype/ttobjs.h (tt_size_reset_height): Update prototype.
2025-07-30 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Relocate color compensation (cont'd).
* src/truetype/ttinterp.c (Inc_MDAR,MIAP,MDRP,MIRP): Fix forgotten
rounding.
2025-07-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Fix EVEN and ODD instructions.
It is possible to have a fractional part after rounding when rounding
to half-grid or super-rounding. The specs call to ignore the fractional
part in that case.
^ src/truetype/ttinterp.c (Ins_EVEN, Ins_ODD): Fix mask.
2025-07-28 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c: Fix comments.
2025-07-28 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.h (TT_Round_Func): Fix argument.
Fixes #1347: function type mismatch.
2025-07-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Clean up size validation.
Rely on non-zero ppem to validate the size object.
* src/truetype/ttobjs.h (TT_Size_Merics): Remove the `valid` flag.
* src/truetype/ttobjs.c (tt_size_init,done,reset,reset_height): Updated.
* src/truetype/ttgload.c (TT_Load_Glyph): Check for non-zero ppem.
2025-07-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Relocate color compensation.
The rounding color compensation, which is not used by FreeType, belongs
to GS. This is a more logical place for it, next to round_state.
* src/truetype/ttobjs.h (TT_GraphicsState): Move compensations here...
(TT_Size_Metrics): ... from here.
* src/truetype/ttobjs.c (tt_size_init_bytecode): Updated.
* src/truetype/ttinterp.c (tt_default_graphics_state): Updated.
(Ins_ROUND,NROUND,EVEN,ODD): Updated.
(Round_*): Updated.
2025-07-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Remove usage of setjmp and longjmp.
To support WASM targets with slow or unsupported setjmp and longjmp,
we eliminate these calls in favor of an error propagation model.
When gray_set_cell is out of cells, it raises an exception which is
later handled in gray_convert_glyph_inner.
This is a less invasive alternative to !385.
* src/smooth/ftgrays.c (gray_set_cell): Raise the overflow exception
and redirect all work to `cell_null`.
(gray_move,line,conic,cubic_to): Return the exception.
(gray_convert_glyph, gray_convert_glyph_inner): Handle the exception.
2025-07-05 Werner Lemberg <wl@gnu.org>
[sfnt] Rewrite GPOS kerning support. (2/2)
The previous code had a fundamental flaw: it didn't validate the necessary
parts of the 'GPOS' table before accessing it, causing crashes with
malformed data (since `TT_CONFIG_OPTION_GPOS_KERNING` is off by default,
standard fuzzers don't catch these problems). Additionally, it did a lot of
parsing while accessing kerning data, making it rather slow.
The new implementation fixes this. After validation, offsets to the 'GPOS'
lookup subtables used in the 'kern' feature that correspond to 'simple'
kerning (i.e., similar to 'kern' table kerning) are stored in `TT_Face`;
this greatly simplifies and accelerates access to the kerning data.
Testing with font `SF-Pro.ttf` version '1.00', the validation time for the
'GPOS' table increases the start-up time of `FT_New_Face` by less than 1%,
while calls to `FT_Get_Kerning` become about 3.5 times faster.
* include/freetype/internal (gpos_kerning_available): Replace with...
(gpos_lookups_kerning, num_gpos_lookups_kerning): ... these new fields.
Update callers.
* src/ttgpos.c [TT_CONFIG_OPTION_GPOS_KERNING]: A new implementation.
2025-07-05 Werner Lemberg <wl@gnu.org>
[sfnt] Rewrite GPOS kerning support. (1/2)
This commit removes the previous implementation.
2025-07-05 Werner Lemberg <wl@gnu.org>
[cff] Support GPOS kerning.
* src/cff/cffdrivr.c (cff_get_kerning) [TT_CONFIG_OPTION_GPOS_KERNING]: Add
code similar to the one in `tt_get_kerning`.
2025-07-05 Werner Lemberg <wl@gnu.org>
* src/sfnt/ttkern.h (TT_FACE_HAS_KERNING): Remove macro.
Given that we also support (limited) 'GPOS' table kerning if
`TT_CONFIG_OPTION_GPOS_KERNING` is defined, the name of this macro is
misleading since it only is true for 'kern' table kerning.
* src/sfnt/sfobjs.c (sfn_load_face): Replace `TT_FACE_HAS_KERNING` with
plain code.
2025-07-05 Werner Lemberg <wl@gnu.org>
[autofit] Remove `globals->gsub_length`.
We completely validate the accessed data from the 'GSUB' table, making this
field unnecessary.
* src/autofit/afglobal.h (AF_FaceGlobalsRec): Remove `gsub_length` field.
* src/autofit/afglobal.c (af_face_globals_new), src/autofit/afgsub.c
(af_parse_gsub): Updated.
2025-07-01 Werner Lemberg <wl@gnu.org>
* src/truetype/ttobjs.c (tt_size_init_bytecode): Correct previous fix.
`FT_NEW_ARRAY` expects a signed value, not an unsigned one.
2025-07-01 Werner Lemberg <wl@gnu.org>
* src/autofit/afgsub.c: Include `tttables.h` and `afgsub.h`.
This fixes 'make multi' compilation with clang.
Reported as
https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381#note_2984610
2025-07-01 Werner Lemberg <wl@gnu.org>
Various minor fixes.
As reported by clang 19.
* src/autofit/afadjust.c (adjustment_database): Make it static.
* src/base/ftdbgmem.c (FT_MEM_SIZE_MIN): Remove unused macro.
* src/psaux/psobjs.c (skip_procedure), src/truetype/ttinterp.c (Ins_IF,
Ins_ELSE, Ins_FDEF, Ins_IDEF): Add `default` clause.
2025-07-01 Werner Lemberg <wl@gnu.org>
More signedness fixes.
As reported by clang 19.
* src/autofit/afadjust.c (add_substitute): Make first argument unsigned.
Update all callers.
Other minor signedness fixes.
(af_reverse_character_map_new): Minor signedness fixes.
* src/autofit/afgsub.c (af_hash_insert): Minor signedness fixes.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Make third
argument unsigned.
Update all callers.
Other minor signedness fixes.
(af_latin_hints_apply): Minor signedness fixes.
* src/bdf/bdflib.c (bdf_parse_bitmap_): Minor signedness fix.
* src/truetype/ttobjs.c (tt_size_init_bytecode): Minor signedness fix.
2025-07-01 Werner Lemberg <wl@gnu.org>
*/*: Fix trivial signedness issues with format strings in trace messages.
As reported with clang 19's `-Wformat` option.
2025-07-01 Werner Lemberg <wl@gnu.org>
Fix `make multi`.
Reported as
https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381#note_2984253
* src/base/fthash.c: Include `ftobjs.h`.
* src/autofit/afgsub.c: Include `afglobal.h`.
2025-06-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* MSBuild.sln: Minor.
2025-06-29 Werner Lemberg <wl@gnu.org>
[doc] Revise font variation API.
2025-06-29 Werner Lemberg <wl@gnu.org>
[doc] Use 'Adobe MM', 'TrueType GX', and 'OpenType Font Variations'.
2025-06-26 Werner Lemberg <wl@gnu.org>
Set minimum HarfBuzz version back to 2.0.0.
Due to the new GSUB parsing we no longer need
`hb_ot_layout_lookup_get_glyph_alternates`.
This partially reverts commit 5d2fd7608a9.
* CMakeLists.txt (HARFBUZZ_MIN_VERSION), meson.build (harfbuzz_dep),
builds/unix/configure.raw (harfbuzz_pkg): Set version to 2.0.0.
* src/autofit/ft-hb-decls.h: Remove entry for
`hb_ot_layout_lookup_get_glyph_alternates`.
2025-06-26 Werner Lemberg <wl@gnu.org>
[autofit] Speed up computation of `af_reverse_character_map_new`. (4/4)
With this commit, the start-up time for creating the reverse character map
gets reduced from more than 300% to about 25% (as tested with `arial.ttf`
version 7.00).
* src/autofit/afadjust.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include
`afgsub.h`.
(add_substitute): New auxiliary function to recursively add elements to
the reverse cmap.
(af_reverse_character_map_new): New code that replaces the old code
removed in the previous commit.
2025-06-26 Werner Lemberg <wl@gnu.org>
[autofit] Speed up computation of `af_reverse_character_map_new`. (3/4)
Rip out some HarfBuzz code of `af_reverse_character_map_new`. The new code
comes immediately in a follow-up commit, making it easier to follow the
changes.
* src/autofit/afadjust.c (af_get_glyph_alternates_helper,
af_get_glyph_alternates): Remove.
(af_reverse_character_map_new): Remove code to create the `*map` hash.
2025-06-26 Werner Lemberg <wl@gnu.org>
[autofit] Speed up computation of `af_reverse_character_map_new`. (2/4)
Create an array of GSUB lookup indices for `SingleSubst` and
`AlternateSubst` lookup types to exit early if we have different types.
Also improve tracing.
* src/autofit/afglobal.h (AF_FaceGlobals) [FT_CONFIG_OPTION_USE_HARFBUZZ]:
New fields `gsub_length`, `gsub`, and `gsub_lookups_single_alternate`.
* src/autofit/afglobal.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include
`afgsub.h`.
(af_face_globals_new) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call
`af_parse_gsub` to fill `gsub_lookups_single_alternate`.
(af_face_globals_free): Updated.
* src/autofit/afadjust.c (af_get_glyph_alternates_helper): Exit early if we
possible.
(af_reverse_character_map_new): Trace GSUB lookup indices to be checked.
2025-06-26 Werner Lemberg <wl@gnu.org>
[autofit] Speed up computation of `af_reverse_character_map_new`. (1/4)
Using HarfBuzz's API functions to construct the reverse map is too slow; we
have to call `hb_ot_layout_lookup_get_glyph_alternates` far too often
because it can only handle a single glyph at a time. For this reason we are
going to parse the GSUB table by ourselves.
The new non-local functions are `af_parse_gsub` and `af_map_lookup`.
* src/autofit/afgsub.c, src/autofit/afgsub.h: New files for parsing,
validating, and mapping the `SingleSubst` and `AlternateSubst` subtable
types of a GSUB table.
* src/autofit/autofit.c, src/autofit/rules.mk (AUTOF_DRV_SRC): Updated.
2025-06-26 Werner Lemberg <wl@gnu.org>
[base] Add no-overwrite hash insert functions.
* src/base/fthash.c (ft_hash_num_insert_no_overwrite,
ft_hash_str_insert_no_overwrite): New functions.
* include/freetype/internal/fthash.h: Updated.
2025-06-26 Werner Lemberg <wl@gnu.org>
[base] Add iterators for `FT_Hash`.
* src/base/fthash.c (ft_hash_num_iterator, ft_hash_str_iterator): New
functions.
* include/freetype/internal/fthash.h: Updated.
2025-06-24 Werner Lemberg <wl@gnu.org>
[truetype] Add comment to explain heuristic limit for twilight points.
2025-06-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Restore non-persistent CVT and storage.
According to specifications, CVT and storage area may or may not be
persistent after modifications by a glyf program. FreeType had always
reset them, which was broken by the last commit.
* src/truetype/ttinterp.c (TT_Load_Context): Set CVT and storage here.
* src/truetype.ttobjs.c (tt_size_run_prep): Prioritize TT_Load_Context.
(tt_size_init_bytecode): Allocate but not set CVT and storage area.
2025-06-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Deduplicate 'codeRangeTable'.
* src/truetype/ttinterp.c (TT_Load_Context, TT_Save_Context): Do not
copy 'codeRangeTable'.
* src/truetype/ttobjs.h (TT_Size): Remove 'codeRangeTable'.
(TT_CodeRange_Tag, TT_CodeRange, TT_DefArray): Moved to...
* src/truetype/ttinterp.h: ... this header.1
2025-06-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Simplify bytecode allocations.
To avoid repeated synchronization, some TT_Size allocations are moved
TT_ExecContext for good. The memory blocks are also consolidated.
* src/truetype/ttinterp.c (TT_{Load,Save,Done}_Context): Remove
synchronization and stack management.
* src/truetype/ttobjs.c (tt_size_{init,done}_bytecode): Manage allocations
and assign them to the execution context.
(tt_size_run_prep): Updated.
2025-06-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Rework handling of rendering mode in bytecode.
This replaces a large number of confusing boolean constructs that
describe the target rendering mode in the execution context with
the straight mode variable. It might fix some hidden bugs when
FT_LOAD_TARGET_XXX were used as flags, which they are not.
The condition that triggers the CV program re-execution is simplified.
These events due the rendering mode change are rather rare and unexpected
and, therefore, should not be over-analyzed. In v40, all mode changes
now trigger the CV program. In v35, only switches to/from mono do.
* src/truetype/ttinterp.h (TT_ExecContext): Replace 'grayscale',
'grayscale_cleartype', 'subpixel_hinting_lean', and 'vertical_lcd_lean'
with the rendering 'mode'.
* src/truetype/ttinterp.c (Ins_GETINFO): Updated.
* src/truetype/ttgload.c (tt_loader_init): Replace 'prep' re-execution
trigger and update 'backward_compatibility' condition.
(tt_loader_set_pp): Updated.
2025-06-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/{ttinterp.c,ttobjs.c}: Minor.
2025-06-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Clean up bytecode execution triggers.
This avoids executing the CV program twice and cleans up the use of
'fpgm' and 'prep' triggers
* src/truetype/ttgload.c (tt_loader_init): Call 'tt_size_init_bytecode'
and 'tt_size_run_prep' explicitly and avoid the call repetition.
* src/truetype/ttobjs.c (tt_size_ready_bytecode): Removed as unused.
(tt_size_init, tt_size_init_bytecode, tt_size_done_bytecode): Remove some
'fpgm' and 'prep' triggers and update.
(tt_size_run_fpgm, tt_size_run_prep): Do not set the pedantic flag here.
* src/truetype/ttobjs.h: Update signatures.
2025-06-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (tt_loader_init, load_sbit_image): Clean up.
2025-06-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Simplify twilight zone management.
* include/freetype/internal/tttypes.h (TT_GlyphZone): Remove 'memory'.
* src/truetype/ttobjs.c (tt_glyphzone_done): Use 'memory' as argument.
(tt_glyphzone_new, tt_glyphzone_done): Allocate/free as a single block.
(tt_size_init_bytecode, tt_size_done_bytecode): Updated.
* src/truetype/ttobjs.h (tt_glyphzone_done): Updated signature.
2025-06-19 Behdad Esfahbod <behdad@behdad.org>
[autofit] Really fix handling of `RTLD_DEFAULT`.
This commit actually implements what commit 43ec023e1a7 describes.
* src/autofit/ft-hb.c (FT_RTLD_FLAGS): New macro for `dlopen`; it uses
`RTLD_GLOBAL` only if `RTLD_DEFAULT` is available.
2025-06-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Revise twilight zone initiation.
This assures that twilight zone is reset before each CV program
execution, including after the rendering mode switch. Fixes #1344.
* src/truetype/ttobjs.c (tt_size_ready_bytecode): Relocate the GS
the twilight zone initiation from here...
(tt_size_run_prep): ... to this function, sho that it is always
done prior to the CV program execution.
* src/truetype/ttobjs.c (TT_Run_Context): Set twilight zone here...
(TT_Load_Context): ... rather than here, as it used to be.
2025-06-13 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Remove check.
The highest (sign) attribute bit is reserved and should be zero.
It is harmless to omit this check however. Fixes #1342.
2025-06-12 Werner Lemberg <wl@gnu.org>
[autofit] Ignore virtual glyph indices from GSUB lookups.
Reported as
https://issues.chromium.org/issues/420401651
* src/autofit/afadjust.c (af_reverse_character_map_new): Implement it.
2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Clean up TT_GlyphZone.
* include/freetype/internal/tttypes.h (TT_GlyphZone): Delete fields.
* src/truetype/ttobjs.c (tt_glyphzone_new, tt_glyphzone_done,
tt_size_init_bytecode): Updated.
2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Use FT_ARRAY_ZERO.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Updated.
* src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids,
tt_size_ready_bytecode): Updated.
2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Rearrange bytecode run.
This is a minor change with large code rearrangements.
* src/truetype/ttinterp.c (TT_RunIns): Just loop through instructions
and move all setup to...
(TT_Run_Context): ... here; relocated.
(Compute_Round): Replaced by simple assignment, removed.
2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Relocate the interpreter pointer.
This reduces dereferencing when calling the interpreter.
* include/freetype/internal/tttypes.h (TT_Face): Move it from here...
* src/truetype/ttinterp.h (TT_ExecContext): ... to here.
* src/truetype/ttobjs.c (tt_size_init_bytecode): Move its initialization
* src/truetype/ttinterp.c (TT_New_Context): ... to here.
(TT_Run_Context): Updated.
2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Clean up the loader initiation.
* include/freetype/internal/tttypes.h (TT_LoaderRec): Remove unused field.
* src/truetype/ttgload.c (tt_loader_init): Refactor.
2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Modify bytecode initiation.
This reduces the number of function calls and data copying events.
* src/truetype/ttinterp.c (TT_Goto_CodeRange): Merge into...
(TT_Set_CodeRange): ... this function.
(TT_Load_Context): Do not set up any zones, copy GS, or prepare the
execution...
(TT_Run_Context): ... do this here instead..
* src/truetype/ttinterp.c (TT_Set_CodeRange): Update signature.
* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Call
TT_Run_Context.
* src/truetype/ttgload.c (TT_Hint_Glyph, tt_loader_init): Updated.
2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Modify the graphics state management.
Instead of restoring persistent GS variables, we only save modifications
permitted by the CVT program. This reduces the context manipulations.
* src/truetype/ttobjs.h (TT_GraphicsState): Reorder fields.
* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep):
Do not alter the context.
* src/truetype/ttgload.c (TT_Hint_Glyph): Do not reset GS.
(tt_loader_init): Fix potential issue in 'instruct_control' handling.
* src/truetype/ttinterp.c (TT_Run_Context): Fully reset GS.
(TT_Load_Conext): Rearrange and remove the 'size' check, already
performed in FT_Load_Glyph.
(TT_Save_Context): Save only modifiable GS parts.
(tt_default_graphics_state): Updated.
* src/truetype/ttinterp.h (TT_Run_Context): Update signature.
2025-06-10 Werner Lemberg <wl@gnu.org>
[gxvar] Really fix setting of named-instance to Regular.
This fixes an ommission in commit cf06661c51.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize `error`.
2025-06-10 Werner Lemberg <wl@gnu.org>
Two more link fixes.
2025-06-10 Werner Lemberg <wl@gnu.org>
Update links.
Found with `linkchecker --check-extern index.html` running locally in the
'freetype-web' repository.
2025-06-07 Behdad Esfahbod <behdad@behdad.org>
Fix setting of named-instance to Regular
Fixes https://gitlab.freedesktop.org/freetype/freetype/-/issues/1341
And more elaborate avoidance of loading face->blend if all coords
are zero.
2025-06-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/type42/t42objs.c (T42_Size_Init): Fix uninitialized use.
Found by Ozkan Sezer.
2025-06-04 Ozkan Sezer <sezeroz@gmail.com>
[autofit] Fix `-Wunused-but-set-variable` warning in Windows builds.
With this commit, the following warning gets removed.
```
In file included from src/autofit/autofit.c:21:0:
src/autofit/ft-hb.c: In function 'ft_hb_funcs_init':
src/autofit/ft-hb.c:75:35: warning:
variable 'version_atleast' set but not used [-Wunused-but-set-variable]
ft_hb_version_atleast_func_t version_atleast = NULL;
^~~~~~~~~~~~~~~
```
* src/autofit/ft-hb.c (ft_hb_funcs_init): Move `NULL` check of
`version_atleast` out of ifdefs.
2025-06-04 Ozkan Sezer <sezeroz@gmail.com>
[build] Revise visibility attributes usage in autotools and CMake.
* CMakeLists.txt: Set `C_VISIBILITY_PRESET` to hidden for non-Windows only.
Windows handles exports with `DLL_EXPORT` defined, and old MinGW
toolchains emit a lot of warnings about visibility attributes not being
supported in this configuration.
* build/unix/configure.raw: Revise visibility attributes checks by compiling a
better test program with `-Werror` in `CFLAGS` so that warnings correctly
indicate unsupported configurations.
2025-06-04 Ozkan Sezer <sezeroz@gmail.com>
* CMakeLists.txt: Add support for `FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC`.
This commit introduces a new CMake option `FT_DYNAMIC_HARFBUZZ`.
2025-06-03 Ozkan Sezer <sezeroz@gmail.com>
* src/autofit/ft-hb.c: Fix definition of `_GNU_SOURCE`.
Commit 43ec023e1a730f defined the macro too late.
2025-06-03 Werner Lemberg <wl@gnu.org>
Replace 'www.freetype.org' with 'freetype.org'.
2025-06-03 Ozkan Sezer <sezeroz@gmail.com>
* builds/unix/configure.raw: Fix HarfBuzz library detection for MinGW.
Set `have_harfbuzz*` variables explicitly to dynamic for MinGW, since
Windows uses its own `LoadLibrary` call.
This fixes a MinGW configuration error:
```
checking for HARFBUZZ... no
checking for dlopen in -lc... no
checking for dlopen in -ldl... no
configure: error: harfbuzz support requested but library not found
```
2025-06-03 Ozkan Sezer <sezeroz@gmail.com>
* builds/unix/configure.raw: Improve check for `dlopen`.
Look for `dlopen` first in 'libc', then in 'libdl'.
2025-06-03 Behdad Esfahbod <behdad@behdad.org>
* src/autofit/ft-hb.c: Fix usage of `RTLD_DEFAULT`.
Using `RTLD_DEFAULT` we see whether the process already has HarfBuzz linked
in, and reuse it. If this symbol is not defined it is tempting to use
`RTLD_GLOBAL` instead, which would make the library available to the whole
process. However, without `RTLD_DEFAULT`, we would risk loading a second
HarfBuzz library, and if the linker mixes them up, probably giving symbols
from the new library to other clients, we might get into trouble. For this
reason, we do not pass `RTLD_GLOBAL` to `dlopen`; the default is
`RTLD_LOCAL`, and the rest of the process won't see the loaded HarfBuzz and
hopefully all be happy.
2025-05-28 Werner Lemberg <wl@gnu.org>
[sfnt] `FT_Load_Sfnt_Table` can now also load a font's table directory.
Closes issue #1263.
* src/sfnt/ttload.c (tt_face_load_any): Implement it.
2025-05-28 Werner Lemberg <wl@gnu.org>
[gzip] Update sources to zlib 1.13.1.
Fixes issue #1294.
2025-05-27 Vítor Ramos <vitor.ramos@ufrn.br>
* src/base/ftobjs.c (FT_Load_Glyph): Loosen auto-hinting constraints.
Fixes issue #1320.
2025-05-27 Werner Lemberg <wl@gnu.org>
Update `CHANGES` file.
2025-05-27 Behdad Esfahbod <behdad@behdad.org>
[gxvar] Optimize out more bounds checking.
Big win, ~20% in measured mega-var font, HarfBuzz's `benchmark-font`
'glyph_h_advances' benchmark.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Implement it in
loops.
2025-05-27 Behdad Esfahbod <behdad@behdad.org>
* src/truetype/ttgload.c (load_truetype_glyph): Use `IS_DEFAULT_INSTANCE`.
2025-05-27 Behdad Esfahbod <behdad@behdad.org>
[gxvar] Set `doblend` to `FALSE` if at default location.
* src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Get_Var_Design): Do it.
2025-05-27 Behdad Esfahbod <behdad@behdad.org>
[mm/gxvar] Always detect default instance and use optimized codepath.
Even if it was explicitly set by either design or normalized APIs.
Also update documentation.
* src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design): Use value -2
of `error` to indicate that we have a non-default instance.
(TT_Set_Named_Instance): Updated.
* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): Updated.
2025-05-27 Alexei Podtelezhnikov <apodtele@gmail.com>
Typo.
2025-05-27 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (TT_Load_Context): Clean up.
2025-05-26 Werner Lemberg <wl@gnu.org>
[autofit] Fix integer overflow.
Reported as
https://issues.oss-fuzz.com/issues/420401635
* src/autofit/aflatin.c (af_latin_stretch_top_tilde,
af_latin_stretch_bottom_tilde): Use `SUB_LONG`.
2025-05-26 Werner Lemberg <wl@gnu.org>
[gxvar] Speed up handling of deltas in `ItemVariationStore`. (3/3)
* src/base/ftcalc.c (FT_MulAddFix): Removed, no longer needed.
* include/freetype/internal/ftcalc.h: Updated.
2025-05-26 Behdad Esfahbod <behdad@behdad.org>
[gxvar] Speed up handling of deltas in `ItemVariationStore`. (2/3)
Do all math in fixed integer and do a single divide at the end.
Also don't use an array to read deltas; just read them as we go, and skip
(branch-free) when scalar is 0.
30% speedup in measured mega-var font, HarfBuzz's `benchmark-font`
'glyph_h_advances' benchmark.
2025-05-26 Behdad Esfahbod <behdad@behdad.org>
[gxvar] Speed up handling of deltas in `ItemVariationStore`. (1/3)
* src/truetype/ttgxvar.c (ft_mul_add_delta_scalar, ft_round_and_shift16):
New functions, reusing code from `ftcalc.c`.
2025-05-26 Behdad Esfahbod <behdad@behdad.org>
Lift `FT_Int64` type to global (internal) FreeType use.
* src/base/ftcalc.c (FT_Int64) [!FT_INT64]: Move declaration to...
* include/freetype/config/integer-types.h: ... this file.
(FT_UInt64) [!FT_INT64]: New structure.
(FT_INT64_ZERO): New macro.
2025-05-26 Behdad Esfahbod <behdad@behdad.org>
[gxvar] Move scalar computation into its own function.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Split off affected code
into...
(tt_calculate_scalar): ...this new function.
2025-05-26 Werner Lemberg <wl@gnu.org>
[autofit] Make the accent database work for more glyphs (again).
See the added comment for an explanation.
This partially undoes commit f68733d4a8.
* src/autofit/afadjust.c (af_reverse_character_map_new): Always loop over all
elements of the adjustment database.
(in_range): Removed, no longer needed.
2025-05-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[trueetype] Remove useless assignments.
* src/truetype/ttobjs.c (tt_size_run_fpgm): Remove assignment that
is ignored and overridden later in 'Compute_Funcs'.
* src/truetype/ttinterp.c (TT_RunIns): Ditto.
(Ins_MIAP): Formatting.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Minor code cleanup.
* src/autofit/afadjust.c (af_reverse_character_map_new): Rename `result_set`
to `glyph_alternates` and move its clearing to...
(af_get_glyph_alternates): ...this function.
(af_get_glyph_alternates_helper): s/result/helper_result/.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Speed up construction of reverse character map. (4/4)
* src/autofit/afadjust.c (af_get_glyph_alternates): Move creation and
deletion of the `helper_result` set to...
(af_reverse_character_map_new): ...this function.
Gain for `arial.ttf` version 7.00: approx. 1%.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Speed up construction of reverse character map. (3/4)
* src/autofit/afadjust.c (af_reverse_character_map_new): Fold two loops into
one.
Gain for `arial.ttf` version 7.00: approx. 1%.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Speed up construction of reverse character map. (2/4)
This commit, together with the previous one, makes the startup of the
auto-hinter much faster.
Note, though, that the startup time for handling the diacritic database is
still rather large. For example, loading `arial.ttf` version 7.00 followed
by auto-hinting a first Latin glyph is still approx. three times slower
than before the introduction of the database (this is because function
`hb_ot_layout_lookup_get_glyph_alternates` is called very often).
* src/autofit/afshaper.c (scripts): Rename this array to...
(af_hb_scripts): ...this and export it.
(af_shaper_get_coverage_hb): Updated.
* src/autofit/afshaper.h: Updated.
* src/autofit/afadjust.c (af_reverse_character_map_new): Pass the current
script to `hb_ot_layout_collect_lookups` to make HarfBuzz check less
lookups while searching for glyph alternates.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Speed up construction of reverse character map. (1/4)
Build reverse cmap for characters of the current script style only.
* src/autofit/afadjust.c (in_range): New function.
(af_reverse_character_map_new): Pass `AF_StyleMetrics` instead of
`AF_FaceGlobals` so that we can access the current script style.
Use `in_range` to limit tested code points.
* src/autofit/afadjust.h: Updated.
* src/autofit/aflatin.c (af_latin_metrics_init): Updated.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Avoid variable shadowing.
* src/autofit/afadjust.c (af_reverse_character_map_new): Do it.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Minor speedup of reverse charmap creation.
* src/autofit/afglobal.h (AF_HAS_CMAP_ENTRY): New flag.
(AF_STYLE_MASK): Update value.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage): Set
`AF_HAS_CMAP_ENTRY`.
* src/autofit/afadjust.c (af_reverse_character_map_new): For the creation of
the reverse map, change code to handle glyphs with cmap entries before
glyphs without cmap entries. Doing so avoids some code redundancy and
reduces the number of hash lookups.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Whitespace.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Use `FT_Offset`.
* src/autofit/afadjust.c (af_adjustment_database_lookup,
af_reverse_character_map_new): Do it.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Simplify return value of `af_adjustment_database_lookup`.
* src/autofit/adfadjust.h (af_adjustment_database_lookup): Return integer.
(AF_AdjustmentDatabaseEntry): Move structure to...
* src/autofit/afadjust.c: ...this file.
(af_adjustment_database_lookup, af_reverse_character_map_new): Updated.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Updated.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Remove no longer used functions and structures.
This is the clean-up from the previous commit.
* src/autofit/afadjust.c (af_reverse_character_map_entry_compare,
af_reverse_character_map_lookup, af_reverse_character_map_expand):
Removed.
* src/autofit/afadjust.h: Updated.
* src/autofit/aftypes.h (AF_ReverseMapEntry, AF_ReverseCharacterMap):
Removed.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Use a hash for handling vertical accent adjustments.
This greatly simplifies the code.
* src/autofit/afadjust.c (af_reverse_character_map_new): Implement it.
(af_reverse_character_map_done): Updated.
* src/autofit/afadjust.h: Updated.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Updated.
* src/autofit/aftypes.h: Include `fthash.h`.
(AF_StyleMetrics): Change type of `reverse_charmap` to `FT_Hash`.
2025-05-25 Werner Lemberg <wl@gnu.org>
* src/autofit/aflatin.c (af_latin_hints_apply): Improve code legibility.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Use `FT_LONG_MIN` and `FT_LONG_MAX` for `FT_Pos` variables.
* src/autofit/aflatin.c (af_latin_metrics_init_blues,
af_compute_vertical_extrema, af_find_highest_contour,
af_find_second_highest_contour, af_find_lowest_contour,
af_find_second_lowest_contour, af_check_contour_horizontal_overlap):
Updated.
2025-05-25 Werner Lemberg <wl@gnu.org>
[autofit] Fix uninitialized variables.
* src/autofit/aflatin.c (af_latin_stretch_top_tilde,
af_latin_stretch_bottom_tilde): Initialize `min_measurement`.
2025-05-23 Behdad Esfahbod <behdad@behdad.org>
[ttmtx] Fix check for being non-default variation position.
If user explicitly sets variations to `NULL` after it being set to something
else, `face->blend` will still be non-`NULL`. The intention here however is
correctly captured by `FT_IS_VARIATION`.
* src/sfnt/ttmtx.c (tt_face_get_metrics): Use `FT_IS_VARIATION`.
2025-05-23 Behdad Esfahbod <behdad@behdad.org>
[gxvar] Optimize loading of 'gvar' table.
* src/truetype/ttgxvar.c (tt_var_load_item_variation_store,
tt_var_load_delta_set_index_mapping, ft_var_load_gvar): Use frames to
reduce bounds checking.
(TT_Vary_Apply_Glyph_Deltas): Better macro usage.
2025-05-22 Behdad Esfahbod <behdad@behdad.org>
[mm] Short-circuit setting face to default instance if already is so.
I found that in hb-ft I need to sometime reset the face to the default
instance. However, calling `FT_Set_Var_Design_Coordinates` with no coords
was still slowing down at least the glyph-advance code by processing
variations.
Perhaps there's a better fix, but this handles the easy cases.
* src/base/ftmm.c (FT_Set_Var_Design_Coordinates): Implement it.
2025-05-22 Behdad Esfahbod <behdad@behdad.org>
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix allocation.
Bug was introduced in commit 582de1a4b6f.
2025-05-21 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgxvar.c (ft_var_apply_tuple): Remove redundant test.
This was erroneously added in commit e6e9110a8.
2025-05-21 ColdPaleLight <coldpalelight@gmail.com>
[sdf] Skip neighbor comparison for pixels near edges.
If the distance of the current pixel to the edge is less than or equal
to 0.5, skip further neighbor comparisons to avoid unnecessary
calculations. When the `USE_SQUARED_DISTANCES` macro is defined,
compare to 0.25 instead.
* src/sdf/ftbsdf.c (compare_neighbor): Add early return for pixels
close to edges to avoid unnecessary neighbor checks.
2025-05-21 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[gxvar] Cache shared-tuple scalar values.
GoogleSansFlex HB benchmark-font draw results:
Before: 2.13ms
After: 1.65ms
Speedup: 22%
* src/truetype/ttgxvar.h (GX_BlendRec): Add `tuplescalars` field.
* src/truetype/ttgxvar.c (ft_var_load_gvar): Allocate `tuplescalars` array.
(tt_set_mm_blend): Set its values.
(TT_Vary_Apply_Glyph_Deltas): Use it.
(tt_done_blend): Deallocate it.
2025-05-21 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[gxvar] Reduce number of mallocs.
8% speed up in drawing GoogleSansFlex variable in HB benchmark-font.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Use an allocation
pool instead of individual allocations.
2025-05-21 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[gxvar] Another optimization in computing scalar.
Another ~6% speedup in GoogleSansFlex var drawing.
* src/truetype/ttgxvar.c (ft_var_apply_tuple): Test `ncv` for being zero.
2025-05-21 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[gxvar] Remove stale comment.
The code *does* check against start/end!
2025-05-21 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
* src/truetype/ttgxvar.c (ft_var_apply_tuple): Micro-optimize.
2025-05-21 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[gxvar] Inline two USHORT reads.
Speeds up GoogleSansFlex variable glyph drawing by ~13%.
Before: 2.95ms
After: 2.57ms
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Do it.
2025-05-21 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[gxvar] Micro-optimize loop end condition.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Do it.
2025-05-21 Behdad Esfahbod <behdad@behdad.org>
[truetype] Don't process `mvar` metrics if default instance.
GoogleSansFlex default-instance HarfBuzz benchmark-font draw:
Before: 0.610ms
After: 0.435ms
Speedup: 28%
* src/truetype/ttobjs.c (tt_face_init) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
Check `instance_index`.
2025-05-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (Ins_MIRP,DELTAP,DELTAC): Minor.
2025-05-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Update bytecode error handling.
* src/truetype/ttinterp.c (Ins_SHP,SHPIX,ALIGNRP): Return appropriate
error in case of stack underflow.
(Ins_IP): Ditto and remove redundant check.
2025-05-19 Werner Lemberg <wl@gnu.org>
* src/aflatin.c (af_latin_hint_edges): Refine fix for serif handling.
Commit 11432424 (from 2025-May-12) was too aggressive; it is now restricted
to edges that are not too far away.
2025-05-19 Werner Lemberg <wl@gnu.org>
* src/afadjust.c (adjustment_database): Make it complete up to U+FFFF.
Also fix two entries.
This is for Unicode 17.0.
2025-05-19 Werner Lemberg <wl@gnu.org>
[autofit] Fix vertical adjustment of (mainly) double diacritics.
The series of commits that introduced this adjustment support had some
flaws.
- If there were two diacritics on top of a base glyph, and the upper
diacritic was a tilde, the vertical centering correction was incorrectly
applied to the lower, non-tilde glyph instead of the tilde.
- The maximum value allowed to shift a glyph was too strict (and also not
handling rounding issues), causing some diacritics and combinations of
diacritics to be not shifted at all.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Correctly handle
vertical centering correction.
2025-05-19 Werner Lemberg <wl@gnu.org>
[autofit] Code hygiene.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Use more flag
variables and improve trace messages.
2025-05-19 Werner Lemberg <wl@gnu.org>
* src/autofit/aflatin.c (af_latin_hint_edges): Fix handling of serifs.
This has been discovered while inspecting the auto-hinting results of
character 'Ễ' in font `arial.ttf` (version 7.00) at 13ppem.
2025-05-19 Werner Lemberg <wl@gnu.org>
[autofit] Minor.
* src/autofit/aflatin.c (af_latin_hint_edges): Rename `has_serifs` to
`has_non_stem_edges` and make it of type `FT_Bool`.
2025-05-19 Werner Lemberg <wl@gnu.org>
[autofit] New algorithm for preventing hinting of tilde glyphs.
The old algorithm removed segments from edges to make the auto-hinter ignore
a tilde. However, the implementation had two flaws.
- Edge array elements were moved around without reordering them afterwards.
- The linking between edges and segments wasn't correctly updated for moved
edges, which could cause endless loops.
Correcting both problems are non-trivial; additionally, a fix would make
the auto-hinter slower.
For these reasons, a new, simpler approach is taken: A new flag allows
points to be tagged as being ignored, and if such a point is enountered, it
doesn't get added to a segment.
Fixes issue #1333.
* src/autofit/afhints.h (AF_FLAG_IGNORE): New macro.
* src/autofit/aflatin.c (af_latin_hints_compute_segments, af_touch_contour):
Use it.
(af_remove_segments_containing_point, af_remove_top_points_from_edges,
af_remove_bottom_points_from_edges): Removed.
(af_latin_stretch_top_tilde): Call `af_touch_top_contours` and
`af_touch_bottom_contours` unconditionally.
(af_latin_hints_apply): Updated.
2025-05-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (TT_DotFix14): Silence UBSAN.
2025-05-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (Ins_DELTAP): Flip if-else.
2025-05-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Optimize DELTAP and DELTAC.
* src/truetype/ttinterp.c (Ins_DELTAP,DELTAC): Perform PPEM range-
checking and manipulations outside the loop.
2025-05-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (Compute_Funcs): Replace shifts.
2025-05-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Tighten code overflow checks.
Fixes #1336.
* src/truetype/ttinterp.c (Ins_NPUSHB,NPUSHW,PUSHB, PUSHW):
Tighten conditions.
2025-05-14 Chris Liddell <chris.liddell@artifex.com>
[type1] Fix memory leak on CharString error.
In the event that a CharString retrieved via the incremental interface
caused an error, the memory for that CharString was not being freed.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Free charstring.
2025-05-14 Werner Lemberg <wl@gnu.org>
Whitespace, formatting, minor spelling fix.
2025-05-14 Werner Lemberg <wl@gnu.org>
Adminstrativa.
2025-05-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Finalize bytecode changes.
* src/truetype/ttinterp.c: Formatting, minor.
(TT_Goto_CodeRange): Initialize 'iniRange' here...
(TT_RunIns): ... instead of here.
* docs/CHANGES: Updated.
2025-05-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Streamline backward compatibility.
The 'backward_compatibility' is only set in v40: no need to check
the interpreter version again and again. In addition, we now track
IUP in its lower bits. After both IUPx and IUPy have been called,
'backward_compatibility' becomes equal to 0x7.
* src/truetype/ttinterp.h (TT_ExecContextRec): Wrap 'iup?_called'
into 'backward_compatibility'.
* src/truetype/ttinterp.c (Ins_INSTCTRL): Sync 'backward_compatibility'.
(Direct_Move, Direct_Move_X/Y, Move_Zp2_Point,
Ins_FLIPPT,FLIPRGON,FLIPRGOFF,SHPIX,DELTAP): Updated.
(TT_RunIns): Do not mess with IUP flags.
* src/truetype/ttgload.c (tt_loader_init): Set 'backward_compatibility'.
(TT_Hint_Glyph): Updated.
2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Optimize bytecode movements.
Replacing FT_MulDiv with FT_MulFix gives large performance gains.
* src/truetype/ttinterp.h (TT_ExecContextRec): Store "projected"
freedom vector.
* src/truetype/ttinterp.c (Compute_Funcs): Compute "projected"
freedom vector.
(Direct_Move, Direct_Move_Orig, Compute_Point_displacement): Use it.
2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Simplify stack access.
* src/truetype/ttinterp.c (Ins_MINDEX,CINDEX): Use local stack pointers.
(Ins_DELTAP,DELTAC): Ditto; limit the number of pairs before looping.
2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Tweak bytecode looping.
* src/truetype/ttinterp.c (Ins_FLIPPT,SHP,SHPIX,IP,ALIGNRP): Handle
counters and stack locally.
(TT_RunIns): Updated.
2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Tweak bytecode initiation.
* src/truetype/ttinterp.c (TT_Load_Context): Init stack tops.
* src/truetype/ttinterp.h (TT_ExecContextRec): Document it and clean.
* src/truetype/ttobjs.c (tt_size_run_prep,fpgm): Updated.
* src/truetype/ttgload.c (tt_loader_init): Minor.
2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Modify stack handling.
* src/truetype/ttinterp.c (Ins_GETVARIATION): Increment stack.
(Ins_NPUSHB,NPUSHW,PUSHB,PUSHW): Handle the code stack here, ...
(TT_RunIns): ... instead of here. Consolidate error handling.
(SkipCode): Remove preemptive check.
2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Modify bytecode steps.
* src/truetype/ttinterp.h (TT_Exec_ContextRec): Remove 'step_ins'.
* src/truetype/ttinterp.c (TT_RunIns, Ins_Goto_CodeRange,
Ins_JMPR,ENDF,PUSHW,NPUSHW): Set and use zero increment 'length' instead.
(Ins_CALL,LOOPCALL,UNKNOWN): Updated.
2025-05-10 Werner Lemberg <wl@gnu.org>
[autofit] Add safety check for accent adjustments.
This commit does two things.
- Ignore accents that have too large heights. This situation can happen if
an accent outline is unexpectedly not the highest (or lowest) contour.
- Add a new adjustment flag `AF_ADJUST_NO_HEIGHT_CHECK` to override the
height check.
* src/autofit/afadjust.h (AF_ADJUST_NO_HEIGHT_CHECK): New macro.
* src/autofit/afadjust.c (adjustment_database): Updated.
* src/autofit/aflatin.c (af_latin_hints_apply): Handle new flag.
(af_glyph_hints_apply_vertical_separation_adjustments): Check limit.
2025-05-10 Werner Lemberg <wl@gnu.org>
[autofit] Better handling of characters with attached diacritics. (3/3)
Fixes issue #136.
* src/autofit/afadjust.c (adjustment_database): Updated.
2025-05-10 Werner Lemberg <wl@gnu.org>
[autofit] Better handling of characters with attached diacritics. (2/3)
* src/autofit/afadjust.h (AF_IGNORE_CAPITAL_TOP, AF_IGNORE_CAPITAL_BOTTOM,
AF_IGNORE_SMALL_TOP, AF_IGNORE_SMALL_BOTTOM): New macros.
* src/autofit/afadjust.c (af_reverse_character_map_new)
[FT_DEBUG_LEVEL_TRACE]: Updated.
Also fix debugging strings of other flags.
* src/autofit/afhints.h (AF_EDGE_NO_BLUE): New edge flag to make the
auto-hinter ignore the edge while assigning blue zones.
* src/autofit/aflatin.c (af_latin_hints_compute_blue_edges): Use it.
(af_prevent_top_blue_alignment, af_prevent_bottom_blue_alignment,
af_latin_get_base_glyph_blues, af_latin_ignore_top,
af_latin_ignore_bottom): New functions.
(af_latin_hints_apply): Updated.
2025-05-10 Werner Lemberg <wl@gnu.org>
[autofit] Better handling of characters with attached diacritics. (1/3)
Introduce blue zone properties that will be used to make the auto-hinter
ignore diacritics attached on the top or the bottom of a base character.
* src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM,
AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM): New properties.
* src/autofit/afblue.dat: Use them.
* src/autofit/afblue.c, src/autofit/afblue.h: Rengenerated.
* src/autofit/aflatin.h (AF_LATIN_IS_CAPITAL_BOTTOM_BLUE,
AF_LATIN_IS_SMALL_BOTTOM_BLUE, AF_LATIN_BLUE_BOTTOM,
AF_LATIN_BLUE_BOTTOM_SMALL): New macros.
* src/autofit/aflatin.c (af_latin_metrics_init_blues)[FT_DEBUG_LEVEL_TRACE]:
Updated.
2025-05-09 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Line_Up): Use 64-bit calculations.
Attempt to fix #1332.
2025-05-09 Werner Lemberg <wl@gnu.org>
[sfnt] Avoid allocation bomb in compressed SVG documents.
Reported as
https://issues.oss-fuzz.com/issues/416538625
* src/sfnt/ttsvg.c (MAX_SVG_SIZE): New macro.
(tt_face_load_svg_doc): Reject too large buffer.
2025-05-08 Werner Lemberg <wl@gnu.org>
* include/freetype/ttnameid.h (TT_UCR_*): Define with unsigned long.
(TT_UCR_PHAGSPA): Fix definition.
Fixes issue #1300.
2025-05-08 Werner Lemberg <wl@gnu.org>
[doc] Mention that there is no rendering support for 'COLR' v1 tables.
Handles issue #1319.
2025-05-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (TT_DotFix14): Silence UBSAN.
2025-05-07 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffgload.c (cff_slot_load): Fix autohinter scaling.
Fixes #1330.
2025-05-05 Werner Lemberg <wl@gnu.org>
[autofit] Avoid division by zero.
Fixes issue #1331.
* src/autofit/aflatin.c (af_latin_stretch_bottom_tilde): Don't divide by
zero.
2025-05-04 Carlo Bramini <carlo.bramix@libero.it>
Fix Cygwin visibility attributes.
Reported as compilation warnings in #1329.
* include/freetype/config/public-macros.h: Check __CYGWIN__.
* include/freetype/internal/compiler-macros.h: Ditto.
2025-05-03 KatekovAnton <void0main@gmail.com>
* CMakeLists.txt: Fix cmake 4 error by specifying the policy version.
2025-04-29 Werner Lemberg <wl@gnu.org>
* docs/CHANGES: Updated.
2025-04-29 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
Provide configuration option to dynamically load the HarfBuzz library.
We now request HarfBuzz version 2.6.8 (published in June 2020) or newer to
simplify the setup; this version introduced function
`hb_ot_layout_lookup_get_glyph_alternates`, which we need for the adjustment
database of the auto-hinter.
No CMake support yet for dynamic loading.
* include/freetype/config/ftoption.h, devel/ftoption.h
(FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC): New configuration macro.
* builds/unix/configure.raw: Implement `--with-harfbuzz=dynamic`.
This gets tested automatically if we can't link with `libharfbuzz`.
(ft_option_set, ft_option_unset): Refine.
Require at least HarfBuzz version 2.6.8.
* meson.build: Do the same as `configure.raw`.
* meson_options.txt: Updated.
* CMakeLists.txt: Require at least HarfBuzz version 2.6.8.
2025-04-29 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[autofit] Enable dynamic loading of HarfBuzz. (2/2)
Handle the case where loading HarfBuzz dynamically fails.
* src/autofit/ft-hb.c, src/autofit/ft-hb.h (ft_hb_enabled): New function.
* src/autofit/afglobal.c (af_face_globals_new, af_face_globals_free):
Guard HarfBuzz functions with `ft_hb_enabled`.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits): Simplify
setup of `shaper_buf`.
Guard calls of `af_shaper_buf_create` with `ft_hb_enabled`.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Dito.
* src/autofit/afshaper.c: Guard all HarfBuzz function calls with
`ft_hb_enabled`.
2025-04-29 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[autofit] Enable dynamic loading of HarfBuzz. (1/2)
This commit activates the mini-HarfBuzz header files and provides the
necessary infrastructure for dynamically loading HarfBuzz if
`FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC` is defined (this macro gets set up
in a follow-up commit).
* src/autofit/ft-hb.c: New file, providing `ft_hb_funcs_init` and
`ft_hb_funcs_done` for loading HarfBuzz dynamically. The name of the
library is hold in the macro `FT_LIBHARFBUZZ`, which can be overridden.
* src/autofit/ft-hb.h: Don't include `hb.h` but `ft-hb-types.h`.
(hb): Modified to handle both standard linking and dynamically
loading of HarfBuzz.
(HB_EXTERN): New macro to load `ft-hb-decls.h`.
* src/autofit/afadjust.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: For the sake of
dynamically loading the HarfBuzz library, replace the compile-time macro
`HB_VERSION_ATLEAST` with a call to the run-time function
`hb_version_atleast` where necessary – a follow-up commit will set the
minimum version of HarfBuzz to 2.6.8, which provides all necessary
functions needed by FreeType.
* src/autofit/afmodule.h: Include `ft-hb.h`.
(AF_ModuleRec) [FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC]: Add `hb_funcs`
structure to hold pointers to the dynamically loaded HarfBuzz functions.
* src/autofit/afmodule.c (af_autofitter_init, af_autofitter_done)
[FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC]: Call `ft_hb_funcs_init` and
`ft_hb_funcs_done`.
* src/autofit/afshaper.h: Updated.
* src/autofit/autofit.c: Include `ft-hb.c`.
* src/autofit/rules.mk (AUTOF_DRV_SRC, AUTOF_DRV_H): Updated.
2025-04-29 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[autofit] Some preparations for loading HarfBuzz dynamically. (4/4)
Add 'mini' HarfBuzz declarations to make FreeType independent on HarfBuzz
header files.
The files get activated in a follow-up commit.
* src/autofit/ft-hb-decls.h, src/autofit/ft-hb-types.h: New files, holding
verbatim (or slightly massaged) entries from public HarfBuzz header files.
* src/autofit/hb-script: New file.
A verbatim copy of a public HarfBuzz header file.
2025-04-29 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[autofit] Some preparations for loading HarfBuzz dynamically. (3/4)
* src/autofit/afshaper.c: Move around code so that the non-HarfBuzz code is
present even if `FT_CONFIG_OPTION_USE_HARFBUZZ` is not defined. This is a
preliminary step to allow deactivation of HarfBuzz at run-time.
2025-04-29 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[autofit] Some preparations for loading HarfBuzz dynamically. (2/4)
Pass `AF_FaceGlobals` to many functions, or provide it, tagged with
`FT_UNUSED`. We need this later on to access a dynamically linked HarfBuzz
library.
* src/autofit/ft-hb-ft.h (ft_hb_ft_font_create): Use `globals` argument.
Drop unused `destroy` argument.
* src/autofit/ft-hb-ft.c (ft_hb_ft_face_create, ft_hb_ft_font_create): Use
`globals` argument.
Drop unused `destroy` argument.
(ft_hb_ft_face_create, ft_hb_ft_reference_table): Cast `user_data` to
`AF_FaceGlobals`.
* src/autofit/afadjust.c (af_get_glyph_alternates_helper,
af_get_glyph_alternates): Add `globals` argument.
Update callers.
* src/autofit/afshaper.c, src/autofit/afshaper.h (af_shaper_buf_create,
af_shaper_buf_destroy): Use `globals` argument.
* src/autofit/afglobal.c (af_face_globals_new): Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits): Updated.
2025-04-29 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[autofit] Some preparations for loading HarfBuzz dynamically. (1/4)
* src/autofit/ft-hb.h: New file, defining the `hb` macro. Later on, we
provide a different definition of this macro depending on a yet-to-come
configuration option to support dynamic loading of HarfBuzz functions.
* src/autofit/afadjust.c, src/autofit/afglobal.c, src/autofit/afshaper.c,
stc/ft-hb-ft.c: Use it.
2025-04-29 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
[autofit] Rename 'ft-hb' to 'ft-hb-ft'.
Since it's a (shrinked) copy of 'hb-ft'.
* src/autofit/afglobal.c (af_face_globals_new), src/autofit/afshaper.h,
src/autofit/autofit.c: Updated.
* src/autofit/ft-hb.c, src/autofit/ft-hb.h: Renamed to...
* src/autofit/ft-hb-ft.c, src/autofit/ft-hb-ft.h: ...this; updated.
* src/autofit/rules.mk (AUTOF_DRV_SRC): Updated.
2025-04-29 Werner Lemberg <wl@gnu.org>
* src/autofit/aflatin.c (af_latin_stretch_top_tilde): Don't divide by zero.
Reported as
https://issues.oss-fuzz.com/issues/414320186
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Extend adjustment database with characters up to U+1FFF.
This adds many pre-combined Latin glyphs, Cyrillic, Greek, and some
characters from other scripts (or rather, Unicode blocks).
Fixes issues #112 and #471.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Support diacritics with special vertical minima.
This code catches situations like U+1F90 ('ᾐ'), where some fonts have
exactly the same vertical minimum for the lower accent as for the base
glyph.
* src/autofit/aflatin.c (af_find_highest_contour, af_find_lowest_contour):
Handle it.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] More tilde stretch support. (3/3)
The auto-hinter now supports up to four tilde glyphs (two above and two
below a base character).
Note that diacritics above (or below) a tilde are now also ignored by the
auto-hinter.
* src/autofit/afadjust.h (AF_ADJUST_TILDE_TOP2, AF_ADJUST_TILDE_BOTTOM2):
New macros.
* src/autofit/afadjust.c (af_reverse_character_map_new): Updated.
* src/autofit/aflatin.c (af_remove_top_points_from_edges,
af_remove_bottom_points_from_edges): Make functions also handle all
contours higher (or lower) of the given one in the argument.
(af_touch_top_contours, af_touch_bottom_contours): New functions.
(af_latin_stretch_top_tilde, af_latin_stretch_bottom_tilde): Use it to
also handle all contours higher (or lower) than the tilde contour.
* (af_latin_hints_apply): Handle more tilde glyphs.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] More tilde stretch support. (2/3)
* src/autofit/aflatin.c (af_latin_stretch_top_tilde,
af_latin_stretch_bottom_tilde): Return vertical size difference between
stretched and original contour.
(af_latin_align_top_tilde, af_latin_align_bottom_tilde): Return applied
delta.
(af_latin_hints_apply): Updated; the return values are not used yet.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] More tilde stretch support. (1/3)
Move some existing code that we soon need elsewhere into separate functions.
* src/autofit/aflatin.c (af_move_contours_up, af_move_contours, down): New
functions.
(af_glyph_hints_apply_vertical_separation_adjustments): Use them.
(af_touch_contour): New function.
(af_latin_stretch_top_tilde, af_latin_stretch_bottom_tilde): Use it.
(af_latin_remove_top_tilde_points_from_edges,
af_latin_remove_bottom_tilde_points_from_edges): Renamed to...
(af_remove_top_points_from_edges, af_remove_bottom_points_from_edges):
...this.
Update callers.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Support two below/above accents for vertical adjustment. (2/2)
* src/autofit/afadjust.h (AF_ADJUST_UP2, AF_ADJUST_DOWN2): New macros.
* src/autofit/afadjust.c (af_reverse_character_map_new): Updated.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Implement it.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Support two below/above accents for vertical adjustment. (1/2)
Some variable renamings.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Routines for finding the second highest/lowest contour.
* src/autofit/aflatin.c (af_find_second_highest_contour,
af_find_second_lowest_contour): New functions.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Use more functions to reduce code.
* src/autofit/aflatin.c (af_find_highest_contour, af_find_lowest_contour):
Updated.
(af_glyph_hints_apply_vertical_separation_adjustments): Use
`af_compute_vertical_extrema`, `af_find_highest_contour`, and
`af_find_lowest_contour`.
(af_latin_hints_apply): Use `af_compute_vertical_extrema`,
2025-04-28 Werner Lemberg <wl@gnu.org>
* src/autofit/aflatin.c (af_compute_vertical_extrema): New function.
To be used in a follow-up commit.
2025-04-28 Werner Lemberg <wl@gnu.org>
* src/autofit/aflatin.c: Some variable renaming.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Avoid recomputation of highest and lowest contour.
* src/autofit/aflatin.c (af_latin_hints_apply): Compute highest and lowest
contour in this function.
(af_latin_remove_top_tilde_points_from_edges,
af_latin_remove_bottom_tilde_points_from_edges,
af_latin_stretch_top_tilde, af_latin_stretch_bottom_tilde,
af_latin_align_top_tilde, af_latin_align_bottom_tilde): Updated.
2025-04-28 Werner Lemberg <wl@gnu.org>
* src/aflatin.c (af_latin_trace_height): Remove.
Update caller.
The algorithm works fine.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Support vertical stretching of tilde below base glyph. (2/2)
* src/autofit/afadjust.h (AF_ADJUST_TILDE_BOTTOM): New macro.
* src/autofit/afadjust.c (af_reverse_character_map_new): Updated.
* src/autofit/aflatin.c (af_find_lowest_contour,
af_latin_remove_bottom_tilde_points_from_edges,
af_latin_stretch_bottom_tilde, af_latin_align_bottom_tilde): New functions
in analogy to the top tilde versions.
(af_glyph_hints_apply_vertical_separation_adjustments): Add support in
analogy to the top tilde code.
(af_latin_hints_apply): Updated.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Support vertical stretching of tilde below base glyph. (1/2)
* src/autofit/aflatin.c (af_latin_remove_tilde_points_from_edges,
af_latin_stretch_tilde, af_latin_align_tilde): Rename to...
(af_latin_remove_top_tilde_points_from_edges, af_latin_stretch_top_tilde,
af_latin_align_top_tilde): ...this.
Update all callers.
(af_latin_hints_apply): Rename `is_tilde` to `is_top_tilde`.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Allow vertical adjustment at the top and bottom simultaneously.
This will be used to hint characters like U+1FB7 ('ᾷ').
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Implement it.
2025-04-28 Werner Lemberg <wl@gnu.org>
* src/autofit/afadjust.c (af_reverse_character_map_new): Update tracing.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Indicate tilde handling with a flag macro, too.
* src/autofit/afadjust.h (AF_ADJUST_TILDE_TOP): New macro.
(AF_AdjustmentDatabaseEntry): Remove field `apply_tilde`.
* src/autofit/afadjust.c (adjustment_database,
af_reverse_character_map_new), src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments,
af_latin_hints_apply): Updated.
2025-04-28 Werner Lemberg <wl@gnu.org>
[aflatin] Convert adjustment database enum to macros.
We are going to add more values, and we want to use combinations of them.
* src/autofit/afadjust.h (AF_VerticalSeparationAdjustmentType): Replace
with...
(AF_ADJUST_UP, AF_ADJUST_DOWN, AF_ADJUST_NONE): ... new macros.
(AF_AdjustmentDatabaseEntry): Rename field
`vertical_separation_adjustment_type` to `flags`.
* src/autofit/afadjust.c (af_reverse_character_map_new),
src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Updated.
2025-04-28 Werner Lemberg <wl@gnu.org>
[autofit] Shorten adjustment enum names.
* src/autofit/afadjust.h (AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP,
AF_VERTICAL_ADJUSTMENT_BOTTOM_CONTOUR_DOWN, AF_VERTICAL_ADJUSTMENT_NONE):
Renamed to...
(AF_ADJUST_UP, AF_ADJUST_DOWN, AF_ADJUST_NONE): ...this.
* src/autofit/afadjust.c (adjustment_database,
af_reverse_character_map_expand), src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Updated.
2025-04-26 Werner Lemberg <wl@gnu.org>
* src/autofit/afranges.c: Updated to Unicode 17.0.
But no support for new scripts (volunteers welcomed).
2025-04-26 Werner Lemberg <wl@gnu.org>
* src/autofit/afranges.c: Updated to Unicode 16.0.
But no support for new scripts (volunteers welcomed).
2025-04-26 Werner Lemberg <wl@gnu.org>
* src/autofit/afranges.c: Updated to Unicode 15.1.
But no support for new scripts (volunteers welcomed).
2025-04-26 Werner Lemberg <wl@gnu.org>
* src/autofit/afranges.c: Updated to Unicode 14.0.
But no support for new scripts (volunteers welcomed).
2025-04-26 Werner Lemberg <wl@gnu.org>
* src/autofit/afranges.c: Updated to Unicode 13.0.
But no support for new scripts (volunteers welcomed).
2025-04-26 Werner Lemberg <wl@gnu.org>
* src/autofit/afranges.c: Updated to Unicode 12.0.
But no support for new scripts (volunteers welcomed).
2025-04-25 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/internal/ftcalc.h (FT_MulFix_64): Silence UBSAN.
2025-04-22 Behdad Esfahbod <behdad@behdad.org>
* src/autofit/afadjust.c (af_get_glyph_alternates): Fix endless loop.
2025-04-20 Werner Lemberg <wl@gnu.org>
* src/afadjust.c: Fix test for newer HarfBuzz version (second try).
2025-04-20 Werner Lemberg <wl@gnu.org>
* src/afadjust.c: Fix test for newer HarfBuzz version.
2025-04-20 Werner Lemberg <wl@gnu.org>
[autofit] Request at least HarfBuzz 7.2.0 for diacritic support. (3/3)
This version (from April 2023) added 'SingleSubst' support to
`hb_ot_layout_lookup_get_glyph_alternates`.
2025-04-20 Werner Lemberg <wl@gnu.org>
[autofit] Speed up creation of the adjustment database's reverse map. (2/3)
Remove the old code and activate the new one.
2025-04-20 Werner Lemberg <wl@gnu.org>
[autofit] Speed up creation of the adjustment database's reverse map. (1/3)
As it turns out, the original implementation using
`hb_ot_shape_glyphs_closure` is extremely slow if a font has a rich set of
OpenType features. For example, this function was called 66954 times while
loading font `arial.ttf` version 7.00, increasing FreeType's startup time by
a factor of 10, which is unacceptable.
The new algorithm uses a completely different, more low-level approach, no
longer working with OpenType features but with OpenType lookups. It relies
on function `hb_ot_layout_lookup_get_glyph_alternates`, also replacing
recursion with a simple loop. In total, this brings the additional startup
time back to an acceptable range of a few percent.
A side effect of the new approach is that it catches more alternate forms:
the old code didn't properly handle script-specific features.
To make the change more readable, this commit only adds new code.
2025-04-18 Werner Lemberg <wl@gnu.org>
* src/autofit/afadjust.c (af_reverse_character_map_new): Check `map` limit.
Reported as
https://issues.chromium.org/issues/410925355
2025-04-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/internal/ftcalc.h: Fix fringe compilation.
2025-04-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftcalc.c (ft_corner_orientation) [!FT_INT32]: Fix up.
2025-04-17 Werner Lemberg <wl@gnu.org>
[autofit] Don't access uninitialized memory.
Reported as
https://bugs.ghostscript.com/show_bug.cgi?id=708295
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Initialize all
array elements of `contour_y_minima` and `contour_y_maxima`.
2025-04-17 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (TT_MulFix14,TT_DotFix14)[!FT_INT64]: Sync.
2025-04-17 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (TT_DotFix14): Silence UBSAN.
2025-04-17 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftcalc.c: Miscellaneous cleanups.
2025-04-16 Werner Lemberg <wl@gnu.org>
[autofit] Avoid crash.
Reported as
https://issues.oss-fuzz.com/issues/410811029
* src/autofit/aflatin.c (af_remove_segments_containing_point): Check
`edge->last`.
2025-04-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[base, truetype] Silence UBSAN (cont'd).
* src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14): Use MUL_INT64.
* include/freetype/internal/ftcalc.c (FT_MulFix): Ditto.
2025-04-15 Werner Lemberg <wl@gnu.org>
[autofit] Avoid unnecessary recomputation of HarfBuzz data.
Call the functions once per font instead of once per glyph.
* src/autofit/afadjust.c (af_all_glyph_variants): Move code to compute the
`feature_tags` and `type_3_lookup_indices` sets to...
(af_reverse_character_map_new): ...this function.
2025-04-15 Werner Lemberg <wl@gnu.org>
[autofit] Fix creation of the adjustment database's reverse map.
Due to the way the reverse map array gets constructed with HarfBuzz, there
might be multiple, identical glyph index entries with different character
values in the array. As an example, an OpenType feature like 'unic' might
map lowercase glyph 'ae' to uppercase glyph 'AE', in addition to the already
present cmap entry for 'AE'.
In most cases, this incorrect mapping is harmless (but still wrong).
However, there exist some lowercase/uppercase character pairs where the
diacritic for the uppercase character is on the other vertical side of the
base character as for the lowercase character. An example is U+0122 (LATIN
CAPITAL LETTER G WITH CEDILLA) and U+0123 (LATIN SMALL LETTER G WITH
CEDILLA): the former has the cedilla below, the latter above. A wrong
mapping would thus shift the base glyph 'G' up by a pixel instead of
shifting the cedilla down.
We fix this by always giving precedence to cmap entries.
* src/autofit/afadjust.c (af_reverse_character_map_entry_compare): Do a
secondary sort on the character code.
(af_reverse_character_map_lookup): Adjust binary search to return the
first occurrence of an entry (i.e., the one with the lowest array index).
(af_reverse_character_map_new)[FT_CONFIG_OPTION_USE_HARFBUZZ]: Implement
cmap priority.
2025-04-15 Werner Lemberg <wl@gnu.org>
[autofit] Reduce adjustment database lookups.
This is also in preparation for a follow-up commit.
* src/autofit/afadjust.h (af_lookup_vertical_separation_type,
af_lookup_tilde_correction_type): Replaced with...
(af_adjustment_database_lookup, af_reverse_character_map_lookup):
... this.
* src/autofit/afadjust.c (af_adjustment_database_lookup,
af_adjustment_database_lookup): Updated.
(af_lookup_vertical_separation_type, af_lookup_tilde_correction_type):
Removed.
(af_reverse_character_map_new)[FT_DEBUG_LEVEL_TRACE]: Updated.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments,
af_latin_hints_apply): Updated.
2025-04-15 Werner Lemberg <wl@gnu.org>
* src/afadjust.c (adjustment_database): Make it complete up to U+017F.
2025-04-15 Werner Lemberg <wl@gnu.org>
* src/autofit/afadjust.c (af_reverse_character_map_new): Add tracing code.
2025-04-15 Werner Lemberg <wl@gnu.org>
* src/afadjust.c: Minor fixes.
2025-04-15 Werner Lemberg <wl@gnu.org>
[autofit] Better vertical separation adjustment support. (2/2)
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Handle diacritics
with more than a single contour.
2025-04-15 Werner Lemberg <wl@gnu.org>
[autofit] Better vertical separation adjustment support. (1/2)
Test vertical maxima instead of vertical minima to identify the highest
contour (and vice versa to identify the lowest contour). Doing so will
allow support of diacritics that consist of more than a single outline.
This works because of the topological constraints ensured by the adjustment
database.
* src/autofit/aflatin.c (af_find_highest_contour,
af_glyph_hints_apply_vertical_separation_adjustments): Implement it.
2025-04-15 Werner Lemberg <wl@gnu.org>
[autofit] Use new y extrema arrays.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Implement it.
2025-04-15 Werner Lemberg <wl@gnu.org>
[autofit] Provide infrastructure for storing y extrema of contours.
We need this for better positioning support of diacritics.
* src/autofit/afhints.h (AF_GlyphHintsRec): New fields `contour_y_minima`
and `contour_y_maxima`, together with its embedded variants.
* src/autofit/afhints.c (af_glyph_hints_done, af_glyph_hints_reload): Handle
new arrays.
2025-04-15 Werner Lemberg <wl@gnu.org>
[autofit] Avoid crash.
Reported as
https://issues.oss-fuzz.com/issues/410609442
* src/autofit/aflatin.c (af_remove_segments_containing_point): Check `edge`.
2025-04-14 Werner Lemberg <wl@gnu.org>
[autofit] Fix just introduced heap buffer overflow
Reported as
https://issues.oss-fuzz.com/issues/410393975
* src/autofit/afadjust.c [!FT_CONFIG_OPTION_USE_HARFBUZZ]: Synchronize with
HarfBuzz code.
2025-04-14 Werner Lemberg <wl@gnu.org>
* docs/CHANGES: Mention Craig's GSoC 2023 project.
2025-04-14 Craig White <gerzytet@gmail.com>
[autofit] Add GSUB table handling to reverse character map generation.
If HarfBuzz is enabled, the reverse character map generation now considers
GSUB entries when looking for glyphs that correspond to a code point.
* src/autofit/afadjust.c (af_all_glyph_variants_helper,
af_all_glyph_variants) [FT_CONFIG_OPTION_USE_HARFBUZZ]: New functions.
(af_reverse_character_map_new) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call new
code.
2025-04-14 Craig White <gerzytet@gmail.com>
[autofit] Add tilde-unflattening algorithm.
* src/autofit/aflatin.c (af_find_highest_contour,
af_remove_segments_containing_point,
af_latin_remove_tilde_points_from_edges, af_latin_stretch_tilde,
af_latin_align_tilde): New functions.
(af_latin_hints_apply): Call tilde-unflatting code if necessary.
2025-04-14 Craig White <gerzytet@gmail.com>
[autofit] Implement vertical separation adjustment.
* src/autofit/aflatin.c: Include `afadjust.h`.
(af_latin_metrics_init): Call `af_reverse_character_map_new`.
(af_latin_metrics_done): New function.
(af_move_contour_vertically, af_check_contour_horizontal_overlap,
af_glyph_hints_apply_vertical_separation_adjustments): New functions.
(af_latin_hints_apply): Call
`af_glyph_hints_apply_vertical_separation_adjustments`.
(af_latin_writing_system_class): Updated.
* src/autofit/aftypes.h (AF_StyleMetricsRec): Add `reverse_charmap` field.
2025-04-14 Craig White <gerzytet@gmail.com>
[autofit] Add code for reverse charmaps and adjustment database lookup.
* src/autofit/aftypes.h (AF_ReverseMapEntry, AF_ReverseCharacterMap): New
structures.
* src/autofit/afadjust.c (af_adjustment_database_lookup,
af_reverse_character_map_entry_compare, af_reverse_character_map_lookup,
af_lookup_vertical_separation_type, af_lookup_tilde_correction_type,
af_reverse_character_map_expand, af_reverse_character_map_new,
af_reverse_character_map_done): New functions.
* src/autofit/afadjust.c: Updated.
2025-04-14 Craig White <gerzytet@gmail.com>
[autofit] Add adjustment database.
* src/autofit/afadjust.c, src/autofit/afadjust.h: New files.
* include/freetype/internal/fttrace.h: Add 'afadjust' component.
* src/autofit/autofit.c: Include `afadjust.c`.
* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afadjust.c`.
2025-04-14 Craig White <gerzytet@gmail.com>
[base] Make `find_unicode_charmap` a base function.
This is needed for forthcoming changes in the auto-hinter.
* include/freetype/internal/ftobjs.h, src/base/ftobjs.c: Updated.
2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (hdigits): Removed.
Fixes #1325.
2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/internal/ftcalc.h (FT_MSB) [__CC_ARM]: Added.
2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com>
Typos in macros.
* include/freetype/internal/ftcalc.h: s/_M_X86/_M_IX86/.
* src/truetype/ttinterp.c: s/_M_X86/_M_IX86/.
2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* docs/CHANGES: Updated.
2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[base, truetype] Silence UBSAN.
* src/truetype/ttinterp.c (TT_MulFix14_64): Use unsigned multiplication.
* include/freetype/internal/ftcalc.h (FT_MulFix_64): Ditto.
2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[base, truetype] Synchronize MulFix assembly.
* include/freetype/internal/ftcalc.h (FT_MulFix_*),
src/truetype/ttinterp.c (TT_MulFix14_*): Synchronize routines.
2025-04-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Modernize bytecode projections.
With 64-bit platforms widely available, it is more efficient to use
64-bit variables readily. It results in noticeable 10% improvement
in glyph loading speed.
* src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14) [FT_INT64]:
Prioritize available implementation with arguments adjusted based on
the use cases.
2025-04-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Update FT_MulFix inlining.
Resolves inconsistencies in 64-bit multiplication discussed in !355.
Importantly, FT_MulFix arguments and return value is FT_Long,
whatever sizeof FT_Long is on 64-bit platforms: 8 bytes on Linux or
4 bytes on Windows.
* include/freetype/internal/ftcalc.h (FT_MulFix_x86_64): Removed.
(FT_MulFix_64): Generalize and prioritize the inline implementation
for all 64-bit platforms ifdef FT_INT64.
* src/base/ftcalc.c (FT_MulFix)[FT_INT64]: Call 'FT_MulFix_64'.
* src/base/ftbase.c: Include 'ftcalc.c' after the FT_MulFix callers
to enable its inlining.
2025-04-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Update FT_MulFix inlining.
Resolves inconsistencies in 64-bit multiplication discussed in !355. Importantly, FT_MulFix arguments and return value is FT_Long, whatever sizeof FT_Long is on 64-bit platforms: 8 bytes on Linux or 4 bytes on Windows. * include/freetype/internal/ftcalc.h (FT_MulFix_x86_64): Removed. (FT_MulFix_64): Generalize and prioritize the inline implementation
for all 64-bit platforms ifdef FT_INT64. * src/base/ftcalc.c (FT_MulFix)[FT_INT64]: Call 'FT_MulFix_64'. * src/base/ftbase.c: Include 'ftcalc.c' after the FT_MulFix callers to enable its inlining.
2025-04-05 Graham Asher <graham.asher@cartotype.com>
Missing header wrappers.
* include/freetype/config/integer-types.h, src/smooth/ftgrays.h:
Add missing FT_BEGIN_HEADER and FT_END_HEADER.
* src/smooth/ftgrays.c: Cosmetics.
2025-03-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Clarify callback flow.
* src/bdf/bdflib.c (bdf_line_func_t_): Modify callback prototype.
(bdf_parse_*_): Updated.
(bdf_load_font, bdf_readstream_): Delay callback initiation.
2025-03-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_readstream_): Relocate.
2025-03-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_is_atom_): Do not check tabs.
2025-03-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (_bdf_strncmp): Macro removed, callers updated.
2025-02-26 Alexei Podtelezhnikov <apodtele@gmail.com>
.gitlab-ci.yml: Minor.
2025-02-26 Tim-Philipp Müller <tim@centricular.com>
* .gitlab-ci.yml: Switch to arm64 runners for macOS CI.
2025-02-25 Behdad Esfahbod <behdad@behdad.org>
[sfnt/CPAL] Return early if user requested currently-set palette
Before, we were loading a palette (again and again) even if the
same was requested. Even if the font only had one palette...
For a font like NotoColorEmoji that has over 5000 colors in its
palette, this was dominating the COLRv1 loading times for HarfBuzz
(and I believe all other clients) because they have to set the
palette to get access to the colors.
* src/base/ftcolor.c (FT_Palette_Select): Check the current palette.
2025-01-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_start_): Move setup of properties.
2025-01-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Treat all comments uniformly.
* src/bdf/bdflib.c (bdf_parse_start_): Reject fonts with initial
COMMENTs.
(bdf_parse_properties_): Skip COMMENTs so that...
(bdf_add_property_): Do not make exception for COMMENT.
(bdf_parse_glyphs_, bdf_add_comments): Updated.
2025-01-25 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (BDF_SWIDTH_ADJ_): Remove clashing flag and update.
2025-01-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_atous_): Remove unnecessary checks.
2025-01-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_ato{i.ul.s.us}_]): Remove uncecessary checks.
2025-01-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Postpone font default char handling.
* src/bdf/bdflib.c (bdf_parse_start_, bdf_add_property_): Delay handling
of the default char until...
* src/bdf/bdfdrivr.c (BDF_Face_Init): ... handles all other properties.
2025-01-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Postpone font spacing handling.
* src/bdf/bdf.h (bdf_font_t): Remove `monowidth`.
* src/bdf/bdflib.c (bdf_parse_start_, bdf_add_property_): Delay handling
of the font spacing until...
* src/bdf/bdfdrivr.c (BDF_Face_Init): ... handles all other properties.
2025-01-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Postpone font ascent and descent handling.
* src/bdf/bdflib.c (bdf_parse_start_, bdf_add_property_): Delay handling
of the font ascent and descent until...
* src/bdf/bdfdrivr.c (BDF_Face_Init): ... handles all other properties.
2025-01-22 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_start_): Relax the header order.
We now check that the header is complete in no specific order.
2025-01-20 Chad Brokaw <cbrokaw@gmail.com>
* src/truetype/ttgxvar.c (tt_face_vary_cvt): Fix all shared values.
Applying cvar deltas to all shared points was incorrectly omitted.
Fixes #1314.
2025-01-19 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_glyphs_): Fix tracing.
2025-01-19 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Tokenize input instead of listing.
Instead of cumbersome field list mamangement, we will tokenize input
using custom `bdf_strtok_`.
* src/bdf/bdflib.c (bdf_list_t_, bdf_list_init_, bdf_list_ensure_,
bdf_list_shift_, bdf_list_join_, bdf_list_split_,
bdf_set_default_spacing_): Removed.
(bdf_strtok_): New function which NUL-terminates the first token at
the delimiter position and returns the next token that follows
consequtive delimiters.
(bdf_parse_*_, bdf_load_font): Updated.
* docs/CHANGES: Claim overall 75% performance improvement.
2025-01-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_start_): Prevent another STARTPROPERTIES.
Only one STARTPROPERTIES was permitted in the old flow preventing
leaks and overflows.
See https://issues.oss-fuzz.com/issues/389968131
https://issues.oss-fuzz.com/issues/390464875
2025-01-17 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_start_): Do not overwrite flags.
2025-01-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_readstream_): Skip all control characters.
This agrees with specifications and makes the code a lot simpler.
2025-01-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_start_): Reserve space for artificial properties.
2025-01-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_add_property_): Add extra protection.
See https://issues.oss-fuzz.com/issues/389972472
https://issues.oss-fuzz.com/issues/389968131
2025-01-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c: Clean up.
2025-01-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Use flags instead of options.
* src/bdf/bdf.h (bdf_options_t): Removed.
(BDF_KEEP_COMMENTS, BDF_KEEP_UNENCODED, BDF_CORRECT_METRICS): Updated
to avoid collisions with the other parsing flags.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Use default flags explicitly.
* src/bdf/bdflib.c (bdf_load_font): Use flags as an argument to
initialize the parser.
(bdf_set_fedault_spacing_): Default to BDF_PROPORTIONAL explicitly.
(bdf_parse_*_): Updated.
2025-01-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Adjust parsing flow and CHARS handling.
* src/bdf/bdflib.c (bdf_readstream_): Remove CHARS exception.
(bdf_parse_glyphs_): Move glyphs allocation...
(bdf_parse_properties_): and missing ascent and descent handling...
(bdf_parse_start_): ...to here under CHARS.
2025-01-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_readstream_): Tweak variables and loop design.
2025-01-13 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_glyphs_): Free unused glyph_name.
See https://issues.oss-fuzz.com/issues/389330334.
2025-01-13 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_glyphs_): Store glyph as soon as possible.
2025-01-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_glyphs_): Avoid possible leak.
2025-01-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Speed up bitmap parsing.
A dedicated parser of bitmap data with minimal error checking and
no string comparisons helps to improve performance.
* src/bdf/bdflib.c (bdf_parse_bitmap_): New dedicated bitmap parser.
(bdf_parse_glyphs_): Pass to `bdf_parse_bitmap_` on BITMAP.
2025-01-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (a2i): Formatting.
2025-01-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_*_): Minor improvements.
2025-01-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdf.h (bdf_font_t): Correct `internal` type.
* src/bdf/bdflib.c (*): Update users.
2025-01-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/ftsystem.c: Fix ancient condition.
2025-01-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_parse_start_): Fix tracing labels.
2025-01-09 Alexei Podtelezhnikov <apodtele@gmail.com>
* MSBuild.rsp: Force console color for mintty.
2025-01-09 Heiko Lewin <hlewin@worldiety.de>
* CMakeLists.txt: Use modern IMPORTED targets.
This resolves build problems with newer libPNG versions by switching
to using IMPORTED CMake targets for common libraries where provided.
To do this the required CMake version is raised to version 3.12.
Doing this seems justified as using IMPORTED targets is a cleaner
and more powerful solution that can leverage advanced and CMake-specific
features that may be utilized by the referred dependencies' CMake modules.
Resolves #1311.
2025-01-08 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff] Remove size/slot checks.
After the previous commit, cff_glyph_load is no longer called
without first checking for valid size and glyph objects in
FT_Glyph_Load and these checks can be removed downstream.
* src/cff/cffdrivr.c (cff_glyph_load): Remove `size` and `glyph` checks.
* src/cff/cffgload.c (cff_slot_load): Ditto.
2025-01-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffdrivr.c (cff_get_advances): Do only fast advances.
Otherwise, let TT_Get_Advances fall back on cff_load_glyph to do
slow advances. This avoids unchecked access to cff_load_glyph and
this is how tt_get_advances is implemented.
2025-01-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (TT_Load_Glyph): Consolidate flag setting.
2025-01-04 Alexei Podtelezhnikov <apodtele@gmail.com>
Delay FT_GLYPH_FORMAT_OUTLINE assignmets.
This assignmets used to be done prematurely before errors were checked
and outlines were actually loaded. Delaying the assignment provides
certain protection against careless usage of malformed input that
should now remain FT_GLYPH_FORMAT_NONE.
* src/cff/cffgload.c (cff_slot_load): Ditto.
* src/cid/cidgload.c (cid_slot_load_glyph): Ditto.
* src/pfr/pfrobjs.c (pfr_slot_load): Ditto.
* src/truetype/ttgload.c (TT_Load_Glyph): Ditto.
* src/type1/t1gload.c (T1_Load_Glyph): Ditto.
2025-01-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/compiler/gcc-dev.mk: Silence some warnings.
2025-01-02 Alexei Podtelezhnikov <apodtele@gmail.com>
Remove superfluous outline zeroing.
This is already done by `ft_glyphslot_clear`.
* src/cff/cffgload.c (cff_slot_load): Do not zero outline fields.
* src/cid/cidgload.c (cid_slot_load_glyph: Ditto.
* src/pfr/pfrobjs.c (pfr_slot_load): Ditto.
* src/truetype/ttgload.c (load_sbit_image): Ditto.
* src/type1/t1gload.c (T1_Load_Glyph): Ditto.
2025-01-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttobjs.c: Abbreviate tracing.
2025-01-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttsbit.c (tt_face_load_sbix_image): Refactor `flip`.
2025-01-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Consolidate bitmap strike handling.
* src/truetype/ttgload.c (TT_Load_Glyph): Relocate omitted whitespace
strike handling from here...
(load_sbit_image): ... to here.
2024-12-31 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Ingnore FT_LOAD_NO_BITMAP in bitmap-only fonts.
For consistency with other bitmap-only fonts, we should ignore this
flag of the font is not scalable.
* src/truetype/ttgload.c (TT_Load_Glyph): Check if face is scalable
when checking for FT_LOAD_NO_BITMAP.
* docs/CHANGES: Start new chapter wtith this change.
2024-12-16 Ben Wagner <bungeman@chromium.org>
[ftstroke] Fix invalid pointer assignement to `arc`
In `FT_Stroker_ConicTo` and `FT_Stroker_CubicTo` there is a `bez_stack`.
`arc` is initialized with `arc = bez_stack` and is never set to point
into any different object. The main loop looks like `while ( arc >=
bez_stack )` which is depending on a later `arc -= 2` (or `arc -= 3`) to
make `arc` point to before `bez_stack`. However, using pointer
subtraction to make `arc` point outside the array is undefined behavior,
and attempting to use the value in the loop predicate is "very"
undefined behavior. (C99 "Additive operators" 6.5.6.8.)
This particular undefined behavior was discovered as either hangs or
MemorySantizer issues after "[InstCombine] Infer nuw for gep inbounds
from base of object" [0]. With this change, clang can infer that `arc`
must always point into the `bez_stack` object and therefore cannot be at
a "negative index" so the predicate is always true.
[0] https://github.com/llvm/llvm-project/commit/e21ab4d16b555c28ded307571d138f594f33e325
* src/base/ftstroke.c (FT_Stroker_ConicTo, FT_Stroker_CubicTo): test
loop exit condition (there are no more arcs to process) before
decrementing `arc`
Fixes: #1307
2024-12-04 Ben Wagner <bungeman@chromium.org>
[cff] Fix leak of cmap data
When `sfnt->load_face` succeeds it has already loaded any (optional)
cmap data. As a result, a subsequent call to `sfnt->load_cmap` will
overwrite the cmap data pointer with a new copy of the data but not free
the old, leading to a leak.
This is a fix for "* src/cff/cffobjs.c (cff_face_init): Better handling
of Type0 fonts.". This still allows the cmap to be missing but avoids
the leak by only calling `sfnt->load_cmap` when there is no `head`
table (the font data is not being loaded as OpenType/CFF).
* src/cff/cffobjs.c (cff_face_init): Fix leak
Fixes: #1306
2024-11-06 Honnesh Ramachandra <hramachandra@adobe.com>
* src/cff/cffobjs.c (cff_face_init): Better handling of Type0 fonts.
This issue relates to the PDF specification and its usage of CFF-based
embedded Type0 fonts. For Type0 fonts containing CID-keyed descendant
CFF-based fonts, the glyph index is the CID present in the content stream.
As a result, there is no requirement for a 'cmap' table to be present in the
font since the glyph indices are derived directly from the CIDs. FreeType
throws an error when it doesn’t find a 'cmap' table for such an Open Type
font containing CFF outlines. This commit relaxes this requirement for a
'cmap' table for such fonts.
2024-10-18 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Download the latest gnu-config files in `make dist`.
* builds/toplevel.mk: In `make dist`, checkout gnu-config
git repository at savannah, copy the latest versions of
`config.guess` and `config.sub` to builds/unix/. Also
the latest version of `gitlog-to-changelog` is used to
generate `ChangeLog`.
2024-10-16 Behdad Esfahbod <behdad@behdad.org>
Move generic destroy to later in the face and size destruction.
* src/base/ftobjs.c (destroy_size, destroy_face): This is such that the
generic destroy can be used to call `FT_Done_Library`. For that to work,
it needs to call it *after* having removed the face from the respective
module.
2024-10-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (load_truetype_glyph): Rearrange.
2024-10-14 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* autogen.sh: Fix for Solaris 10.
o Replace `test -e` by `test -d` (directory) and `-h`
(symlink), because pre-POSIX /bin/sh of Solaris 10
does not support `test -e`.
o Replace the combination of `head` and `sed ...` by
single sed command `sed -n 1...p`. GNU libtoolize
with Solaris 10 /bin/sh complains "Broken Pipe" for
the closure of stdout by `head`. Let `sed` receive
all stdout and discard.
2024-10-13 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (gray_convert_glyph): Clear stack pointers.
Fixes a dangling pointer warning, see #1299.
2024-10-13 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
apinames: Fix a buffer overrun for VMS platform.
Some output formats may rewrite symbol names during the output,
like the concatenation of "64__" suffix on VMS. To estimate
sufficient size to store symbol name, pass the output format
info to `names_add`. For VMS, `names_add` allocates longer
buffer to append "64__".
* apinames.c (SUFFIX_VMS_64ADDR): New macro of "64__".
(main): Pass the format info to `read_header_file`.
(read_header_file): Pass the format info to `names_add`.
(names_add): Receive the format info, and reserve the symbol
name buffer 4 byte longer in the case of VMS, to append the
suffix in `names_dump`.
2024-10-13 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
apinames: Fix out-of-scope reference of a static array.
* apinames.c (names_dump): For WATCOM_LBC format, the
DLL name with no suffix is constructed on a static
array temp[], but the scope is closed before use it.
The declaration of temp[] is moved to the wider
scope for the dumping part to refer it.
2024-10-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* vms_make.com: Format rules.
Use tabs in rules only à la Makefile.
2024-10-12 Marian Klymov <nekto1989@gmail.com>
* meson.build: Define DLL_EXPORT for shared library only.
Fixes #1298.
2024-10-12 Benoit Pierre <benoit.pierre+freedesktop@gmail.com>
* meson.build: Minor improvements.
2024-10-12 Benoit Pierre <benoit.pierre+freedesktop@gmail.com>
* meson.build: Fix `bzip2` option handling.
2024-10-12 Benoit Pierre <benoit.pierre+freedesktop@gmail.com>
* meson.build: Add support for compiling with error strings.
* meson_options.txt: Document it.
2024-10-10 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Fix help message of apinames.
* src/tools/apinames.c: The first header file must be
given after the options. All arguments after the
first header file are dealt as header files to be
parsed, regardless with their leading "-".
For example,
"apinames include/freetype/freetype.h -dFREETYPE.DLL"
warns "unable to open -dFREETYPE.DLL".
Thus, the "header1" must be given after the arguments
to be parsed as the options.
2024-09-21 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
Minor fixes for OpenVMS.
* vms_name.com: Suppress a warning with the latest Clang compiler.
* builds/vms/apinames_vms.bash: Use absolute path to avoid dependency on the
environment.
2024-09-07 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttsbit.c (tt_face_load_sbix_image): Respect metrics_only.
Also fixes recursive flip.
2024-09-06 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttsbit.c (tt_face_load_sbix_image): Tweak loop.
2024-09-06 Andrew Murray <radarhere@users.noreply.github.com>
[sfnt] Support sbix graphicType 'flip'.
* src/sfnt/ttsbit.c (tt_face_load_sbix_image): Currently undocumented by
Apple, this flips the bitmap data horizontally. It is used on macOS in
Apple Color Emoji; 19.4d6e1; 2024-02-05 (file `Apple Color Emoji.ttc`).
Fixes issue #1282.
2024-09-05 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Add `clang` to host compiler candidates in cross building.
* builds/unix/configure.raw: In cross building,
`clang` is tried if there is no `gcc`, nor `cc`.
2024-09-05 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Improve the build rule for `apinames`.
* builds/unix/configure.raw: copy `CFLAGS` &
`LDFLAGS` values to `CFLAGS_BUILD` &
`LDFLAGS_BUILD`, in a self-hosting case.
* builds/unix/unix-cc.in: set `CCexe_CFLAGS` &
`CCexe_LDFLAGS` by `CFLAGS_BUILD` &
`LDFLAGS_BUILD`.
In some confused environments, simple building
like `cc -o apinames apinames.c` is no longer
able to build an executable running on the host.
The validity of `CC` is tested with consideration
of `CFLAGS` and `LDFLAGS`, thus, duplicating
`CFLAGS` & `LDFLAGS` to `CCexe_CFLAGS` &
`CCexe_LDFLAGS` (via XXX_BUILD) would be slightly
safer in a self-hosting build.
Fixes the issue #1296.
2024-08-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttcmap.c (tt_cmap*_get_info): Remove casting.
2024-08-25 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/ftimage.h (FT_Bitmap): Describe empty bitmap.
2024-08-14 luz paz <luzpaz@github.com>
Fix various typos.
2024-08-13 Alexei Podtelezhnikov <apodtele@gmail.com>
* messon.build: Install `include/freetype/ftlogging.h`.
Fixes #1292.
2024-08-12 Werner Lemberg <wl@gnu.org>
* Version 2.13.3 released.
==========================
Tag sources with `VER-2-13-3'.
* docs/VERSION.TXT: Add entry for version 2.13.3.
* docs/CHANGES: Updated.
* docs/release, docs/README, builds/macs/README: Updated.
* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.13.2/2.13.3/, s/2132/2133/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 3.
* builds/unix/configure.raw (version_info): Set to 26:2:20.
* CMakeLists.txt (VERSION_PATCH): Set to 3.
2024-08-12 Werner Lemberg <wl@gnu.org>
* meson.build: Install `freetype2.m4`.
Fixes #1290.
2024-08-12 Werner Lemberg <wl@gnu.org>
* src/*/*: Fix C++ compilation; fix clang warnings.
2024-08-12 Werner Lemberg <wl@gnu.org>
* subprojects/*.wrap: Updated.
2024-08-12 Werner Lemberg <wl@gnu.org>
Various minor documentation or formatting fixes.
2024-08-07 Werner Lemberg <wl@gnu.org>
tttables.h (FT_Get_CMap_Format): Minor documentation improvement.
2024-08-05 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgxvar.c (ft_var_readpacked*): Minor.
2024-08-05 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftstream.c (FT_Stream_ReadFields): Switch to `FT_Offset`.
2024-08-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/winfonts/winfnt.c (fnt_face_get_dll_font): Unwrap arithmetic.
2024-08-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftstream.c (FT_Stream_ReadFields): Update condition.
2024-08-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype/GX] Use more robust conditions.
* src/truetype/ttgxvar.c (ft_var_readpacked{points,deltas}): Rewrite
conditions to avoid undefined behavior.
2024-07-31 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype/GX] Read points and deltas more carefully.
Hopefully fixes newly introduced buffer overflows:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=70807
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=70809
* src/truetype/ttgxvar.c (ft_var_readpacked{points,deltas}): Explicitly
check stream frame limits and modify run counting.
2024-07-30 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype/GX] Read stream more aggressively.
With ample checks against the table size, we should be able to use
macros without the limit checks and functional calls.
* src/truetype/ttgxvar.c (ft_var_readpacked{points,deltas}):
Use FT_NEXT_* instead of FT_GET_*.
2024-07-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttload.c (tt_face_load_name): Shorten dereference.
2024-07-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/autofit/afmodule.c (af_autofitter_load_glyph): Shorten deref.
2024-07-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf,pcf,winfonts,sfnt] Remove barely used marcros.
* include/freetype/internal/ftobjs.h (FT_FACE_SIZE, FT_SIZE_FACE):
Removed.
* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Updated.
* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Ditto.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto
* src/sfnt/ttbdf.c (tt_face_find_bdf_prop): Ditto.
2024-07-27 Dan Rosser <danoli3@gmail.com>
* include/freetype/internal/ftcalc.h (FT_MSB)[_M_ARM64EC]: Added.
2024-07-19 Werner Lemberg <wl@gnu.org>
* src/truetype/ttobjs.c (tt_size_run_prep): Correct scaling of CVT values.
This reverts the scaling behaviour introduced in commit 37580053.
Fixes issue #1005.
2024-06-29 Philip Race <philip.race@oracle.com>
* psobjs.c (ps_table_add): Check length before calling `FT_MEM_CPY`.
Fixes issue #1280.
2024-06-29 Don Olmstead <don.j.olmstead@gmail.com>
CMakeLists.txt: Respect FT_DISABLE_ZLIB value
The CMake build uses `find_package` to look for dependencies. Before calling `find_package` it looks to see if the dependency was disabled. If not the associated `_FOUND` variable will be set. This value is then checked to determine if the dependency is added.
However `find_package(PNG)` calls `find_package(ZLIB)` within its find module. So in the case of `FT_DISABLE_ZLIB=TRUE` and `FT_DISABLE_PNG=FALSE` the `ZLIB_FOUND` value can be set and even though `FT_DISABLE_ZLIB` is turned on.
Unset the value of `ZLIB_FOUND` after the call to `find_package(PNG)` so the value is only set when `FT_DISABLE_ZLIB` is turned off.
2024-06-26 Werner Lemberg <wl@gnu.org>
Make 'multi' build work again.
* src/psaux/psobjs.c: Include `psft.h`.
* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttgpos.c`.
Fixes issue #1284.
2024-06-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (load_truetype_glyph): Unsigned fix.
2024-06-21 Alexei Podtelezhnikov <apodtele@gmail.com>
Use unsigned tags `FT_Outline`.
This change comes along with 2a7bb4596f56 ans is only meant to reduce
pointer casting in the code.
* include/freetype/ftimage.h (FT_Outline): Do it.
* src/*: Update `FT_Outline` users.
2024-06-21 Ben Wagner <bungeman@chromum.org>
[ttgxvar] Avoid "applying zero offset to null pointer"
In C it is undefined behavior to do arithmetic on a null pointer, including
adding zero. When using NotoSansKhmer[wdth,wght].ttf UBSAN produces a report
like
ttgxvar.c:1052:31: runtime error: applying zero offset to null pointer
when adding zero to `varData->deltaSet` (which is null) to produce `bytes`.
Protect against all the potential issues of this kind by returning early if
`varData->regionIdxCount == 0`.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): early return on no regions
2024-06-21 Alexei Podtelezhnikov <apodtele@gmail.com>
Use unsigned point and contour indexing in `FT_Outline`.
This doubles the number or allowed points, see
https://github.com/harfbuzz/harfbuzz/issues/4752
Although it is hardly practical to use more than 32767 points,
other font engines seem to support it.
* docs/CHANGES: Announce it.
* include/freetype/ftimage.h (FT_Outline): Do it and update limits.
* src/*: Update `FT_Outline` users.
2024-06-20 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pfr/pfrgload.c (pfr_glyph_curve_to): Avoid casting.
2024-06-19 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftgloadr.c (FT_GlyphLoader_Prepare): Minor refactoring.
2024-06-18 Alexei Podtelezhnikov <apodtele@gmail.com>
[base, autofit, psaux] Remove unnecessary casting.
* src/autofit/afhints.c (af_glyph_hints_reload): Remove (short) casting.
* src/base/ftgloadr.c (FT_GlyphLoader_Add): Ditto.
* src/psaux/psobjs.c ({t1,cff,ps}_builder_{add,close}_contour): Ditto.
2024-06-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/ftimage.h: Explain standard types.
2024-05-29 Ben Wagner <bungeman@chromium.org>
[ttgxvar] Replace tabs with spaces
Also clarify comments around conversion and clamping.
* src/truetype/ttgxvar.c (ft_var_to_normalized): doit
2024-05-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype/GX] Consolidate memory allocations.
* src/truetype/ttgxvar.c (tt_face_vary_cvt, TT_Vary_Apply_Glyph_Deltas):
Allocate and split bigger memory blocks, avoid unnecessary zeroing,
do not copy shared tuples, revise error exit paths.
2024-05-26 Alexei Podtelezhnikov <apodtele@gmail.com>
Whitespace.
2024-05-24 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgxvar.c (ft_var_apply_tuple): Reduce checks.
2024-05-24 Alexei Podtelezhnikov <apodtele@gmail.com>
Revert "[truetype] Reduce allocation scope."
This reverts commit 9ff4153cbfd60491f11bb56905ce6e20e94d23c7.
2024-05-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Reduce allocation scope.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Reduce scope
of `points_org` and 'points_out`.
2024-05-23 Alexei Podtelezhnikov (Алексей Подтележников) <apodtele@gmail.com>
* .gitlab-ci.yml: Disable UWP compilation.
2024-05-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/internal/ftmemory.h (FT_MEM_DUP): Fix g++ error.
2024-05-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff, truetype] Validate variation axes immediately.
Instead of validating variation axes in every access, OpenType specs
suggest that peak = 0 be used to tag invalid ranges. This implements
just that once during loading.
* src/cff/cffload.c (cff_blend_build_vector): Move the range checks...
(cff_vstore_load): ... here.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Ditto...
(tt_var_load_item_variation_store): ... ditto.
2024-05-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff, truetype] Rearrange variation range checks.
This should achieve quicker results for common cases.
* src/cff/cffload.c (cff_blend_build_vector): Rearrange conditionals.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Ditto.
2024-05-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Align with specs.
2024-05-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Minor refactoring.
2024-05-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff] Optimize the blend vector computations.
* src/cff/cffload.c (cff_blend_build_vector): Use FT_MulDiv and skip
multiplying by 1.
2024-05-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Use concise macros.
* src/bdf/bdflib.c (bdf_create_property): Use FT_STRDUP.
(bdf_parse_glyphs_, bdf_parse_start_): Use FT_DUP for brevity.
2024-05-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Use FT_DUP to duplicate data.
* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Use concise FT_MEM_DUP.
2024-05-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype, type1] Use FT_DUP to duplicate data.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use concise FT_DUP.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Ditto.
* src/type1/t1load.c (parse_subrs): Ditto.
2024-05-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/ftsystem.c: Use _WINRT_DLL to check for UWP.
Fixes compilation using Windows GDK, reported by Erin Melucci.
2024-05-13 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/ftmm.h: Include `freetype.h`.
Reported by Ben Wagner, see !326.
2024-05-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[type1/MM] Safer handle arrays of different types.
* src/type1/t1load.c (parse_blend_design_map): Separately allocate...
(T1_Done_Blend): ... and free `design_points` and `blend_points`.
2024-05-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/type1/t1load.c (parse_blend_design_map): Add risky cast.
2024-05-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* docs/CHANGES: Mention the last commit.
2024-05-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[type1/MM] Tighten headers.
* include/freetype/internal/t1types.h: Host PS_DesignMap and PS_Blend.
* include/freetype/ftmm.h: Host and document TT_MAX_MM_XXX.
* include/freetype/t1tables.h: Remove them from here.
2024-05-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pshinter/pshrec.c (ps_hints_stem): Correct argument.
2024-05-08 Ben Wagner <bungeman@chromium.org>
[psaux] Fix location and type order in initializer
`T1_FIELD_ZERO` is used to zero initialize a `T1_FieldRec`.
`T1_FIELD_ZERO` is currently initilizing `T1_FieldRec::location` with a
`T1_FieldType` and `T1_FieldRec::type` with a `T1_FieldLocation`. This
was detected with `-Wenum-conversion`.
* include/freetype/internal/psaux.h (T1_FIELD_ZERO): correct order of
initalizers
2024-05-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/internal/psaux.h: Fix g++ warning.
Reported by Hin-Tak Leung.
2024-05-08 Ben Wagner <bungeman@chromium.org>
[colr] Avoid overflow in range checks
In 32 bit builds `FT_ULong` is 32 bits and can silently overflow when a
large number is read into one and then it is summed or multiplied with
another number. Checks for range overflow must be written so that they
themselves do not overflow. Also ensure that the table_size is always the
first part of the range check and consistently use `<` or `<=`.
* src/sfnt/ttcolr.c (tt_face_load_colr): Avoid overflow.
(find_base_glyph_v1_record): Remove old work-around.
Bug: https://issues.chromium.org/issues/41495455
Bug: https://issues.chromium.org/issues/40945818
2024-05-06 Werner Lemberg <wl@gnu.org>
.mailmap: Fix entry for Ben Wagner.
2024-05-06 Alexei Podtelezhnikov <apodtele@gmail.com>
[sdf, bsdf] Use shared FT_SqrtFixed.
FT_SqrtFixed (95b0fe2a6dff) is faster and does not overflow.
* src/sdf/ftsdfcommin.h (square_root): Replace with a macro.
* src/sdf/ftsdfcommin.c (square_root): Remove function.
2024-05-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Remove FT_ABS.
See
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=68679
2024-05-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/sfwoff2.c (woff2_open_font): Fix copy-paste typo.
2024-05-03 Alexei Podtelezhnikov <apodtele@gmail.com>
[woff,woff2] Limit the number of tables and use FT_MSB.
The upper limit of 4095 is implied by the SFNT header format
where the multiplication by 16 would overflow without it.
* src/sfnt/sfwoff.c (woff_open_font): Updated.
* src/sfnt/sfwoff2.c (woff2_open_font): Ditto.
2024-05-02 Ben Wanger <bungeman@gmail.com>
[woff2] Disallow zero table font entries
The existing code already disallows zero table woff2 overall, but still
allows for individual CollectionFontEntry to create font instances with
zero tables. Such fonts are not useful so error early.
This also fixes an MSAN discovered issue where if a CollectionFontEntry
numTables is zero then the sfnt_header was not fully initialized.
* src/sfnt/sfwoff2.c (woff2_open_font): error on zero tables, always
initalize sfnt_header
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=68384
2024-05-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Use faster macros in checksums.
* src/truetype/ttobjs.c (tt_synth_sfnt_checksum): Use FT_NEXT_XXX.
* src/sfnt/sfwoff2.c (compute_ULong_sum): Use macros.
2024-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/sfwoff2.c (compute_ULong_sum): Clean up.
2024-04-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* docs/CHANGES: Updated.
2024-04-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftccache.c (FTC_Cache_RemoveFaceID): Remove nodes instantly.
2024-04-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Remove unused `node_reset`.
* src/cache/ftcmru.h (FTC_MruListClassRec): Remove `node_reset` field.
* src/cache/ftcbasic.c (ftc_basic_{image,sbit}_family_class): Ditto.
* src/cache/ftcmanag.c (ftc_face_list_class): Ditto.
(ftc_size_node_reset): Remove function.
* src/cache/ftcglyph.h: Fix comment.
2024-04-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcmru.c (FTC_MruList_New): Do not reset nodes.
Resetting of the size nodes can crash, if a parent face purge happens
simultaneously and destroys the node. It is safer to create a new node.
Fixes #1270, reopened with a separate issue.
2024-04-28 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcimage.c (ftc_inode_weight): Formatting.
2024-04-28 Alexei Podtelezhnikov <apodtele@gmail.com>
Document the SDF spread further.
2024-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/ftdriver.h: s/truncated/clamped/.
2024-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
Improve SDF documentation.
2024-04-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Minor tweaks.
* src/cache/ftcimage.c (ftc_inode_free): Remove unnecessary check.
* src/cache/ftcmanag.c (FTC_Manager_Done): Do not zero before freeing.
2024-04-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcbasic.c: Cosmetic harmonization.
2024-04-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Reduce type mismatches.
* src/cache/ftcbasic.c (FTC_BasicAttrRec): Match type of `load_flags`
to its main purpose in `FT_Load_Glyph`.
(FTC_ImageCache_Lookup{,Scaler},FTC_SBitCache_Lookup{,Scaler}): Updated.
2024-04-19 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/{ftcbasic.c,ftccmap.c}: Use FTC_INLINE.
2024-04-19 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Tweak headers.
* src/cache/ftccback.h: Include less and move `ftc_node_destroy`...
* src/cache/ftccache.h: ... to here.
* src/cache/ftcmanag.c: Include less.
2024-04-19 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcglyph.c [!FTC_INLINE]: Fix compilation.
2024-04-17 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Improve MRU list management.
* src/cache/ftcmru.c (FTC_MruList_Remove): Cosmetic.
(FTC_MruList_New): Accept only valid changes.
* src/cache/ftcmanag.c (ftc_size_node_done): Simplify.
2024-04-17 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Fix error handling.
Manipulate the cache after a face is requested or a size is looked up
successfully. Fixes #1270.
* src/cache/ftcmanag.c (ftc_size_node_init, ftc_size_node_reset,
ftc_face_node_init): Check for errors before accepting a change.
* src/cache/ftcmru.c (FTC_MruList_New): Do nothing if reset fails.
2024-04-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Switch to vertical bisections.
With horizontal bisections, the smallest section is a whole single
scanline. Almost horizontal lines or other complex scanlines can
easily overflow the rendering pool. Switching to vertical bisections
splits the scanlines and should rule out the overflows. Fixes #1269.
* src/smooth/ftgrays.c (gray_convert_glyph): Bisect vertically.
2024-04-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (gray_convert_glyph): Refactor for convenience.
2024-04-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Store persistent clipping box.
* src/smooth/ftgrays.c (gray_TWorker, gray_raster_render): Add and set
the new structure field.
(gray_convert_glyph): Use it.
2024-03-08 Ben Wanger <bungeman@gmail.com>
[colr] Ensure enough bytes for PaintColrLayers
* src/sfnt/ttcolr.c (read_paint): check that there are five additional
bytes to be read when reading PaintColrLayers.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66566
2024-03-08 Ben Wagner <bungeman@gmail.com>
Avoid n^2 scanning for binary data.
When creating a CID parser the location of the 'StartData' or '/sfnts'
tokens needs to be known. However, the token parser requires that the
entire document be in memory and flattening the entire stream into memory is
to be avoided.
To avoid forcing the entire stream into memory, previously this code would
scan through the stream looking for 'StartData' or '/sfnts' as strings.
However, these strings could have been in a comment or string token, so the
stream would be read into memory up to that point and the parser run to
check that these strings were actually tokens. This forced a parser restart
from the beginning each time; as a result, data with many 'StartData'
non-tokens would take n^2 time to check.
* src/cid/cidparse.c (cid_parser_new): Change algorithm to make the initial
scan look for the last possible 'StartData' or '/sfnts' string in the
stream. The stream is read forward instead of backward as a typical normal
CID font will have one 'StartData' toward the beginning of the data and it
it much faster to read the data from beginning to end instead of end to
beginning. For memory-based fonts the limit is set to the end of the stream
since the stream is already in memory. Then the parser is run once to look
for 'StartData' or '/sfnts' tokens. If they are found the parser is re-set
to reflect this new information.
Reported as
https://issues.chromium.org/issues/40201695
2024-03-06 Alexei Podtelezhnikov <apodtele@gmail.com>
* CMakeLists.txt: Bump required version to 3.5.
Fixes #1267.
2024-03-04 Jordan Williams <jordan@jwillikers.com>
meson: Use the standard dependency mechanism to find bzip2
This follows standard conventions in Meson by using the pkg-config file.
This change allows Conan to switch to the Meson build system.
2024-02-29 Ben Wanger <bungeman@gmail.com>
[cff, truetype] Always set up default variable instance.
For default variable instances `cff_face_init` did not set the blend. This
mostly worked as later use of the unset blend produced the default
variation. However, if a user called `TT_Get_MM_Var` the blend would be
partially set up, but not fully. In particular the number of axes, the axis
definitions, and the instance locations would be set up, but not the current
instance location (`coords` and `normalizedcoords`). This could lead to the
default instances of CFF2 fonts erroring on any use of `blend`.
Ensure the default variable instance is fully set up by always calling
`FT_Set_Named_Instance` on a variable face.
* src/cff/cffobjs.c (cff_face_init): Call `FT_Set_Named_Instance` on
default instances.
* src/truetype/ttobjs.c (tt_face_init): Ditto.
Fixes #1268.
2024-02-23 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgxvar.c (ft_var_to_normalized): Integer overflow.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66543
2024-01-27 Alexei Podtelezhnikov <apodtele@gmail.com>
Update all copyright notices.
2024-01-27 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttgpos.c (tt_gpos_get_glyph_class): Fix warning C4018.
2024-01-27 David Saltzman <davidbsaltzman@gmail.com>
Add support for kerning from 'GPOS' tables.
This commit adds support for kerning from 'GPOS' tables, while maintaining
support for basic 'kern' tables. `FT_HAS_KERNING` will be true for a font
with either available and `FT_Get_Kerning` will still use the basic 'kern'
table data if avilable, otherwise check the GPOS 'kern' feature.
This feature is disabled by default; it can be enabled with the
`TT_CONFIG_OPTION_GPOS_KERNING` flag.
Only basic kerning (pair positioning with just an x advance) is supported
from the GPOS layout features; support for that was added to make the
existing `FT_Get_Kerning` API more consistently functional. FreeType does
not intend to extend itself to further GPOS functionality though; a
higher-level library like HarfBuzz can be used instead for that.
* include/freetype/config/ftoption.h, include/devel/ftoption.h
(TT_CONFIG_OPTION_GPOS_KERNING): New configuration option.
* include/freetype/internal/fttrace.h: Add `ttgpos` trace handler.
* include/freetype/internal/sfnt.h (SFNT_Interface): Add `load_gpos` and
`get_gpos_kerning` fields.
(FT_DEFINE_SFNT_INTERFACE): Updated.
* include/freetype/internal/tttypes.h: Include `fttypes.h`.
(TT_FaceRec) [TT_CONFIG_OPTION_GPOS_KERNING]: Add `gpos_table` and
`gpos_kerning_available` fields.
* src/sfnt/ttgpos.c, src/sfnt/ttgpos.h: New files.
* src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GPOS_KERNING]: Include `ttgpos.h`.
(sfnt_interface): Updated.
* src/sfnt/sfnt.c: Include `ttgpos.c`.
* src/sfnt/sfobjs.c [TT_CONFIG_OPTION_GPOS_KERNING]: Include `ttgpos.h`.
(sfnt_load_face) [TT_CONFIG_OPTION_GPOS_KERNING]: Load and free GPOS kerning
data; check GPOS kerning availability.
* src/truetype/ttdriver.c (tt_get_kerning): Use GPOS kerning if there's no
'kern' table.
2024-01-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Remove SSE2.
As a result of 7b308a29dd10, the regular 64-bit execution is now faster
than SSE2. The rendering speed of script fonts at 64 ppem or larger is
improved by about 3% without SSE2. See !314 for the testing results.
* src/smooth/ftgrays.c (gray_render_conic)[FT_INT64]: Remove SSE2 code.
2024-01-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* CMakeLists.txt: Accommodate MingGW.
See https://github.com/StephanTLavavej/mingw-distro/issues/97.
2024-01-08 Ozkan Sezer <sezeroz@gmail.com>
* src/sfnt/ttcolr.c (find_base_glyph_v1_record): Fix build in C90 mode.
2024-01-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Fix up Mac resource forks and dfonts.
* src/base/ftobjs.c (IsMacResource): Assign `face_index`.
* src/base/ftmac.c (FT_New_Face_From_Suitcase): Ditto after rework.
2024-01-05 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Restrict POST version 1.0.
A font has surfaced with `post` version 1.0 and fewer than 258 glyphs.
Its glyphs did not correspond to their names. We now reject such `post`
strictly following specifications.
* src/sfnt/ttpost.c (tt_face_get_ps_name): Check the number of glyphs
for version 1.0.
2024-01-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* .gitlab-ci.yml: Use detached CI pipelines.
See issue freedesktop/freedesktop#540.
2024-01-02 Werner Lemberg <wl@gnu.org>
[sfnt] Guard access in 'COLR' v1 glyph binary search.
Reported as
https://bugs.chromium.org/p/chromium/issues/detail?id=1505216
* src/sfnt/ttcolr.c (find_base_glyph_v1_record): Guard access of the search
pointer during binary search. The pointer needs to be checked as we go as
the test that compares number of v1 glyphs with table size at the time of
loading the table is not sufficient on its own.
A scenario is possible in which the `BaseGlyphRecord` list extends into
non-`BaseGlyphRecord` parts of the 'COLR' v1 table (but passed the size
comparison check). Then, at those locations, invalid glyph ID values are
read and may provoke an invalid read due to reassigning min and max values
during the binary search.
2023-12-18 Alexei Podtelezhnikov <apodtele@gmail.com>
[ci] Add support for MSBuild on Windows.
This adds msbuild job for VS2019 (x64).
* .gitlab-ci.yml: Added "windows msbuild vs2019 amd64".
2023-12-14 Skef Iterum <github@skef.org>
[CFF] Extract `BlueValues` as `Fixed` rather than `Int`.
This is a follow-up to commit 26a7f047,
[cff] Make blend operator work with floats in private dicts.
which addressed the 'party baseline' bug. However, the reporting user
indicated that the default location and some other points in design space
rendered OK, but other points in design space still had problems. The most
obvious issue being that the x-heights of lower-case letters did not align;
see
https://github.com/adobe-fonts/source-serif/issues/121#issuecomment-1773794136
After some analysis we determined that this was due to an interaction
between `BlueValue` rounding and the zone-based algorithm. In short, for a
point to be considered in a zone it must fall within the bounds of the zone.
(There is a slop factor in some cases, but only a very small one.) In the
Adobe-contributed side of the code, point values are not integer-rounded,
instead they're kept as (some form of) fixed. Rounding just the `BlueValues`
means that points that need to be considered within a zone will fall outside
of it at some points in design space.
The majority of this patch changes the storage and parsing of `BlueValues`
to keep them as `FT_Fixed`. No significant code changes were needed because
the values are converted to `Fixed` anyway when stored in `CF_BlueRec`. No
attempt was made to address problems in the older pshinter code beyond
converting the values from `FT_Fixed` to `FT_Short` when copying the private
dictionary. (However, as the point values are also rounded in that code,
the problem is much less likely to occur, although inconsistency between
rounding and truncation could cause an analogous problem.)
* include/freetype/internal/cfftypes.h (CFF_PrivateRec): Use `FT_Fixed` for
`blue_values`, `other_blues`, `family_blues`, and `family_other_blues`.
* src/cff/cffload.c (cff_blend_doBlend): Updated.
* src/cff/cffobjs.c (CFF_fixedToInt): New macro.
(cff_make_private_dict): Use it.
* src/cff/cffparse.h (cff_kind_delta_fixed): New enum value.
* src/cff/cffparse.c (do_fixed): Updated.
(CFF_FIELD_DELTA, CFF_FIELD_DELTA_FIXED, CFF_DELTA_KIND): New set of macros,
replacing `CFF_FIELD_DELTA`.
(cff_parser_run): Updated to handle fixed-float deltas.
* src/cff/cfftoken.h: Updated to use `CFF_FIELD_DELTA_FIXED` for blue
values.
* src/psaux/psblues.c (cf2_blueToFixed): Removed, no longer needed.
(cf2_blues_init): Updated.
* src/pxaux/psft.c, src/pxaux/psft.h (cf2_getBlueValues, cf2_getOtherBlues,
cf2_getFamilyBlues, cf2_getFamilyOtherBlues): Updated signatures.
* src/psaux/psobjs.c (t1_make_subfont): Updated.
2023-12-14 Skef Iterum <github@skef.org>
[psaux] Improve tracing.
* src/psaux/psintrp.c (cf2_doBlend, cf2_interpT2CharString [cf2_cmdBLEND]):
Show blended values.
2023-12-14 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
* vms_make.com: Switch to `clang`.
Also add proper bzip2 support.
2023-12-14 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgxvar.c (ft_var_to_normalized): Fix undefined left-shift.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63723
2023-12-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[msbuild] Streamline the process.
MSBuild.exe can now be fired from the root folder without options.
* builds/windows/vc2010/freetype.sln: Relocated to...
* MSBuild.sln: ... here with minor changes.
* MSBuild.rsp: New file with command line options.
* docs/INSTALL: Reference `MSBuild.sln`.
2023-12-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Draw_Sweep): Swap stub conditions.
2023-12-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftmisc.h (FT_MulDiv): Remove unused copy.
2023-11-28 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Speed up Bézier arches with extrema.
While it is recommended to have an explicit point at each curve
extrema, they might be missing or outline could be rotated. This
leads to excessive bisections in raster to find them. This change
helps to decrease the number of bisections. The scanline
intersections remain monotonous, of course.
* src/raster/ftraster.c (Conic_To, Cubic_To): Check that control
points cross the scanlines to bisect.
2023-11-25 Alexei Podtelezhnikov <apodtele@gmail.com>
* docs/*: Typos.
2023-11-24 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Eliminate intensive flow checking.
* src/raster/ftraster.c (Draw_Sweep): Pass the flow increment.
(Increment): Accept the flow increment.
2023-11-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c: Comments, defines, includes, cleanups.
2023-11-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (FT_Outline_Get_CBox ) [STANDALONE_]: Removed.
2023-11-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Draw_Sweep): No-fault return.
(Render_Single_Pass): Updated.
2023-11-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Sweep polishing.
* src/raster/ftraster.c (*_Sweep_Span): Polish.
(*_Sweep_Drop): Restore tracing, polish.
(Draw_Sweep): Simplify the dropout processing loop.
2023-11-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Rearrange dropout control.
This reduces the code duplication.
* src/raster/ftraster.c (Function_Sweep_Span): Change signature.
(Vertical_Sweep_Drop, Horizontal_Sweep_Drop): Focus on pixel setting
and move duplicated the dropout control logic to...
(Draw_Sweep): ... this function and refactor.
(Vertical_Sweep_Span, Horizontal_Sweep_Span): Minor.
2023-11-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Use bitwise dropout mode interpretation.
* src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Draw_Sweep, Render_GLyph): Interpret dropout mode using bit masks.
2023-11-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* docs/CHANGES: Updated.
2023-11-16 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Keep only bottom y-turns.
This results in noticeable performance improvement.
* src/raster/ftraster.c (Insert_Y_Turns): All bottom y-turns are still
sorted and stored; only the maximum top y-turn is recorded now. The
function is renamed.
(End_Profile): Updated accordingly.
(Convert_Glyph): Reserve space for the top value.
2023-11-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (End_Profile): Reduce branching.
(InsNew): Tweak condition.
2023-11-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Draw_Sweep): Use more natural loop.
2023-11-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Dissolve a loop.
* src/raster/ftraster.c (End_Profile): Set initial `X` here...
(Draw_Sweep): ... instead of here; delay the `start` decrement.
2023-11-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c: Comments.
2023-11-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Stylistic changes.
* src/raster/ftraster.c (Line_To): Code it similar to curves;
shortcut the flat lines here...
(Line_Up): ... instead of here.
2023-11-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Revise overshoot setting.
* src/raster/ftraster.c (New_Profile, End_Profile): Deal with overshoots
locally.
(Line_To, Conic_To, Cubic_To): Update callers.
2023-11-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Conic_To, Cubic_To): Fix recent regression.
2023-11-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/ftimage.h: Fix type and link.
2023-11-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Increment): Minor tweak.
2023-11-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Get rid of the fresh flag.
* src/raster/ftraster.c (black_TWorker): Remove the fresh flag.
(New_Profile): Set the starting scanline here based on the current
coordinate and initialize the joint crossing if necessary.
(Line_Up, Bezier_Up): Do not deal with fresh and joint starts at all.
(Line_Down, Bezier_Down): Simplify.
(Conic_To, Cubic_To): Update the current coordinate after each
subsection.
2023-11-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Get rid of the joint flag.
* src/raster/ftraster.c (Line_Up, Bezier_Up): Deal with the scanline
joints directly based on the initial y-coordinate.
(New_Profile, black_TWorker): Remove the boolean flag.
2023-11-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Line_Up, Bezier_Up): Check "between" earlier.
2023-11-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Line_Up): Updated and fixed up.
This largely synchronizes the entries into `Line_Up` and `Bezier_Up`.
Minor bugs in the remainder calculations and accumulations are fixed.
2023-11-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (End_Profile, Convert_Glyph): Clean up.
2023-11-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Bezier_Up): Improve joint and loop.
2023-11-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Harmonize target bitmap navigation.
* src/raster/ftraster.c (black_TWorker): Store signed maximum indexes
in both directions instead of unsigned dimensions of the original bitmap.
(*_Sweep_*, Render_Glyph, ft_black_render): Updated all users.
2023-11-06 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Bezier_Up): Improve flow.
2023-11-06 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Reshuffle code for readability.
* src/raster/ftraster.c (Render_Glyph): Setup the rendering pool here.
(ft_black_render): Setup the target bitmap helpers here.
2023-11-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Improve profile accounting during sweeping.
* src/raster/ftraster.c (TProfile): Get rid of `countL`.
(Draw_Sweep): Use `start` for countdown to activation.
(Horizontal_Sweep_Drop, Vertical_Sweep_Drop): Rely on `height` and
`offset` to verify profile ends for the stub detection.
2023-11-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Consolidate profile increment to the next line.
* src/raster/ftraster.c (s/Sort/Increment): Rename this function to
reflect its true purpose, delete exhausted profiles here...
(Draw_Sweep): ... instead of here.
2023-11-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Instantly remove profiles from linked lists.
* src/raster/ftraster.c (DelOld): Remove loopy function.
(Draw_Sweep): Implement instant profile removal.
2023-11-03 Alexei Podtelezhnikov (Алексей Подтележников) <apodtele@gmail.com>
[raster] Modify the split condition.
While curving close to a pixel center, vertical and horizontal pass
might split the curve differently and cause a rare dropout. This
makes the split condition invariant of the sweep direction and more
robust.
* src/raster/ftraster.c (Bezier_Up): Modify the split condition.
2023-11-03 Alexei Podtelezhnikov (Алексей Подтележников) <apodtele@gmail.com>
[raster] Remove the jitter exception.
The jitter exception used to be applied when two neighboring pixels
were barely inside the outline. One the left one was turned on then,
which contradicts the OpenType specifications. Intended to remove
glitches, it caused disappearing lines and was softened by adding an
exception to the exception (#54589).
* src/raster/ftraster.c (Vertical_Sweep_Span): Drop the jitter exception.
2023-10-31 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Simplify dropout detection.
* src/raster/ftrater.c (Draw_Sweep): Use a single dropout condition.
2023-10-31 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Simplify sweeping entry and exit.
* src/raster/ftraster.c (Draw_Sweep): Use y-turns to set the range,
correctly set the initial position, directly loop through y_turns,
and remove a 5-gray remnant at exit.
2023-10-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Switch to routine Int instead of Short.
This is mostly cosmetic and removes a few casts, plus Short is
promoted to Int in calculations anyway.
* src/raster/ftraster.c (Vertical_Sweep_Init, Vertical_Sweep_Span,
Vertical_Sweep_Drop, Horizontal_Sweep_Init, Horizontal_Sweep_Span,
Horizontal_Sweep_Drop, Draw_Sweep): Mostly s/Short/Int/ and remove
casting.
2023-10-24 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Increase the raster pool density.
This only helps to delay the pool overflow and bisections to larger
sizes and benefits only very intricate glyphs at reasonable sizes.
* src/raster/ftraster.c (TProfile): Use Int instead of Long or PLong
when it is sufficient.
(New_Profile, End_Profuile, Bezier_Up, Sort): Updated accordingly.
2023-10-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Slightly improve the pool design.
* src/raster/ftraster.c (TProfile): Include the variable array member
and repackage with pointers first.
(New_Profile): Advance the top using the variable array pointer.
2023-10-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Clean up sweeping.
* src/raster/ftraster.c (Draw_Sweep): Zero initialize the working
lists directly and remove unnecessary y-turn checks.
(Init_Linked): Removed.
2023-10-22 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Insert_Y_Turn): Improve flow.
2023-10-22 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pcf/pcfutil.c (BSWAP16): Limit clang support.
These ancient builtins have been supported by clang since 2013. We
condition it somewhat stricter but still around 2017. This is more
portable than `__has_builtin`. Fixes #1260.
2023-10-19 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Small optimizations.
* src/raster/ftraster.c (New_Profile): Set important fields only and
delay setting `gProfile` until...
(End_Profile): ... it is checked to be valid here.
(Convert_Glyph): Updated.
2023-10-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Convert_Glyph): Remove redundant check.
2023-10-18 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Fix linked profiles in contour loops.
This fixes a subtle bug when the last profile in a contour was not
properly short-circuited if it was still empty at `End_Profile`.
We finalize all linking in `Finalize_Profile_List` now and do nothing
else there. The turns are added in `End_Profile`.
* src/raster/ftraster.c (Insert_Y_Turn): Moved up unchanged.
(End_Profile): Take care of turns but set only preliminary linking.
(Finalize_Profile_Table): Take care of linking and null-termination.
(Convert_Glyph): Adjusted accordingly.
2023-10-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c: Improve tracing.
2023-10-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Improve profile accounting.
* src/raster/ftraster.c (End_Profile): Do not initiate next profile.
(New_Profile): Fully initiate new profile.
(Convert_Glyph): Clean up variables, initialize `fProfile` here.
2023-10-13 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Convert_Glyph): Fix null-dereference.
2023-10-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Fix pool overflow checking.
* src/raster/ftraster.c (New_Profile, End_Profile): Check for overflow
immediately.
(Convert_Glyph, Render_Single_Pass): Fix boundaries.
2023-10-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Miscellaneous clean-ups.
* src/raster/ftraster.c (New_Profile): Use NULL.
(End_Profile): Optimize variables.
(Convert_Glyph): Do not initialize `cProfile` yet.
(Render_Single_Pass): Tracing.
2023-10-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c: Move the sweep functions...
... out of the setjmp/longjmp scope for readability.
2023-10-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c: Tracing updates.
2023-10-09 Zachary Zollman <zacharyzollman@pm.me>
fix typo in FT_Outline_Decompose note
2023-09-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (gray_render_conic) [SSE2]: Improve flow.
2023-09-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/gxvalid/gxvcommn.h (GXV_USHORT_TO_SHORT): Removed.
2023-09-25 Alexei Podtelezhnikov <apodtele@gmail.com>
Comment typos.
2023-09-25 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftcalc.c (FT_MOVE_SIGN): Enclose assignments.
2023-09-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/internal/ftcalc.h (FT_MSB): Define for Solaris 11.
2023-09-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[psaux] Use `FT_SqrtFixed`.
* src/psaux/cffdecode.c <cff_op_sqrt>: Call `FT_SqrtFixed`.
* src/psaux/psintrp.c <cf2_escSQRT>: Ditto.
2023-09-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Reintroduce `FT_SqrtFixed`.
The general square root calculations are not necessary in FreeType.
For vector normalization or length, FreeType uses special functions.
It is, however, required in the legacy CFF specifications.
* src/base/ftcalc.c (FT_SqrtFixed): New function that uses either
Babylonian or bit-wise algorithm, whichever is faster for the given
situation.
* include/freetype/internal/ftcalc.h (FT_SqrtFixed): Declare it.
2023-09-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftcalc.c /* FT_SqrtFixed */: Fix defunct overflow.
2023-09-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/tools/apinames.c (read_header_file): Typos.
2023-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
Update 2 files
- /src/base/ftcalc.c
- /include/freetype/internal/ftcalc.h
2023-09-13 Ben Wagner <bungeman@chromium.org>
[base] Fix typo to correct predicate for call
* src/base/ftobj.c (FT_Get_Color_Glyph_Paint): check
`get_colr_glyph_paint` before calling `get_colr_glyph_paint` and not
`get_colr_layer`
2023-09-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/psaux/cffdecode.c (cff_op_sqrt): Correct upper limit.
2023-09-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/psaux/cffdecode.c (cff_op_sqrt): Improve initial guess.
2023-09-11 Alexei Podtelezhnikov <apodtele@gmail.com>
src/psaux/psintrp.c (cf2_escSQRT): Improve initial guess.
The worst number of iterations decreased from 11 to 5.
2023-09-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/type1/t1afm.c (t1_get_index): Restore `strlen` call.
This reverts commit 8ed6d97446f2f3e5523da62eefbbf32ef7c1290e
and fixes
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62246
2023-09-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffparse.c (CFF_Field_Handler): Some s/0/NULL/.
2023-09-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[type1, cid, type42] Post-cleanup.
* include/freetype/internal/psaux.h (T1_FIELD_ZERO): Terminating macro.
* src/cid/cidload.c (cid_parse_dict): Use while-loop.
* src/type1/t1load.c (parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_dict): Ditto.
2023-09-09 Alexei Podtelezhnikov <apodtele@gmail.com>
Update forgotten array termini.
* src/cid/cidload.c (cid_field_records): Account for added `len`.
* src/type1/t1load.c (t1_keywords): Ditto.
* src/type42/t42parse.c (t42_keywords): Ditto.
2023-09-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[type1, cid, type42] Streamline dictionary parsing.
When matching the keywords, we avoid calculating their lengths by
checking the stored values. This itself is a sufficient pre-check
before diving into `memcmp`. Therefore, we remove explicit check of
the first characters.
* include/freetype/internal/psaux.h (T1_FieldRec): Store length.
* src/cid/cidload.c (cid_parse_dict): Use `memcmp` and stored length.
* src/type1/t1load.c (parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_dict): Ditto.
2023-09-09 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/type1/t1afm.c (t1_get_index): Avoid `strlen` call.
Instead, we check the terminal zero.
2023-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/type1/t1driver.c (t1_ps_get_font_value): Avoid redundant null.
2023-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff, truetype] Improve prefix and suffix removal.
* src/cff/cffobjs.c (remove_style): Rewrite using pointers.
(remove_subset_prefix): Unwrap loop and use `memmove`.
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag): Unwrap loop
and avoid `strlen`.
2023-09-07 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttpost.c (load_format_20): Micro-optimize.
2023-09-05 Werner Lemberg <wl@gnu.org>
[autofit] Fix synchronization mistake between FreeType and ttfautohint.
Found by Behdad.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Fix array size of
`blue_sorted`: FreeType doesn't have artificial blue zones.
2023-09-04 Werner Lemberg <wl@gnu.org>
[autofit] Fix typos.
This also reduces the used heap size by a large factor.
From Behdad.
* src/autofit/afcjk.h (AF_CJKAxisRec): Use `AF_BLUE_STRINGSET_MAX_LEN`.
* src/autofit/aflatin.h (AF_LatinAxisRec): Ditto.
2023-08-31 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttpost.c (load_format_20): Rework tracing.
2023-08-30 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds] Abbreviate the DLG submodule update.
* autogen.sh, builds/toplevel.mk: Revise the command options.
2023-08-29 Alexei Podtelezhnikov <apodtele@gmail.com>
Comment added.
2023-08-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttpost.c (load_format_20): Permit long names.
Fixes #1254.
2023-08-27 Werner Lemberg <wl@gnu.org>
[gzip] Update sources to zlib 1.13.
2023-08-25 Werner Lemberg <wl@gnu.org>
docs/release: Minor fixes.
2023-08-25 Anurag Thakur <anuthadev@gmail.com>
docs/freetype-web.txt: New file.
2023-08-25 Werner Lemberg <wl@gnu.org>
* Version 2.13.2 released.
==========================
Tag sources with `VER-2-13-2'.
* docs/VERSION.TXT: Add entry for version 2.13.2.
* docs/CHANGES: Updated.
* docs/release, docs/README, builds/macs/README: Updated.
* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.13.1/2.13.2/, s/2131/2132/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 2.
* builds/unix/configure.raw (version_info): Set to 26:1:20.
* CMakeLists.txt (VERSION_PATCH): Set to 2.
2023-08-25 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftcalc.c (FT_MulAddFix): Simplify 32-bit rounding.
2023-08-25 Werner Lemberg <wl@gnu.org>
Fix clang warnings.
* src/cffload.c (cff_blend_doBlend): Fix type of `sum`.
* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Fix type of
`word_delta_count`.
2023-08-24 Werner Lemberg <wl@gnu.org>
* subprojects/*.wrap: Updated.
2023-08-24 Hugh McMaster <hugh.mcmaster@outlook.com>
builds/unix/configure.raw: Use variable to specify minimum Python version.
2023-08-24 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/toplevel.mk: Simplify version extraction.
2023-08-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Improve the matrix degeneracy check.
Also fixes #1251.
* src/base/ftcalc.c (FT_Matrix_Check): To avoid overflow, scale by shifting.
* include/freetype/internal/ftcalc.h (FT_Matrix_Check): Update description.
2023-08-22 Werner Lemberg <wl@gnu.org>
builds/toplevel.mk: Don't use `\#` in functions.
The behaviour changed in GNU make 4.3, where `#` (without the backslash)
would be necessary. Using a variable instead the code works with both older
and newer GNU make versions.
Fixes #1252.
2023-08-19 Hugh McMaster <hugh.mcmaster@outlook.com>
builds/freetype.mk: Invoke `mkdocs` as a Python module
FreeType's `refdoc` target currently allows users to override the
default Python path, which is useful for testing and development.
In contrast, `mkdocs` is invoked via the default Python path.
Invoking `mkdocs` via Python's module syntax allows for greater
flexibility, although there is no change for the default use case.
2023-08-17 Ben Wagner <bungeman@chromium.org>
[base] Avoid UB with memcpy
`FT_NEW_ARRAY(p, 0)` sets `p` to `NULL`. `FT_Stream_ReadAt` with a
memory based stream uses `FT_MEM_COPY` which is `memcpy` which specifies
that it is undefined behavior for either the `src` or `dst` to be
`NULL`. Instead of forcing all callers work around calling
`FT_Stream_Read` when `buffer == NULL && count == 0` do the check in
`FT_StreamRead`. This allows any call with `count == 0` to succesfully
read zero bytes without UB.
* src/base/ftstream.c (FT_Stream_ReadAt): skip `FT_MEM_COPY` when
`count == 0`. (FT_Stream_TryRead): ditto
Fixes: #1250
2023-08-12 Werner Lemberg <wl@gnu.org>
Fix warnings in tracing messages for 32bit compilation.
Since we now require C99, use `%td` for `ptrdiff_t` and `%zu` for `size_t`.
2023-08-04 Ben Wagner <bungeman@chromium.org>
Avoid overflow in COLR bounds checks.
The values read into `base_glyphs_offset_v1` and `layer_offset_v1` may
be in the range 0xFFFFFFFD-0xFFFFFFFF. On systems where `unsigned long`
is 32 bits adding 4 to such values will wrap and pass bounds checks but
accessing values at such offsets will be out of bounds.
On the other hand `table_size` has already been tested to be at least
`COLRV1_HEADER_SIZE` (34) so it is safe to subtract 4 from it.
* src/sfnt/ttcolr.c (tt_face_load_colr): subtract 4 from `table_size`
instead of adding 4 to font data offsets in bounds checks
Fixes: https://crbug.com/1469348
2023-08-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftobjs.c (open_face_from_buffer): Silence `maybe-uninitialized`.
We never call this function without a `driver_name` (#1245).
2023-07-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Reduce v40 footprint.
* src/truetype/ttgload.c (TT_HInt_Glyph, tt_loader_set_pp,
tt_loader_init): Refactor code.
2023-07-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Remove Infinality for good (remaining bits).
* src/truetype/ttobjs.h: Remove remaining fields.
* src/truetype/ttinterp.c: Do not initialize them.
* include/freetype/internal/tttypes.h: Remove descriptions.
2023-07-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Remove Infinality for good.
Remove everything `#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY`,
which was undefined for a while now.
* include/freetype/internal/tttypes.h: Ditto.
* src/truetype/truetype.c: Ditto.
* src/truetype/ttdriver.c: Ditto.
* src/truetype/ttgload.c: Ditto.
* src/truetype/ttinterp.c: Ditto.
* src/truetype/ttinterp.h: Ditto.
* src/truetype/ttobjs.c: Ditto.
* src/truetype/ttsubpix.[ch]: Remove files.
* src/truetype/rules.mk: Don't mention "ttsubpix.c".
2023-07-21 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
* vms_make.com: Provide separate library compiled with C++.
Some types on OpenVMS x86_64 (for example, `long') have different sizes
depending on whether compiled with either C or C++. In particular,
X-Windows applications crash if linked with the C++ version.
This patch makes `vms_make.com` create a second version of the FreeType
library compiled with C++ if OpenVMS is running on the x86_64 platform.
2023-07-21 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
* vms_make.com: Fix typos.
2023-07-21 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
* src/smooth/ftgrays.c (FT_SSE2): Fix definition for VMS.
2023-07-19 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
vms_make.com: Make use of additional libraries optional.
Check whether `.olb` files are present.
Also check for the HarfBuzz library.
2023-07-19 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
vms_make.com: Add `/warn=noinfo` to `CFLAGS`.
This reduces enormously the informationals while compiling on x86_64 (i.e.,
which `.h` file is inluded form where).
2023-07-18 Ben Wagner <bungeman@chromium.org>
[woff2] Clean up on large brotli expansion
* src/sfnt/sfwoff2.c (woff2_open_font): set error and goto cleanup
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60711
2023-07-16 Werner Lemberg <wl@gnu.org>
[woff2] Avoid allocation bomb.
This is a fix for commit 85167dbd5, reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60615
* src/sfnt/sfwoff2.c (MAX_SFNT_SIZE): New macro.
(woff2_open_font): Use it to limit the maximum size of an uncompressed WOFF2
font.
2023-07-14 Werner Lemberg <wl@gnu.org>
[cff] Fix compiler warning.
* src/cff/cffparse.c, src/cff/cffparse.h: Make `cff_parse_fixed` a local
function.
2023-07-14 Ben Wagner <bungeman@chromium.org>
[woff2] Remove sfnt size guess check
In WOFF the `totalSfntSize` must be correct, however in WOFF2 this value
is now just a hint and a conforming implementation must not reject
otherwise valid data if the `totalSfntSize` turns out not to be exact.
* src/sfnt/sfwoff2.c (woff2_open_font): remove check that uncompressed
woff2 data would fit in the sfnt size guess.
Fixes: #1235
2023-07-14 Skef Iterum <github@skef.org>
[cff] Make blend operator work with floats in private dicts.
The CFF2 blend operator takes N default values and corresponding
sets of deltas and pushes N values specific to a designspace
location. CFF has a floating point numeric type and the FreeType
blending code was not converting those into its internal 16.16
Fixed type format.
Fixes #1243.
* src/cff/cffparse.c (do_fixed): Handle floating point numbers.
Also fix scaling overflow check for integer-to-fixed conversion.
* src/cff/cffload.c (cff_blend_doBlend): Updated.
2023-07-08 Hin-Tak Leung <htl10@users.sourceforge.net>
* src/truetype/ttgload.c (TT_Hint_Glyph): More mostly cosmetic update.
This is a follow-up to commit 49c74ac02, which creates a new local variable
"exec = loader->exec", and shortening a lot of "loader->exec". This commit
does two more such changes missed in that first commit.
2023-07-06 Hugh McMaster <hugh.mcmaster@outlook.com>
[gzip] Don't compile internal zlib development files when using system zlib.
`src/gzip/rules.mk` compiles the internal zlib sources even when using the
zlib development files provided by a host system. If the internal zlib
development files are not present, FreeType fails to build from source.
This patch ensures the internal zlib development files are only
prerequisites when not using zlib development files on a host system.
* src/gzip/rules.mk (GZIP_DRV_SRCS): Define conditionally.
2023-06-24 Werner Lemberg <wl@gnu.org>
* Version 2.13.1 released.
==========================
Tag sources with `VER-2-13-1'.
* docs/VERSION.TXT: Add entry for version 2.13.1.
* docs/CHANGES: Updated.
* docs/release, docs/README, builds/macs/README: Updated.
* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.13.0/2.13/1/, s/2130/2131/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.
* builds/unix/configure.raw (version_info): Set to 26:0:20.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
* subprojects/libpng.wrap, subprojects/zlib.wrap, subprojects/dlg: Updated.
2023-06-09 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Comment fixes.
2023-06-09 Werner Lemberg <wl@gnu.org>
[sdf] Correct handling of empty glyphs.
This is a refinement of commit 7b3ebb9.
* src/sdf/ftsdfrend.c (ft_sdf_render): Goto 'Exit' instead of directly
returning.
(fd_bsdf_render): Ditto, also taking care of setting `FT_GLYPH_OWN_BITMAP`
correctly.
2023-06-05 Ben Wagner <bungeman@chromium.org>
Mark FT_Renderer_Class::raster_class as pointer to const
The `FT_DEFINE_RASTER_FUNCS` macro declares a `const FT_Raster_Funcs`.
The address of the definition is taken and assigned to
`FT_Renderer_Class::raster_class` which is currently `FT_Raster_Funcs*`.
Until recently the `const` was cast away and with the removal of the
cast there are now warnings about dropping this `const`. Instead of
adding back the casts, make `FT_Renderer_Class::raster_class` a pointer
to const, as is done with pointers in other interfaces.
* include/freetype/ftrender.h (FT_Renderer_Class_): mark `raster_class`
as const.
2023-06-03 Ben Wagner <bungeman@chromium.org>
Fix some `FT_Fixed` vs. `FT_Long` confusion.
`FT_Fixed` and `FT_Long` are both typedef'ed to be `signed long`. However,
`FT_Fixed` implies that the lower 16 bits are being used to express
fractional values and so these two types should not be confused.
* include/freetype/internal/services/svmm.h (FT_Set_MM_Blend_Func): Use
`FT_Fixed` for `coords`. Users are passing `FT_Fixed` and implementations
are taking `FT_Fixed`.
(FT_Get_MM_Blend_Func): Ditto.
* src/autofit/afcjk.c (af_cjk_metrics_check_digits): Use `FT_Long` for
`advance` and `old_advance`. `advance`'s address is passed as `FT_Long*` to
`af_shaper_get_elem`, which writes the advance in em units (not fixed). The
exact value is not important here as it is only compared to check whether it
has changed.
* src/autofit/aflatin.c (af_latin_metrics_check_digits): Ditto.
2023-06-03 Ben Wagner <bungeman@chromium.org>
*/*: Remove many function pointer casts.
In C it is undefined behavior to call a function through a function pointer
of a different type. This is now detected by the Control Flow Integrity
Sanitizer. All known issues have already been fixed. Prevent any
accidental re-introduction by removing function pointer casts when defining
services. The services will call the service functions through the function
pointers on the service. As a result the functions must have the same type
so there should be no need to cast. Removing the casts allows compilers to
warn about assignment to an incompatible function pointer type.
2023-06-03 Werner Lemberg <wl@gnu.org>
Minor formatting.
2023-05-23 Werner Lemberg <wl@gnu.org>
Replace `sprintf` with `snprintf`.
Fixes #1233.
* include/freetype/config/ftstdlib.h (ft_sprintf): Replace with...
(ft_snprintf): This new macro.
* src/autofit/afhints.c (af_print_idx): Add argument to pass the buffer
size.
(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges): Updated.
* src/bdf/bdflib.c (BUFSIZE): New macro.
(bdf_parse_properties_, bdf_parse_start_): Use `ft_snprintf`.
* src/tools/ftrandom/ftrandom.c (do_test): Use `snprintf`.
2023-05-23 Werner Lemberg <wl@gnu.org>
docs/DEBUG: Formatting.
2023-05-20 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[doc] Type1 GX (sfnt-wrapped Type1) is not supported.
* docs/formats.txt: Clarify the reference of Type1 GX,
and state that this format is not supported. This
is because the content `TYP1' table is not exactly same
with the Type1 font format specification; no eexec
encryption is used. For detail and concrete examples,
see the analysis on:
https://gitlab.freedesktop.org/freetype/freetype/-/issues/1231
2023-05-19 Craig White <gerzytet@gmail.com>
Add missing end quote of a string in the example code of FT_Trace_Set_Level
2023-05-19 Seigo Nonaka <nona@google.com>
[truetype] Reduce heap allocation of `deltaSet` variation data.
`deltaSet` is an array of packed integers that can be 32 bits, 16 bits, or
8 bits. Before this change, these values were unpacked to 32-bit integers.
However, this can cause big heap allocations, e.g., around 500 KByte for
'NotoSansCJK'. To reduce this amount, store the packed integers and unpack
them just before passing to the calculation. At calculation time, due to
the variable length of region indices, temporary heap allocations are
necessary. This heap allocation is not negligible and visible in `ftbench`
results. So, use stack-allocated arrays for short array calculations.
Fixes #1230.
* include/freetype/internal/ftmmtypes.h (GX_ItemVarDataRec): New fields
`wordDeltaCount` and `longWords`.
* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Load packed
data.
(tt_var_get_item_delta): Unpack data before applying.
2023-05-17 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
vms_make.com: Create shared executable for x86 version of OpenVMS.
2023-05-15 Werner Lemberg <wl@gnu.org>
Add new load flag `FT_LOAD_NO_SVG`.
Modern color fonts often contain both an 'SVG' and 'COLR' table. FreeType
always preferred 'SVG' over 'COLR' (this was a design decision), however,
this might not be the right choice for the user. The new flags makes
FreeType ignore the 'SVG' table while loading a glyph.
Fixes #1229.
* include/freetype/freetype.h (FT_LOAD_NO_SVG): New macro.
* src/base/ftobjs.c (FT_Load_Glyph), src/cff/cffgload.c (cff_slot_load),
src/truetype/ttgload.c (TT_Load_Glyph): Use it.
2023-05-13 Werner Lemberg <wl@gnu.org>
.mailmap: Updated.
2023-05-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Merge functions.
* src/cache/ftccache.c (FTC_Cache_Init): Merge into...
(ftc_cache_done): ... this function, with unnecessary checks removed.
2023-05-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Minor casting and cosmetic updates.
* src/cache/ftcglyph.c (ftc_gcache_{init,done}): Remove casting.
(FTC_GCache_Lookup): Cosmetic variable renaming.
* src/cache/ftcsbits.c (ftc_snode_compare): Formatting.
2023-05-12 Werner Lemberg <wl@gnu.org>
* include/freetype/ftcache.h: Typo, punctuation.
2023-05-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/ftcache.h: Formatted and updated.
2023-05-12 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* include/freetype/internal/t1types.h: Fix the indentation.
2023-05-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Revise the dynamic hash table accounting.
Instead of counting entries relative to the middle of the hash table,
this switches to the absolute counter with the full index range mask.
As a result, some calculations become a bit simpler. The cache resizing
logic stays largely the same.
* src/cache/ftccache.h (FTC_NODE_TOP_FOR_HASH): Revised with new counter.
* src/cache/ftccache.c (ftc_get_top_node_for_hash): Ditto.
(ftc_cache_resize): Simplify reallocations and stop their zeroing.
(ftc_cache_init): Stop over-allocating but keep zeroing initially.
(FTC_Cache_Clear, FTC_Cache_RemoveFaceID): Updated accordingly.
2023-05-11 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[t1cid] Set FT_FACE_FLAG_CID_KEYED.
* cidobjs.c (cid_face_init): Set FT_FACE_FLAG_CID_KEYED.
* cidriver.c (cid_get_is_cid): Comment about the case that
is_cid cannot guarantee the glyph collection specification.
2023-05-09 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
* src/smooth/ftgrays.c (FT_SSE2): Don't define for VMS.
2023-05-08 Werner Lemberg <wl@gnu.org>
* src/cff/cffdrivr.c (cff_glyph_load): Fix guard for `size`.
This was forgotten to change in commit 2b54eba36b (in May 2004).
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58739
2023-05-08 Werner Lemberg <wl@gnu.org>
Minor compiler warning fixes.
* src/autofit/afcjk.c (af_cjk_get_standard_widths), src/autofit/aflatin.c
(af_latin_get_standard_widths): Use `FT_CALLBACK_DEF`.
* src/cff/cffparse.c (cff_parser_run): Initialize and fix allocation of `q`.
2023-05-08 Werner Lemberg <wl@gnu.org>
* src/psaux/t1cmap.c: Signature fixes.
2023-05-08 Werner Lemberg <wl@gnu.org>
* src/bzip2/ftbzip2.c: Signature fixes.
2023-05-08 Werner Lemberg <wl@gnu.org>
[cache] Signature fixes.
* src/cache/ftcglyph.c, src/cache/ftcglyph.h (FTC_GNode_Compare): Remove
redundant function. It is equivalent to `ftc_gnode_compare` and becomes
completely meaningless with fixed signatures.
Update all callers.
* src/cache/ftcsbits.c, src/cache/ftcsbits.h (FTC_SNode_Compare): Remove
redundant function. It is equivalent to `ftc_snode_compare` and becomes
completely meaningless with fixed signatures.
Update all callers.
2023-05-07 Werner Lemberg <wl@gnu.org>
[sdf] Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/svg/ftsvg.c: Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
[raster] Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
[smooth] Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
[pshinter] Signature fixes.
* src/pshinter/pshrec.c (t1_hints_close, t1_hints_apply): New wrapper
functions.
(t1_hints_funcs_init): Use them.
(t2_hints_close, t2_hints_apply): New wrapper functions.
(t2_hints_funcs_init): Use them.
2023-05-07 Werner Lemberg <wl@gnu.org>
[autofit] Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/sfnt/ttcmap: Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/pcf/pcfdrivr.c: Signature fix.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/winfonts/winfnt.c: Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/type42/t42parse.c: Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
[pfr] Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/cid/cidload.c: Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/cff/cffcmap.c: Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/type1/t1load.c: Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
[truetype] Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
[base] Signature fixes.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/type42/t42drivr.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/type1/*: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/truetype/*: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/sfnt/sfdriver.c, src/sfnt/ttbdf.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
* src/sfnt/sfdriver.c (sfnt_load_table): New wrapper function.
(sfnt_service_sfnt_table): Use it.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/psnames/psmodule.c: Use `FT_CALLBACK_DEF`.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/pfr/pfrdrivr.c: face -> pfrface, pfrface -> face.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/pcf/pcfdrivr.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/cid/cidriver.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/bdf/bdfdrivr.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 Werner Lemberg <wl@gnu.org>
* src/cff/*: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-06 Werner Lemberg <wl@gnu.org>
[truetype] Fix style name handling for variation fonts.
* include/freetype/internal/tttypes.h (TT_FaceRec): New field
`non_var_style_name`.
* src/sfnt/sfobjs.c (sfnt_load_face): Initialize `non_var_style_name`.
(sfnt_done_face): Free `non_var_style_name`.
* src/truetype/ttgxvar.c (TT_Set_Named_Instance): Restore non-VF style name
if switching back to non-VF mode.
2023-05-06 Werner Lemberg <wl@gnu.org>
[truetype] Fix PostScript name handling for variation fonts.
A variation font's PostScript name of a named instance is usually different
from the PostScript name of an unnamed instance. However, if a change
between a named instance and an unnamed instance with exactly the same
design axis values happened, it was possible that the PostScript name wasn't
correctly updated.
This commit reorganizes the code to handle this issue within the top-level
API functions, using a new service to trigger recomputation of the
PostScript name.
* include/freetype/internal/services/svmm.h (FT_Construct_PS_Name_Func): New
typedef.
(FT_Service_MultiMasters): New field `construct_ps_name`.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.
* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Call
`mm->construct_ps_name` to handle `postscript_name`.
(FT_Set_Named_Instance): Call `mm->construct_ps_name` to handle
`postscript_name`.
Use shortcut.
* src/cff/cffdrivr.c (cff_construct_ps_name): New function.
(cff_service_multi_masters): Updated.
* src/truetype/ttgxvar.c (tt_set_mm_blend): Don't handle `postscript_name`.
(TT_Set_MM_Blend): Simplify.
(TT_Set_Named_Instance): Return -1 if axis values haven't changed.
Don't set `face_index`.
(tt_construct_ps_name): New function.
* src/truetype/ttgxvar.h: Updated.
* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.
* src/type1/t1load.c (T1_Set_MM_Blend): Simplify.
2023-05-06 Werner Lemberg <wl@gnu.org>
* include/freetype/internal/services/svmm.h: Minor changes.
2023-05-06 Werner Lemberg <wl@gnu.org>
[truetype] Fix deactivation of variation font handling.
According to the documentation, the functions `FT_Set_Named_Instance`,
`FT_Set_MM_Design_Coordinates`, `FT_Set_Var_Design_Coordinates`, and
`FT_Set_Var_Blend_Coordinates` can unset the `FT_FACE_FLAG_VARIATION` flag.
(The same is true for `FT_Set_MM_WeightVector` but this information was
accidentally omitted from the documentation.)
However, if a call of these functions didn't change the axis values this
could fail because internal shortcuts exited too early.
This commit reorganizes the code to handle `FT_FACE_FLAG_VARIATION` in the
top-level API functions, also taking care of the issue at hand.
* src/base/ftmm.c (FT_Set_MM_Design_Coordinates, FT_Set_MM_WeightVector,
FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates,
FT_Set_Var_Blend_Coordinates): Handle `FT_FACE_FLAG_VARIATION`.
* src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design,
TT_Set_Named_Instance) Don't handle `FT_FACE_FLAG_VARIATION`.
* src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_WeightVector,
T1_Set_MM_Design): Ditto.
* src/cff/cffobjs.c (cff_face_init): Use `FT_Set_Named_Instance` instead of
low-level functions.
* src/truetype/ttobjs.c (tt_face_init): Ditto.
2023-05-06 Werner Lemberg <wl@gnu.org>
s/set_instance/set_named_instance/
* include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): Renamed
to...
(FT_Set_Named_Instance_Func): ...this.
(FT_Service_MultiMasters): Rename `set_instance` to `set_named_instance`.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.
* src/base/ftmm.c (FT_Set_Named_Instance): Updated.
* src/cff/cffdrivr.c (cff_set_instance): Renamed to...
(cff_set_named_instance): ...this.
(cff_service_multi_masters): Updated.
* src/cff/cffobjs.c (cff_face_init): Updated.
* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.
2023-05-06 Werner Lemberg <wl@gnu.org>
New Variation Font function `FT_Get_Default_Named_Instance`.
* include/freetype/ftmm.h, src/base/ftmm.c (FT_Get_Default_Named_Instance):
New function.
* include/freetype/internal/services/svmm.h
(FT_Get_Default_Named_Instance_Func): New typedef.
(FT_Service_MultiMasters): New field `get_default_named_instance`.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.
* include/freetype/internal/tttypes.h (TT_Face): New field
`var_default_named_instance`.
* src/sfnt/sfobjc.s (sfnt_init_face): Initialize
`var_default_named_instance`.
* src/cff/cffdrivr.c (cff_get_default_named_instance): New function.
(cff_service_multi_masters): Updated.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Initialize
`var_default_named_instance`.
(TT_Get_Default_Named_Instance): New function.
* src/truetype/ttgxvar.h: Updated.
* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.
* docs/CHANGES: Updated.
2023-05-06 Werner Lemberg <wl@gnu.org>
[cid] Improve tracing messages; formatting.
2023-05-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftccache.c (ftc_node_hash_unlink): Minor.
2023-05-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcmru.c (FTC_MruList_RemoveSelection): Purge backwards.
2023-05-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Revise list cleansing.
* src/cache/ftcmru.c (FTC_MruList_RemoveSelection): Use one loop to
do it.
* src/cache/ftcmanag.c (FTC_Manager_Compress, FTC_Manager_FlushN):
Streamline loops.
2023-05-03 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[t1cid] Improve cid_get_cid_from_glyph_index().
Update cid_get_cid_from_glyph_index() to
return an error and CID=0 in the case that
the specified glyph index points to an invalid
entry.
cidgload.h (cid_compute_fd_and_offsets):
Declare new helper function to set the
fd_select and 2 offsets to access the glyph
description data.
cidgload.c (cid_compute_fd_and_offsets):
Move the part loading fd_select and 2 offsets
from cid_load_glyph() to here. If the loaded
parameters are broken, return the Invalid_Offset
error. This function does not load the glyph
data, only fills these parameters.
(cid_load_glyph): Use new helper function in above.
cidriver.c (cid_get_cid_from_glyph_index):
Check whether the requested glyph index points
to a valid entry, by calling cid_compute_fd_and_offsets().
If it is valid, fill the cid by the glyph
index (=CID). If it is invalid, return an
error and fill the cid by 0.
2023-04-30 Werner Lemberg <wl@gnu.org>
API documentation: Re-organize chapters and sections
* Split the very long 'Base Interface' section into smaller sections.
* Split the 'Core API' chapter into two chapters.
* Remove single enumeration values from `@order` fields since they have no
effect.
2023-04-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/pngshim.c (Load_SBit_Png): Remove FALL_THROUGH warning.
2023-04-28 Werner Lemberg <wl@gnu.org>
* src/sfnt/ttload.c (tt_face_load_font_dir): Add another guard.
Reject 'OTTO' fonts with no valid tables.
2023-04-28 Werner Lemberg <wl@gnu.org>
* src/cff/cffdrivr/c (cff_get_ps_name): Avoid unnecessary crash.
The situation can happen if `FT_New_Face` (or one of its siblings) is called
with a negative index to get the number of contained faces, followed
immediately by a call to `FT_Get_Postscript_Name`. While this is not a valid
use of the FreeType library there is no need for a crash.
Fixes #1219.
2023-04-28 Werner Lemberg <wl@gnu.org>
* src/cff/cffdrivr.c (cff_ps_get_font_info): Reject 'CFF2' format.
2023-04-28 Werner Lemberg <wl@gnu.org>
* src/cid/cidgload.c (cid_load_glyph): Fix compiler warnings.
2023-04-28 Werner Lemberg <wl@gnu.org>
Minor documentation updates.
2023-04-27 Werner Lemberg <wl@gnu.org>
* src/ttgxvar.c: Minor changes.
(TT_Get_MM_Var): Improve tracing messages.
(tt_set_mm_blend): Minor speed-up.
2023-04-27 Werner Lemberg <wl@gnu.org>
s/this is,/that is,/
2023-04-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Clean up the atom property parsing.
* src/bdflib.c (bdf_is_atom_): Refactor code with fewer checks.
(bdf_list_join_): Return NULL.
(bdf_add_comment_): Use const argument.
(bdf_get_property): Ditto, ditto, make the function static.
* src/bdf.h (bdf_get_property): Remove prototype.
2023-04-25 Werner Lemberg <wl@gnu.org>
Improve/add source comments and documentation.
2023-04-25 Werner Lemberg <wl@gnu.org>
[sfnt] Fix handling of PS names for Variation Fonts.
* src/sfnt/sfdriver.c (get_win_string, get_apple_string): Continue
construction of string if an invalid character is encountered.
Fixes #1218.
2023-04-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[t1cid] Change the trace messages of the charstrings retrieval errors.
The t1cid driver catches 3 types of errors in
the charstrings retrieval;
A) The invalid FD number, there are 2 subtypes;
A-1) FD number is the maximum number fitting to FDBytes.
A-2) FD number is greater than num_dicts.
B) Declared length is overrunning.
C) Declared length is invalid (its end is before its head).
Considering that some widely distributed fonts
(e.g., "CJKV" book by O'Reilly) have A-1 errors
in the unimplemented glyphs, the trace level for
A-1 is calmed to level 1.
The errors A-2, B, and C would be irregular;
their trace levels are kept at level 0, but
the updated trace messages include the CID number.
2023-04-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Fix `make multi'.
* src/truetype/ttgxvar.c: Include freetype/internal/services/svmetric.h
for the FT_Service_MetricsVariations type definition.
2023-04-19 Ben Wagner <bungeman@chromium.org>
[services] FT_Size_Reset_Func to return FT_Error
The `MetricsVariations` `FT_Size_Reset_Func` is currently defined to
return `void`, but the implementations return `FT_Error`. Even though
the pointers passed will be the same at runtime, calling a function
through a pointer of a different type from the original function pointer
type is undefined behavior. This may be caught at runtime by Control
Flow Integrity with something like clang's `cfi-icall`.
Issue: https://crbug.com/1433651
* include/freetype/internal/services/svmetric.h (FT_Size_Reset_Func):
return `FT_Error` instead of `void`.
2023-04-17 Ben Wagner <bungeman@chromum.org>
[truetype] tt_size_reset_height to take FT_Size
The `MetricsVariations` `FT_Size_Reset_Func` is defined to take an
`FT_Size`. Because `tt_size_reset_height` is to be used as such a
function, it must also take an `FT_Size` instead of a `TT_Size`. Even
though the pointers passed will be the same at runtime, calling a
function through a pointer of a different type from the original
function pointer type is undefined behavior. This may be caught at
runtime by Control Flow Integrity with something like clang's
`cfi-icall`.
Issue: https://crbug.com/1433651
* src/truetype/ttobjs.h (tt_size_reset_height): take `FT_Size`
* src/truetype/ttobjs.c (tt_size_reset_height): take `FT_Size` and
update documentation
2023-04-13 Werner Lemberg <wl@gnu.org>
* src/truetype/ttinterp.c: Remove outdated comments.
2023-04-11 Ben Wagner <bungeman@chromium.org>
[sfnt, truetype] Add `size_reset` to `MetricsVariations`.
This is a generalization of commit
```
commit e6699596af5c5d6f0ae0ea06e19df87dce088df8
Author: Werner Lemberg <wl@gnu.org>
Date: Thu Feb 2 11:38:04 2017 +0100
[truetype] Fix MVAR post-action handling.
```
It is also possible for plain `CFF ` style fonts to contain an `fvar` and
`MVAR` table and use `cff_metrics_adjust`. `tt_size_reset` should only be
called with `TT_Size` and never with `CFF_Size`.
Allow the "metrics-variations" service to specify the correct function (if
any) to reset `FT_Size`s after adjusting metrics.
* src/truetype/ttobjs.c (tt_size_reset): Split off some functionality
into...
(tt_size_reset_height): ... this new function.
* src/truetype/ttdriver.c (tt_service_metrics_variations): Add
`size_reset`.
(tt_size_select, tt_size_request): Updated.
* src/truetype/ttobjs.h: Updated.
* include/freetype/internal/services/svmetric.h (MetricsVariations): Add
`size_reset`.
(FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Updated.
* include/freetype/internal/tttypes.h (TT_FaceRec_): Rename `var` to
`tt_var` and add `face_var`.
* src/cff/cffdrivr.c (cff_service_metrics_variations): Add `size_reset`.
(cff_hadvance_adjust, cff_metrics_adjust): Updated.
* src/cff/cffobjs.c (cff_face_init): Use `face_var`.
* src/sfnt/sfobjs.c (sfnt_init_face): Initialize `face_var`.
* src/sfnt/ttmtx.c (tt_face_get_metrics): Use `tt_var`.
* src/truetype/ttgxvar.c (tt_size_reset_iterator): Renamed to...
(ft_size_reset_iterator): ... this new function.
Call `size_reset`.
(tt_apply_mvar): Pass `size_reset` to `ft_size_reset_iterator`.
Fixes #1211
2023-04-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffcmap.c (cff_cmap_encoding_char_next): Abbreviate.
2023-04-10 Alexei Podtelezhnikov <apodtele@gmail.com>
Align `char_next` return types.
This is mostly cosmetic because FT_UInt and FT_UInt32 are likely identical.
* src/sfnt/ttcmap.c, src/cff/cffcmap.c, src/psaux/t1cmap.c,
src/psnames/psmodule.c, include/freetype/internal/service/svpcsmap.h,
src/pfr/pfrcmap.c, src/winfonts/winfnt.c (*_char_next): return FT_UInt.
2023-04-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Clean up CMAP{4,12,13} handling.
This moves the charcode overflow checks upstream and turns some
while-loops into the do-while ones to avoid the uninitialized warnings.
This should slightly reduce the number of checks and jumps.
* src/sfnt/ttcmap.c (tt_cmap{4,12,13}_next,
tt_cmap{4.12.13}_char_map_linear): Remove the charcode overflow check.
(tt_cmap{4,12,13}_char_map_binary): Ditto and use do-while.
(tt_cmap{12,13}_char_next): Add the overflow check.
2023-04-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttpost.c (load_format_25): Do not abort frame reading.
2023-04-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttpost.c (load_format_*): Streamline frame reading.
2023-04-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttpost.c: Formatting and comments.
2023-04-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Consolidate POST version 2.0 and 2.5 (pt 2).
* src/sfnt/ttpost.c (load_format_20, load_format_25): Update arguments
and move shared calls and checks upstream to...
(load_post_names): ... this function.
(tt_face_free_ps_names, tt_face_get_ps_name): Updated.
2023-04-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Consolidate POST version 2.0 and 2.5 (pt 1).
The deprecated POST version 2.5 can be handled using the data
structures of version 2.0. The goal is to reduce the footprint.
* include/freetype/internal/tttypes.h (TT_Post_Names): Absorb and...
(TT_Post_20, TT_Post_25): ... remove these structures.
src/sfnt/ttpost.c (load_post_names, tt_face_get_ps_name,
tt_face_free_ps_names, load_format_20): Updated accordingly.
(load_format_25): ditto and convert offsets to glyph indices.
2023-04-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Miscellaneous POST clean-ups.
* src/sfnt/ttpost.c (load_format_20): Decrease casts.
(load_format_25): Check the table length and impose a theoretical
glyph number limit usable with 8-bit offset. Decrease casts.
(load_post_names): Pass the mapping data length without 2 bytes.
2023-03-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttpost.c (load_format_20): Simplify comutations.
2023-03-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Streamline POST format 2.0 handing (cont'd).
* src/sfnt/ttpost.c (load_format_20): Co-allocate the string data and
their pointers, which makes it easier to handle and free them.
(tt_face_free_ps_names): Updated.
* include/freetype/internal/tttypes.h (TT_Post_20): Update type.
2023-03-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff] Simplify `t2_strings` management in the old engine.
* src/cff/cffparse.c (cff_parser_run): Allocate the charstring buffers
and the list nodes together so that they can be freed at once.
(finalize_t2_strings): Removed as no longer needed.
(cff_parser_done): Updated.
2023-03-19 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff] Rework the stream limit checks.
The old stream limit checks, before 6986ddac1ece, were good but
pointless for the crafted t2_strings. Checking limits there is
not necessary as they are created to hold all data. By using two
conditions, we can detect the actual crossing of the stream boundary
as appropriate for the stream pointer only. The t2_strings parsing
will not be triggering these checks.
* src/cff/cffparse.c (cff_parser_within_limits): Removed.
(cff_parse_real, cff_parse_integer): Redesign the stream limit check.
(cff_parse_num, do fixed, cff_parse_fixed_dynamic): Update callers.
2023-03-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use for-loop.
Even though we never call `TT_Load_Simple_Glyph` with zero contours,
out of abundance of precaution, let's handle this case properly.
2023-03-18 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Clean up zeroing and local variables.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Avoid zeroing.
(load_truetype_glyph): Avoid zeroing and clean local variables.
2023-03-16 Werner Lemberg <wl@gnu.org>
* include/freetype/ftsystem.h (FT_Stream_IoFunc): Improve documentation.
Fixes #1208.
2023-03-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftsynth.c (FT_GlyphSlot_AdjustWeight): New API.
2023-03-16 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Clean up glyph loading.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Clean space checking.
(TT_Hint_Glyph): Don't copy the outline structure.
(TT_Process_Simple_Glyph): Cosmetic update.
2023-03-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Clean up.
2023-03-13 Werner Lemberg <wl@gnu.org>
builds/vms/apinames_vms.bash: Fix `unzip` artifact
The problem occured when unpacking a zip file created on OpenVMS on Linux.
While OpenVMS knows many different file formats, Unix only knows stream-LF
and binary. In principle `zip` on Linux should have translated the file to
stream-LF but failed to do so. That caused the file to incorrectly contain
only one line with control-characters.
2023-03-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Fix recent fallout in memory management.
* src/truetype/ttgload.c (TT_Process_Composite_Glyph,
TT_Load_Simple_Glyph): Clean up old instructions regardless of
new ones, postpone setting `control_len` and `control_data` until...
(TT_Load_Glyph): ... the exit from this function.
2023-03-10 Jouk Jansen <joukj@hrem.nano.tudelft.nl>
Update VMS installation support.
2023-03-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (TT_Hint_Glyph): Mostly cosmetic update.
The number of instructions is now taken from the executed context.
Technically, this means that `control_len` and `control_data`
values are no longer _used_ internally but only expose them.
2023-03-08 Werner Lemberg <wl@gnu.org>
apinames.c: Add comment.
2023-03-07 Werner Lemberg <wl@gnu.org>
[gzip] File `infback.c` is not needed.
* src/gzip/infback.c: Remove.
* src/gzip/rules.mk (GZIP_DRV_SRCS): Updated.
2023-03-07 Werner Lemberg <wl@gnu.org>
[apinames] Fix VMS handling of overly long function names.
Based on ideas from Jouk Jansen <joukj@hrem.nano.tudelft.nl>.
* src/tools/vms_shorten_symbol.c: New file, taken from
https://sourceforge.net/p/vms-ports/vmsshortsym/ci/default/tree/vms_shorten_symbol.c
with some minor edits to allow compilation with C++ and being included in
another source code file.
* src/tools/apinames.c: Include `vms_shorten_symbol.c`.
(PROGRAM_VERSION): Set to '0.5'.
(names_dump) [OUTPUT_VMS_OPT]: Call `vms_shorten_symbol` to get unique function
identifiers not longer than 31 characters.
2023-03-07 Werner Lemberg <wl@gnu.org>
* src/tools/apinames.c (panic): Accept variable number of arguments.
2023-03-07 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (TT_Process_Composite_Glyph): Fix leak too.
2023-03-07 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Triage memory leak.
This leak has been introduced in the previous commit and immediately
detected:
https://chromium-review.googlesource.com/c/chromium/src/+/4313202
2023-03-06 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Simplify memory management.
Instead of using `Update_Max`, switch to regular FreeType memory
allocation macros, stop pre-allocating the glyph instruction arrays.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph,
TT_Process_Composite_Glyph): Switch to regular memory allocation.
* src/truetype/ttinterp.c (Update_Max): Removed.
(TT_Load_Context): Reallocate stack and free old instructions.
(Modify_CVT_Check, Ins_WS): Switch to regular memory allocation.
* src/truetype/ttinterp.h (Update_Max): Removed.
2023-03-06 David PROVENT <dprovent@annecy-elec.local>
Added information about the zlib version update in the changelog
2023-03-06 Alexei Podtelezhnikov <apodtele@gmail.com>
Fix a couple of MSVC warnings.
* src/base/ftcalc.c (FT_MulAddFix): Add cast.
* src/sfnt/ttcolr.c (tt_face_get_colorline_stops, read_paint): Ditto.
2023-03-05 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/vc2010/freetype.vcxproj: Suppress C4267 on _WIN64.
This usually comes from `strlen` returning 64-bit `size_t`, which
we often assign to 32-bit `FT_ULong` on Windows-64 (LLP64).
2023-03-05 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffparse.c (cff_parser_run): Thinko.
2023-03-05 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff] Clean up CharString number encoding.
* src/cff/cffparser.c (cff_parser_run): Work with signed numbers.
2023-03-05 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffparse.c (cff_parser_run): Fix variable type.
2023-03-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff] Clean up memory management in the old engine.
* src/cff/cffparse.c (finalize_t2_strings): Fix NULL-dereferencing
in the out-of-memory situation, use `FT_FREE`.
(cff_parser_run): Use FreeType memory allocation macros and avoid
uninitialized pointers.
2023-03-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffobjs.c (cff_size_init): Synonymous change.
2023-03-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/sfobjs.c (sfnt_load_face): Shorten de-referencing.
2023-03-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[pfr] Shorten de-referencing.
* src/pfr/pfrobjs.c (pfr_face_done, pfr_face_init): Use closer `memory`.
* src/pfr/pfrgload.c (pfr_glyph_load_compound): Remove `loader`.
2023-03-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffobjs.c (cff_size_get_globals_funcs): Shorten de-referencing.
2023-03-03 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff,cid,type1] Shorten de-referencing.
* src/cff/cffobjs.c (cff_clot_init): Use immediate library reference.
* src/cid/cidobjs.c (cid_slot_init): Ditto.
* src/type1/t1objs.c (T1_GlyphSlot_Init): Ditto.
2023-03-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* configure: Use `sed` instead of `grep`.
This is more portable and consistent with `autogen.sh`.
2023-03-02 Ben Wagner <bungeman@chromium.org>
Avoid strtol on non-null-terminated data.
Technically, `strtol` can only be used with C strings terminated with
`\0`. CID data is not generally null-terminated and often does not
contain a `\0` if it is hex-encoded. AddressSanitizer with `ASAN_OPTIONS`
containing `strict_string_checks=1` verifies this by using an adversarial
`strtol` that always reads to the terminating `\0`.
To avoid undefined behavior from `strtol` in `cid_parser_new`, use the
parser to parse the tokens instead of attempting to parse them ad-hoc.
This will internally use `PS_Conv_Strtol` to parse the integer, which
respects the parser's limits and directly implements the PostScript
parsing rules for integers.
* src/cid/cidparse.c (cid_parser_new): Use the parser to parse the
tokens.
Fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=1420329
2023-03-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffload.c (cff_subfont_load): Synonymous update.
2023-03-01 ubawurinna <ubawurinna-6079@yopmail.com>
* src/gzip/README.freetype: Update version.
2023-03-01 ubawurinna <you@example.com>
[gzip] Fix static linking.
Without this patch, static linking with MS Visual Studio causes linking
errors.
* src/gzip/ftgzip.c: Set `ZEXPORT` to nothing and `ZEXTERN` to static for
all compilers.
2023-03-01 Werner Lemberg <wl@gnu.org>
* include/freetype/internal/compiler-macros.h (FALL_THROUGH): Update.
This follows
https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00200.html
2023-02-28 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Treat 38 as 40 without Infinality.
* include/freetype/ftdriver.h (TT_INTERPRETER_VERSION_38): Reinstate.
* src/truetype/ttdriver.c (tt_property_set): Fallback from 38 to 40.
2023-02-26 Werner Lemberg <wl@gnu.org>
* include/freetype/internal/compiler-macros.h (FALL_THROUGH): Update.
This follows
https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00159.html
2023-02-26 Werner Lemberg <wl@gnu.org>
* src/*: Replace leading underscores with trailing ones in dummy variables.
This is to avoid clang warnings.
2023-02-26 Karl Berry <karl@freefriends.org>
* configure: Don't hardcode `grep -E`.
TeXLive still supports Solaris 5.10, where the system's `grep` doesn't
accept the `-E` option. We thus introduce an `EGREP` variable that is set
to either `grep -E` or `-egrep`.
2023-02-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffload.c (cff_encoding_load): Optimize array zeroing.
This is unnecessary for predefined standard and expert encodings.
Even for custom encodings the arrays might be already zeroed when
CFF_FontRec is created but we keep it just in case.
2023-02-25 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/type1/t1load.c (T1_Get_MM_Var): Optimize array zeroing.
2023-02-25 Tamir Duberstein <tamird@google.com>
* src/base/ftsystem.c (ft_ansi_stream_io): Avoid undefined behaviour.
Also short-circuit on `offset` to avoid checking `count` a second time when
`ft_ansi_stream_io` is used for reading.
Per ISO/IEC 9899:
If an argument to a function has an invalid value (such as a value outside
the domain of the function, or a pointer outside the address space of the
program, or a null pointer, or apointer to non-modifiable storage when the
corresponding parameter is not const-qualified) or a type (after
promotion) not expected by a function with variable number of arguments,
the behavior is undefined. If a function argument is described as being
an array, the pointer actually passed to the function shall have a value
such that all address computations and accesses to objects (that would be
valid if the pointer did point to the first element of such an array) are
in fact valid.
Per IEEE Std 1003.1:
size_t fread(void *restrict ptr, size_t size, size_t nitems,
FILE *restrict stream);
The `fread` function shall read into the array pointed to by `ptr` up to
`nitems` elements whose size is specified by `size` in bytes, from the
stream pointed to by `stream`.
Since the first argument to `fread` is described as being an array, its
behavior is undefined when that argument is a null pointer.
Per the documentation on `ft_ansi_stream_io`:
If `count' is zero (this is, the function is used for seeking), a non-zero
return value indicates an error.
Thus the intent is clear, and the call to `fread` can be skipped, avoiding
undefined behaviour.
2023-02-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Clean up contour indexing.
* src/raster/ftraster.c (Decompose_Curve, Convert_Glyph): Use consistent
index types (Int) and compact iterations.
2023-02-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[autofit] Clean up contour indexing.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Refactor.
* src/autofit/afcjk.c (af_cjk_metrics_init_blues): Ditto.
2023-02-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftoutln.c (FT_Outline_Check): Fix C4701 warning.
2023-02-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sdf/ftsdf.c (get_min_distance_cubic): Fix C4701, typos.
2023-02-20 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftstroke.c (FT_Stroker_ParseOutline): Clean up contour indexing.
2023-02-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Clean up contour indexing.
* src/base/ftoutln.c (FT_Outline_Reverse, FT_Outline_EmboldenXY,
FT_Outline_Get_Orientation): Set the first and last indexes together.
(FT_Outline_Decompose): Ditto and check them more stringently.
* src/smooth/ftgrays.c (FT_Outline_Decompose)[STANDALONE_]: Ditto.
2023-02-20 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftoutln.c (FT_Outline_Check): Update error code, clean up.
2023-02-17 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Hide Infinality.
Remove Infinality as an option before its complete extraction.
* include/freetype/ftoption.h: Remove the Infinality option.
* devel/ftoption.h: Ditto.
* include/freetype/ftdriver.h (TT_INTERPRETER_VERSION_38): Is 40 now.
2023-02-17 Alex Ringlein <aringlein@figma.com>
* src/base/ftoutln.c (FT_Outline_Reverse): Anchor first contour points.
A cubic contour has to always start from an on-point. Therefore, we
should not swap the first with the last point, which might be off, and
obtain an invalid contour. This does not matter for conic contours.
If anything, it also saves one swap there. Fixes #1207.
2023-02-16 Werner Lemberg <wl@gnu.org>
Documentation improvement for `FT_Bitmap`.
Fixes #1205.
2023-02-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[type1/MM] Round design coordinates.
The design coordinates for MM fonts were not rounded. For example,
`FT_Get_Var_Design_Coordinates` returned values with fractional part.
* src/type1/t1load.c (mm_axis_unmap): Refactor with rounding.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Set_Var_Design_Coordinates,
FT_Get_Var_Design_Coordinates): Reword documentation.
2023-02-09 Jan Alexander Steffens (heftig) <heftig@archlinux.org>
* builds/meson/parse_modules_cfg.py: Handle `gxvalid` and `otvalid`.
These need a name mapping similar to what was done for other modules,
or linking will fail.
2023-02-09 Werner Lemberg <wl@gnu.org>
* build/toplevel.mk (do_dist): Fix typo.
2023-02-09 Werner Lemberg <wl@gnu.org>
* Version 2.13 released.
==========================
Tag sources with `VER-2-13-0'.
* docs/VERSION.TXT: Add entry for version 2.13.
* docs/CHANGES: Updated.
* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.12.1/2.13/, s/2121/2130/.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 13.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.raw (version_info): Set to 25:0:19.
* CMakeLists.txt (VERSION_MINOR): Set to 13.
(VERSION_PATCH): Set to 0.
2023-02-09 Alexei Podtelezhnikov <apodtele@gmail.com>
Comment on `FT_GlyphSlot_Slant'.
2023-02-08 Werner Lemberg <wl@gnu.org>
[autofit] Fix 'multi' compilation.
* src/autofit/ft-hb.c: Decorate with `FT_LOCAL_DEF`.
Add ANSI boilerplate code for otherwise empty file.
* src/autofit/ft-hb.h: Include `compiler-macros.h` and `freetype.h`.
Use `FT_BEGIN_HEADER` and `FT_END_HEADER`.
Decorate with `FT_LOCAL`.
* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `ft-hb.c`.
2023-02-08 Werner Lemberg <wl@gnu.org>
Fix `FT_LOCAL` and `FT_LOCAL_DEF` tags.
2023-02-08 Werner Lemberg <wl@gnu.org>
Fix 'fall-through' warning messages.
Modern compilers get more insistent on that...
* include/freetype/internal/compiler-macros.h (FALL_THROUGH): Define.
* src/*: Use it instead of `/* fall through */` comments.
2023-02-08 Werner Lemberg <wl@gnu.org>
For debugging, avoid implicit conversion from integer to double.
Otherwise we get zillions of clang 15 warnings.
* src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/base/ftobjs.c, src/base/ftoutln.c, src/cff/cffparse.c,
src/raster/ftraster.c, src/sfnt/pngshim.c, src/truetype/ttgload.c,
src/truetype/ttgxvar.c, src/truetype/ttobjs.c, src/type1/t1gload.c: Use
`double` cast in debugging and tracing macros.
2023-02-08 Werner Lemberg <wl@gnu.org>
Avoid reserved identifiers that are globally defined.
This is mandated by the C99 standard, and clang 15 produces zillions of
warnings otherwise.
* devel/ftoption.h, include/freetype/config/ftoption.h,
include/freetype/internal/ftmemory.h, src/autofit/afhints.h,
src/autofit/afmodule.c, src/autofit/aftypes.h, src/base/ftadvanc.c,
src/base/ftdbgmem.c, src/base/ftstream.c, src/bdf/bdflib.c,
src/truetype/ttinterp.c: Replace identifiers of the form `_foo` with `foo_`.
2023-02-08 Werner Lemberg <wl@gnu.org>
Fix minor clang and clang++ warnings.
2023-02-08 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype, type1] Additional variation tags.
Sync with
https://learn.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg#registered-axis-tags
* src/truetype/ttgxvar.h (TTAG_ital): New tag.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Use it.
* src/type1/t1load.c (T1_Get_MM_Var): Handle 'slnt' and 'ital'.
2023-02-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftsynth.c (FT_GlyphSlot_Slant): Add vertical slant.
* include/freetype/ftsynth.h (FT_GlyphSlot_Slant): Update it.
2023-02-08 anuj <95867901+anuj99@users.noreply.github.com>
[sdf] Use 32-bit integers internally.
* src/sdf/ftsdfcommon.h (FT_16D16, FT_26D6): Use 32-bit integers
instead of `FT_Fixed` for internal data types. `FT_Fixed` i.e.
`signed long` is 64-bit on some architectures.
2023-02-07 Werner Lemberg <wl@gnu.org>
docs/CHANGES: Updated.
2023-02-04 Alexei Podtelezhnikov <apodtele@gmail.com>
Comment on optional ascender and descender.
2023-02-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/type1/t1afm.c (T1_Read_Metrics): Reaffirm ascender and descender.
2023-02-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/type1/t1afm.c (T1_Read_Metrics): Validate ascender and descender.
The ascender and descender are optional in the AFM specifications.
They could be omitted or even set to zero, e.g., in the current release
of URW++ base 35 fonts.
2023-02-02 Werner Lemberg <wl@gnu.org>
* src/cff/cffgload.c (cff_slot_load): Avoid memory leak.
Fixes issue #1204.
2023-02-01 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Check `face->blend`.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55581
2023-02-01 Werner Lemberg <wl@gnu.org>
* docs/CHANGES: Add news for 'freetype-demos'.
2023-01-30 Werner Lemberg <wl@gnu.org>
* subprojects/harfbuzz.wrap, subprojects/libpng.wrap: Updated.
2023-01-28 Werner Lemberg <wl@gnu.org>
Minor changes.
Comment fixes, typos, removing of unnecessary parentheses.
2023-01-28 Werner Lemberg <wl@gnu.org>
Whitespace.
2023-01-27 Behdad Esfahbod <behdad@behdad.org>
[ttgxvar] Fix crash in COLRv1.
This is a stopgap until issue #1202 is properly fixed.
* src/truetype/ttxgvar.c (tt_var_get_item_delta): Check `normalizedcoords`.
2023-01-19 Werner Lemberg <wl@gnu.org>
The 'COLR' v1 API will no longer be experimental in the next release.
2023-01-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* docs/oldlogs/ChangeLog.210: Typos.
2023-01-18 Ben Wagner <bungeman@chromium.org>
[base] Fix typo.
* src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Request module 't1cid',
not 'cid'.
2023-01-18 Ben Wagner <bungeman@chromium.org>
[base] Return error if requested driver is not found.
In `open_face_from_buffer` it is possible that a driver is requested but
FreeType was built without the requested module. Return an error in this
case to indicate that the request could not be satisfied, rather than trying
all existing driver modules.
* src/base/ftobjs.c (open_face_from_buffer): Return `FT_Err_Missing_Module`
if a driver is specified but not found.
2023-01-18 Dominik Röttsches <drott@chromium.org>
[sfnt] Avoid nullptr dereference in reading malformed 'COLR' v1 table.
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1408044.
* src/sfnt/ttcolr.c (tt_face_load_colr): When the 'COLR' v1 table header is
too small, don't deallocate delta set index map structures.
2023-01-17 Werner Lemberg <wl@gnu.org>
* src/tools/update-copyright: Allow execution from other repositories.
We use this for `freetype-demos`.
2023-01-17 Werner Lemberg <wl@gnu.org>
Update all copyright notices.
2023-01-17 Werner Lemberg <wl@gnu.org>
* src/tools/no-copyright: Updated.
2023-01-17 Ben Wagner <bungeman@chromium.org>
[base] 'close' callback may not use `stream->memory`.
The documentation for `FT_StreamRec::memory` states that it 'shouldn't be
touched by stream implementations'. This is true even for internal
implementations of the 'close' callback, since it is not guaranteed that
`memory` will even be set when the 'close' callback occurs.
* src/base/ftobjs.c (new_memory_stream): stash current `memory` in
`stream->descriptor`.
(memory_stream_close): Use it.
2023-01-17 Ben Wagner <bungeman@chromium.org>
[base] Always close user-provided stream.
The `FT_Open_Face` documentation states
> If `FT_OPEN_STREAM` is set in `args->flags`, the stream in `args->stream`
> is automatically closed before this function returns any error (including
> `FT_Err_Invalid_Argument`).
However, if the user provides a stream in `args.stream` with
`FT_OPEN_STREAM` set and a `close` function, but then for some reason passes
NULL for `aface` and a non-negative `face_index`, the error
`Invalid_Argument` is returned but the `close` callback will not be called
on the user-provided stream. This may cause resource leaks if the caller is
depending on the `close` callback to free resources.
The difficulty is that a user may fill out a `FT_StreamRec` and pass its
address as `args.stream`, but the stream isn't really 'live' until
`FT_Stream_New` is called on it (and `memory` is set). In particular, it
cannot really be cleaned up properly in `ft_open_face_internal` until the
stream pointer has been copied into the `stream` local variable.
* src/base/ftobj.c (ft_open_face_internal): Ensure that user-provided
`args.stream.close` is called even with early errors.
2023-01-17 Ben Wagner <bungeman@chromium.org>
[base] Fix leak of internal stream marked external.
`open_face_from_buffer` allocates a new `FT_Stream` to pass to
`ft_open_face_internal`. Because this is an `FT_OPEN_STREAM`,
`ft_open_face_internal` will mark this as an 'external stream', which the
caller must free. However, `open_face_from_buffer` cannot directly free it
because the stream must last as long as the face. There is currently an
attempt at this by clearing the 'external stream' bit after
`open_face_from_buffer` returns successfully. However, this is too late as
the original stream may have already been closed and the stream on the face
may not be the same stream as originally passed.
It is tempting to use `FT_OPEN_MEMORY` and let `ft_open_face_internal`
create the stream internally. However, with this method there is no means
to pass through a 'close' function to the created stream to free the
underlying data, which must be owned by the stream.
A possibility is to check on success if the stream of the face is the same
as the original stream. If it is then unset the external flag. If not,
then free the original stream. Unfortunately, while no current
implementation does so, it is possible that the face still has the original
stream somewhere other than as the `FT_FaceRec::stream`. The stream needs
to remain available for the life of the face or until it is closed,
whichever comes earlier.
The approach taken here is to let the stream own itself. When the stream is
closed it will free itself.
* src/base/ftobjs.c (memory_stream_close): Free `stream`.
(open_face_from_buffer): Simplify error handling, since
`ft_open_face_internal` always closes `args.stream` on any error.
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54930
2023-01-16 Werner Lemberg <wl@gnu.org>
sr/*.c: Various minor fixes.
* src/autofit/ft-hb.c (_hb_ft_reference_table): Call `FT_UNUSED` after
variable declarations.
* src/gxvalid/gxvjust.c (gxv_just_widthDeltaClusters_validate): Eliminate
unused variable.
* src/gzip/ftgzip.c: Don't call GCC '-Wstrict-prototypes' pragma for C++
compiler.
* src/sfnt/ttcolr.c (ENSURE_READ_BYTES): Remove final semicolon to avoid
compiler warning.
* src/sfnt/ttsvg.c (tt_face_load_svg_doc): Fix signedness warning.
2023-01-16 Dominik Röttsches <drott@chromium.org>
[sfnt] Remove temporary runtime flag for variable 'COLR' v1.
Fixes #1187.
* src/sfnt/ttcolr.c (top level, read_paint, tt_face_load_colr,
tt_face_free_colr, get_deltas_for_var_index_base,
tt_face_get_color_glyph_clipbox, tt_face_get_colorline_stops): Remove macro
definition `VARIABLE_COLRV1_ENABLED` and its usage.
* src/truetype/ttdriver.c (tt_property_set): Remove parsing of
'TEMPORARY-enable-variable-colrv1' property name.
* src/truetype/ttobjs.h (TT_DriverRec): Remove `enable_variable_colrv1`
flag.
2023-01-07 Werner Lemberg <wl@gnu.org>
* src/autofit/ft-hb.c (_hb_ft_reference_table): Minor integration fixes.
2023-01-07 Ben Wagner <bungeman@chromium.org>
[truetype] Reset cvt and storage in context load.
Currently the cvt and storage are saved and restored in `TT_RunIns`.
However, this is too granular as the cvt and storage area should be set to
the original cvt and storage area only when setting up the hinting context.
This allows for the cvt and storage area to be modified while parsing
multiple glyphs, as is the case with composite glyphs.
* src/truetype/ttinterp.h (TT_ExecContextRec): Remove `origCvt` and
`origStorage`.
* src/truetype/ttinterp.c (TT_RunIns): Don't save and restore the cvt and
storage area.
(Modify_CVT_Check, Ins_WS): Switch from "if in glyph and using original data
do copy on write" to "if in glyph and not using glyph specific data do copy
on write".
2023-01-06 Matthias Clasen <mclasen@redhat.com>
[autofit] Don't depend on 'hb-ft'.
The circular dependency is still there, but at least we no longer depend on
the HarfBuzz API that is only present if HarfBuzz has been built with
FreeType support, making the bootstrapping a bit easier.
* src/autofit/ft-hb.c, src/autofit/ft-hb.h: New files, providing
`_hb_ft_font_create`, which is more or less a verbatim copy of the
corresponding HarfBuzz code from file `hb-ft.cc`.
* src/autofit/afglobal.c (af_face_globals_new): Use it.
* src/autofit/afshaper.h: Don't include `hb-ft.h` but `ft-hb.h`.
* src/autofit/autofit.c: Include `ft-hb.c`.
* LICENSE.TXT: Updated.
2023-01-06 Ben Wagner <bungeman@chromium.org>
[truetype] Keep variation store consistent.
`tt_var_load_item_variation_store` fills out a `GX_ItemVarStore`. While it
may return an error, the item store must be left in a consistent state so
that any use or destruction of the item store can properly use or free the
data in it. Before this change the counts from the font data were read
directly into the item store before the actual allocation of the arrays to
which they referred. There exist many opportunities between the time the
counts are read and the arrays are allocated to return early due to invalid
data. When this happened the item store claimed to have entires it actually
did not, leading to crashes later when it was used.
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54449
* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Read the counts
into local variables and store them in the item store only after the related
arrays are actually created on the item store.
2023-01-05 Ben Wagner <bungeman@chromium.org>
[base] Report used stream's external status.
In `open_face` the initial stream is set on the face, along with the
information about if FreeType is the owner of the stream object itself. The
loaders may in the course of their work replace this stream with a new
stream (as is the case for 'woff' and 'woff2'), which may have a different
ownership than the initial stream object (likely the original stream object
is owned by the user and is external, while the new stream object is created
internally to FreeType and is internal). When the stream is replaced, the
face's flags are updated with the new ownership status.
However, `open_face` cannot itself free this stream as its caller
`ft_open_face_internal` is responsible for this. In addition, in the case
of an error `open_face` cannot return an actual face with the new stream and
its ownership status to the caller. As a result, it must pass this
information back to the caller as a sort of "failed face" so that the caller
can clean up.
`open_face` was already passing back the new stream but was not passing back
the stream ownership information. As a result the stream may not have been
free'd when needed.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54700
* src/base/ftobjs.c (open_face): Pass back the ownership information as
well.
(ft_open_face_internal): Updated.
2023-01-05 Noah Cabral <cnoah1705@gmail.com>
fix spelling err in LICENSE.txt
2023-01-05 Dominik Röttsches <drott@chromium.org>
[sfnt] Fix color stop bounds check calculation at table end.
Fixes https://bugs.chromium.org/p/skia/issues/detail?id=14021
* src/sfnt/ttcolr.c (VAR_IDX_BASE_SIZE): New macro.
(tt_face_get_colorline_stops): Fix off-by-one bounds check calculation, take
`VarColorStop` into account, and hopefully make it easier to read.
2023-01-05 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftobjs.c (FT_Request_Metrics): Avoid division by zero.
The division-by-zero might happen in broken fonts (see #1194).
Instead of returning a huge number from FT_DivFix and failing
to scale later, we now bail immediately.
2022-12-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[psaux] Delay the upem validity assertion.
Fixes #1194.
* src/psaux/psft.c (cf2_getUnitsPerEm): Remove the upem assert.
(cf2_checkTransform): Assert the upem validity after checking the scale.
2022-12-14 David Vanderson <david.vanderson@gmail.com>
Werner Lemberg <wl@gnu.org>
[gzip] Make static compilation not leak global symbols.
* src/gzip/ftgzip.c (HAVE_HIDDEN): Do not define; it is no longer needed
because everything is static.
(HAVE_MEMCPY): Define.
(zcalloc, zcfree): Remove no longer needed definitions (because `Z_SOLO` is
active).
* src/gzip/patches/freetype-zlib.diff: Regenerated.
Fixes #1146.
2022-12-14 Werner Lemberg <wl@gnu.org>
* src/gzip/ftzconf.h: Updated to zlib 1.2.13.
I forgot to copy that file.
2022-12-14 Werner Lemberg <wl@gnu.org>
* builds/unix/configure.raw: Don't check for `memcpy` and `memmove`.
We expect a C99 compiler, and both functions are part of this standard.
2022-12-13 Werner Lemberg <wl@gnu.org>
[sdf, sfnt] Handle minor compiler warnings.
* src/sdf/ftsdf.c (get_min_distance_conic): Initialize `nearest_point`.
* src/sfnt/ttsvg.c (find_doc): Initialize `mid_doc`.
Fixes #1195.
2022-12-07 Werner Lemberg <wl@gnu.org>
* subprojects/zlib.wrap: Micro-update from upstream.
2022-12-06 Jiří Malák <malak.jiri@gmail.com>
* include/freetype/internal/ftcalc.h (FT_MSB): Support Open Watcom 2.0.
Closes !232.
2022-11-23 Luca Bacci <luca.bacci982@gmail.com>
* src/base/ftdbgmem.c (ft_mem_source_compare): Add FT_COMPARE_DEF.
Closes !230.
2022-11-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/autofit/afloader.c (af_loader_load_glyph): Remove `size` check.
This is done by `FT_Load_Glyph`.
2022-11-18 Alexei Podtelezhnikov <apodtele@gmail.com>
Comments added.
2022-11-16 Johan Matsson <mjunix@ at github>
* src/autofit/afloader.c (af_loader_load_glyph): Fix dereference.
This must happen after the NULL check.
Taken from
https://github.com/freetype/freetype/pull/2
2022-11-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pcf/pcfutil.c ({Two,Four}ByteSwap): Use builtins or shifts.
We trust glibc which uses shifts or builtins to swap bytes. This
must be more efficient.
2022-11-14 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgxvar.c (tt_hvadvance_adjust): Integer overflow.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50462
2022-11-14 Loïc Yhuel <loic.yhuel@softathome.com>
[meson] Use generated ftmodule.h
ftmodule.h is generated at the root of the build directory, but FT_CONFIG_MODULES_H
(freetype/config/ftmodule.h) is used instead.
This makes the build fail when disabling modules in modules.cfg.
* meson.build (harfbuzz_dep): Add '-DFT_CONFIG_MODULES_H=<ftmodule.h>'.
2022-11-14 Loïc Yhuel <loic.yhuel@softathome.com>
[meson] Fix generated ftmodule.h
The sdf module wasn't recognized, so the generated ftmodule.h had "None_renderer_class".
* builds/meson/parse_modules_cfg.py: Handle sdf in RASTER_MODULES.
2022-11-12 Dominik Röttsches <drott@chromium.org>
Add `TT_CONFIG_OPTION_NO_BORING_EXPANSION` configuration macro.
This gives users a possibility to deactivate new features not (yet) in the
OpenType standard.
* include/freetype/config/ftoption.h, devel/ftoption.h
(TT_CONFIG_OPTION_NO_BORING_EXPANSION): New macro.
* src/truetype/ttgxvar.c (ft_var_load_avar): Use it to disable 'avar'
version 2.0 support.
2022-11-12 Behdad Esfahbod <behdad@behdad.org>
[truetype] Improve bounds checks for `ItemVariationStore`.
* src/truetype/ttgxvar.c (tt_hvadvance_adjust): Move bounds check ...
(tt_var_get_item_delta): ... to this function, because it is safer. For
example, the 'avar' table 2.0 codepath was not performing a bounds check at
all.
2022-11-12 Behdad Esfahbod <behdad@behdad.org>
[truetype] In `ItemVariationStore`, value 0xFFFF for `dataCount` is valid.
It corresponds to outer indices of 0 to 0xFFFE.
* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Remove invalid
code.
2022-11-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[pcf] Improve CMap efficiency and readability.
* src/pcf/pcfdrivr.c (pcf_cmap_char_{index,next}): Check and walk
the encoding array indexes.
2022-11-10 Sam James <sam@gentoo.org>
Fix `-Wstrict-prototypes`.
* builds/unix/configure.raw: Fix `-Wstrict-prototypes`.
Clang 16 warns on these and they will be dropped in C23.
* builds/unix/freetype2.m4: Ditto.
2022-11-09 Ben Wagner <bungeman@chromium.org>
[truetype] Check avar_segment before access
* src/truetype/ttgxvar.c (tt_done_blend): check `avar_segment` before
accessing to free its `correspondence`.
Reported as:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53062
2022-11-09 Ben Wagner <bungeman@chromium.org>
[truetype] Restore behavior of ft_var_load_hvvar
* src/truetype/ttgcvar.c (ft_var_load_hvvar): restore previous behavior
In a previous change [0] the behavior of `ft_var_load_hvvar` was changed
to not load the item variation store if it was at offset 0, but not
return an error when this happened. This broke any users, like
`tt_hvadvance_adjust`, that rely on successful completion of
`ft_var_load_hvvar` to imply that returned table's `itemStore` had been
initialized. This lead such users to dereference NULL.
This change appears to have been unintentional and unrelated to the
actual avar2 changes. As a result, fix these NULL dereferences by
restoring the code to always attempt to initialize the `itemStore`.
[0] ae4eb996 "[truetype] Add support for `avar` table 2.0 format."
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53061
2022-11-08 Werner Lemberg <wl@gnu.org>
docs/CHANGES: Updated.
2022-11-08 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[build] use AC_CHECK_PROG() macro for libpng-config detection
* builds/unix/configure.raw: use AC_CHECK_PROG() instead of `which` to find `libpng-config`.
2022-11-08 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[build] fix for make multi
Fix "make multi" by MR !223
* include/freetype/internal/services/svmm.h: include ftmm.h to define FT_Get_MM_Func.
* src/truetype/ttgxvar.h: include ftmmtypes.h to use GX_AVarTable properly.
* src/base/ftmac.c: include ftdebug.h to use FT_THROW() properly.
2022-11-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Accelerate the search.
This is mostly for consistency because PFR fonts with bitmap strikes
do not seem to exist.
2022-11-06 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf, pfr, psnames] Accelarate charmap searches.
The binary searches within charmaps can be accelerated because they
often contain dense continuous blocks of character codes. Within such
blocks, you can predict matches based on misses. This method has been
deployed in `bdf` since 0f122fef34; we only refactor it there. We now
use it in `pfr` and `psnames`, which speeds up the unicode charmap
access by about 50% in PFR and Type 1 fonts.
* src/bdf/bdfdrivr.c (bdf_cmap_char_{index,next}): Refactor.
* src/pfr/pfrcmap.c (pfr_cmap_char_{index,next}): Predict `mid` based
on the mismatch distance.
* src/psnames/psmodule.c (ps_unicodes_char_{index,next}): Ditto.
2022-11-04 Behdad Esfahbod <behdad@behdad.org>
[truetype] Add support for `avar` table 2.0 format.
See
https://github.com/harfbuzz/boring-expansion-spec/blob/main/avar2.md
for the specification.
Currently, this is implemented only in most recent OS versions on Apple
platforms and in the HarfBuzz library, but it is expected to be added to the
OpenType standard soon.
* src/truetype/ttgxvar.h (GX_AVarTableRec): New structure.
(GX_BlendRec): Use it to replace `avar_segment` with `avar_table`.
* src/truetype/ttgxvar.c (ft_var_load_avar): Load new table version.
(ft_var_to_normalized, tt_done_blend): Extend for new format.
(ft_var_load_hvvar, ft_var_to_design): Updated.
2022-10-24 Werner Lemberg <wl@gnu.org>
Replace '1/64th' (and similar entries) with '1/64' in docs and comments.
2022-10-24 Ivan Panchenko <ivanpan3@gmail.com>
* include/freetype/*: Fix documentation typos.
2022-10-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c: Cosmetic changes.
2022-10-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff, truetype] Simplify SVG metrics scaling.
Use pre-calculated scaling factors. Also, the advance widths used
to be rounded, which was incorrect.
* src/cff/cffgload.c (cff_slot_load): Use `x_scale` and `y_scale`.
* src/truetype/ttgload.c (TT_Load_Glyph): Ditto.
2022-10-20 Werner Lemberg <wl@gnu.org>
* subprojects/zlib.wrap: Update to zlib version 1.2.13.
2022-10-18 Dominik Röttsches <drott@chromium.org>
[sfnt] Additional bounds checks for `COLR` v1 table handling.
* src/sfnt/ttcolr.c (read_paint): Add `colr` argument, necessary for...
... another use of `ENSURE_READ_BYTES`.
Update callers.
(tt_face_get_paint_layers): Ensure that the 4-byte paint table
offset can be read.
This is a follow-up to !124 and issue
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52404
2022-10-18 Werner Lemberg <wl@gnu.org>
[gzip] Update sources to zlib 1.2.13.
2022-10-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Simplify calculations.
2022-10-18 Werner Lemberg <wl@gnu.org>
Minor formatting.
2022-10-18 Dominik Röttsches <drott@chromium.org>
[sfnt] Guard individual `COLR` v1 paint field reads.
* src/sfnt/ttcolr.c (ENSURE_READ_BYTES): New macro.
(read_paint): Use it – after the start pointer `p` has been checked for
whether it allows reading the format byte, each successive paint table field
read need to be bounds-checked before reading further values.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52404
2022-10-17 Xiang Xiao <xiaoxiang@xiaomi.com>
* builds/toplevel.mk: Prefix all paths with `$(TOP_DIR)/`.
This is useful for builds that are not started from the root directory.
2022-10-17 Liu Kunpeng(柳鲲鹏) <liukunpeng@ts-it.cn>
* src/base/ftsynth.c (FT_GlyphSlot_Slant): New API with custom slant.
* include/freetype/ftsynth.h (FT_GlyphSlot_Slant): Declare it.
2022-10-15 Alexei Podtelezhnikov <apodtele@gmail.com>
Note the lack of floating-point data types.
2022-10-10 Werner Lemberg <wl@gnu.org>
[cff] Remove `FT_CONFIG_OPTION_NO_GLYPH_NAMES`.
This ancient option stayed completely undocumented. Given that the 'cff'
driver requires the 'psnames' module, it makes no sense today to have this
macro.
* src/cff/cffdrivr.c (cff_services), src/cff/cffobjs.c (cff_face_init):
Remove corresponding conditional code.
2022-10-10 Werner Lemberg <wl@gnu.org>
Synchronize `ftoption.h` flavours.
2022-10-10 Werner Lemberg <wl@gnu.org>
Minor comment changes.
2022-10-05 Alexei Podtelezhnikov <apodtele@gmail.com>
Improve FT_Get_Name_Index docs and place it next to FT_Get_Glyph_Name.
2022-10-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[autofit] Reset the face charmap directly.
There is no need to validate the original charmap in `FT_Set_Charmap`.
It can be reset directly.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Use direct assignment.
* src/autofit/af{latin,cjk,indic}.c (af_latin_metrics_init): Ditto.
2022-10-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/type1/t1afm.c (T1_Read_PFM): Set charmaps directly.
As with the previous commit, we can avoid the validation checks
of `FT_Set_Charmap` and set it directly when choosing from the
available list.
2022-10-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Avoid `FT_Set_Charmap`.
Set charmap aggressively without all validations of `FT_Set_Charmap`
because we take it from the available array and only temporarily.
Even CMap Format 14 will gracefully return 0.
2022-10-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcbasic.c (ftc_basic_family_get_count): Remove redundancy.
2022-09-30 Werner Lemberg <wl@gnu.org>
* src/psaux/pshints.c (cf2_hintmap_insertHint): Fix midpoint computation.
Replace '(start + end) / 2' with 'start + (end - start) / 2' to avoid
overflow.
Fixes #1180.
2022-09-30 Werner Lemberg <wl@gnu.org>
* src/psaux/pshints.c (cf2_hintmap_build): Improve debugging output.
2022-09-29 mlugg <mlugg@mlugg.co.uk>
[truetype] Fix undefined pointer arithmetic.
* src/truetype/ttgxvar.c (tt_var_get_item_delta, ft_var_load_mvar): Use
`FT_OFFSET`.
2022-09-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Use lighter FT_DivFix.
2022-09-29 Ali Chraghi <alichraghi@pm.me>
[base] FT_Attach_Stream: Make `parameters` argument constant.
2022-09-29 Azamat Hackimov <azamat.hackimov@gmail.com>
* src/tools/*.py: Migrate to Python 3.
Fixes #1185, closes !205. Formatting changes according to PEP8.
2022-09-27 Dominik Röttsches <drott@chromium.org>
[sfnt] Guard access in 'COLR' table when requesting child table pointer.
* src/sfnt/ttcolr.c (tt_face_get_colorline_stops, read_paint): Tighten
pointer bounds checks.
(get_child_table_pointer): Check whether incoming pointer `p` lies within
the 'COLR' table.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51816
2022-09-27 Ben Wagner <bungeman@chromium.org>
[sfnt] Add SVG document bounds checking.
Add a check that the document content is actually contained within the
`SVG ` table. Without this check a malformed font may claim arbitrary
memory as its document content.
* src/sfnt/ttsvg.c (tt_face_load_svg): Take `numEntries` into account when
testing 'documentRecord' extents.
(find_doc): Rename `stream` to `document_records` for clarity.
(tt_face_load_svg_doc): Split `doc` from `doc_list` pointer for clarity.
Test that the document content is contained within the table.
Ensure minimum length of document before testing for gzip format.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51812
2022-09-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Clean up the bitmap flow control.
* src/base/ftbitmap.c (FT_Bitmap_Copy): Flip the copy if its pitch
is trully opposite, zero is not a positive value.
(FT_Bitmap_Convert): Set negative pitch as needed, accept negative
alignment values.
2022-09-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Discard and recreate bitmaps for copying and converting.
Reusing target bitmaps for copying and converting is permitted. It is,
however, pointless to preserve their content before overwriting. Free-
malloc might be faster than realloc.
* src/base/ftbitmap.c (FT_Bitmap_Copy, FT_Bitmap_Convert): Free
an old buffer and create a new one.
2022-09-16 Dominik Röttsches <drott@chromium.org>
Reject 'COLR' table if version is 1 but header too small.
* src/sfnt/ttcolr.c (tt_face_load_colr): If the version is determined to
be 1, then the table size has to be at least the size of the v1 header.
Also, for peeking the number of base glyphs and entries in the layer list,
ensure that the table is sufficiently long.
Fixes #1179. Original patch by Sergey Temnikov.
2022-09-15 Werner Lemberg <wl@gnu.org>
* src/otvalid/otvgsub.c (otv_SingleSubst_validate): Fix format 1 handling.
Fixes #1181.
2022-09-06 Dominik Röttsches <drott@chromium.org>
[truetype] Reject 'fvar' loading when `num_instances` is too small.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Reject retrieving master when
'fvar' values locally do not match with sanitized values from initialization
at `sfnt_init_face` time.
Reported as
https://bugs.chromium.org/p/chromium/issues/detail?id=1360295
2022-09-05 Dominik Röttsches <drott@chromium.org>
[sfnt] Handle variable `COLR` v1 fonts without delta set index map
Fixes #1178.
* src/sfnt/ttcolr.c (get_deltas_for_var_index_base): Set outer index to
0 and inner index to the delta index when retrieving deltas if the
`COLR` table has no delta set index map.
2022-09-05 Dominik Röttsches <drott@chromium.org>
[sfnt] Pointer sanity checks before reading layer info in 'COLR' v0
* src/sfnt/ttcolr.c (tt_face_get_colr_layer): Check that the pointer to
read from is within the 'COLR' table.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50633
2022-09-05 Werner Lemberg <wl@gnu.org>
[autofit] Minor fix.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage): Avoid
compiler warning.
2022-09-05 Dominik Röttsches <drott@chromium.org>
[sfnt] Don't require 'gvar' table to support variation fonts.
Fixes #1172.
* src/sfnt/sfobjs.c (sfnt_load_face): Tag font as Multiple Masters font if
`fvar` is present; do not require other tables to be present.
* src/truetype/ttgxvar.c (tt_set_mm_blend): Allow for a missing 'gvar' table
when setting variation coordinates. However, if a 'gvar' table is actually
present, do perform a sanity check and fail on malformedness.
(TT_Get_MM_Var): Don't assume 'fvar' needs 'gvar' or 'CFF2 tables in all
cases, which is an overly tight check.
2022-08-27 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftver.rc: Explicitly use UTF-16.
Fixes #1177 to avoid mistranslation and other problems.
2022-08-26 Dominik Röttsches <drott@chromium.org>
[sfnt] Avoid undefined shifts in `COLR` v1 color line retrieval
* src/sfnt/ttcolr.c (tt_face_get_colorline_stops): Disambiguate shift
behavior by using multiplication using macros from ftcalc.h.
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50573
2022-08-21 Sean Farrell <sean.farrell@rioki.org>
CMakeLists.txt (FT_ENABLE_ERROR_STRINGS): New configuration option.
This option uncomments FreeType configuration macro
`FT_CONFIG_OPTION_ERROR_STRINGS` to make function `FT_Error_String` return
meaningful error strings.
This option is off by default.
2022-08-21 Chris Liddell <chris.liddell@artifex.com>
[base, type1] Better handling of out-of-memory situations.
This follows similar code in `cff_slot_done`.
* src/base/ftobjs.c (ft_glyphslot_done), src/type1/t1objs.c
(T1_GlyphSlot_Done): Check `internal` pointer.
The Type1 problems was reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50057.
2022-08-06 Tim-Philipp Müller <tim@centricular.com>
ci: bump windows image and use newer runner and vs2019
The old 1809 runner will be decommissioned at some point.
2022-08-04 @udoudou <>
* src/cache/ftcmanag.c (FTC_Manager_New): Initialize `cur_weight`.
See !192.
2022-08-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttload.c: Trace formatting updates.
2022-08-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/psaux/psobjs.c (ps_table_release): Remove redundant casting.
2022-08-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftobjs.c (Mac_Read_sfnt_Resource): Reduce casting.
2022-08-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Remove some casts, clean up tracing.
* src/cache/ftcbasic.c (FTC_ImageCache_Lookup, FTC_SBitCache_Lookup):
Clean up tracing types.
* src/cache/ftccache.c (ftc_node_destroy): Ditto.
* src/cache/ftcmanag.c (FTC_Manager_Check): Ditto.
(FTC_Manager_Check, FTC_Node_Unref): Remove a cast.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Ditto.
2022-08-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[autofit] Updated to reduce casting (cont'd).
* src/autofit/afmodule.h (AF_ModuleRec): Change `default_script` type.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Remove casting.
* src/autofit/afmodule.c (af_property_{set,get}): Updated accordingly.
2022-08-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[autofit] Updated to reduce casting.
* src/autofit/afglobal.h (AF_FaceGlobalsRec): Change `glyph_count` type.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage,
af_face_globals_get_metrics, af_face_globals_is_digit,
af_face_globals_new): Changed local types and updated accordingly.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Ditto.
2022-08-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[psaux] Remove unused structure field.
* include/freetype/internal/psaux.h (PS_TableRec): Remove `num_elems`.
* src/psaux/psobjs.c (ps_table_new): Remoove its initialization.
2022-07-30 Dominik Röttsches <drott@chromium.org>
[sfnt] Implement VarClipBox.
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Depending on the
format, read `var_index_base`, then retrieve and apply scaled deltas.
2022-07-30 Dominik Röttsches <drott@chromium.org>
[sfnt] Fix typo in clip box computation.
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Use appropriate
scale factor for `yMin` and `yMax`.
2022-07-30 Alexei Podtelezhnikov <apodtele@gmail.com>
[autofit] Use unsigned accounting for hints.
* src/autofit/afhints.h (AF_AxisHintsRec): Use unsigned types.
* src/autofit/afhints.c (af_axis_hints_new_{segment,edge},
af_glyph_hints_get_num_segments, af_glyph_hints_get_segment_offset):
Updated accordingly.
* src/autofit/aflatin.c (af_cjk_hints_compute_edges): Ditto.
* src/autofit/afcjk.c (af_cjk_hints_compute_edges): Ditto.
2022-07-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/autofit/afhints.h: Remove dead code.
2022-07-29 Werner Lemberg <wl@gnu.org>
* src/base/ftglyph.c (FT_Get_Glyph): Set `*aglyph` to NULL in case of error.
2022-07-29 Werner Lemberg <wl@gnu.org>
Fix compilation if `TT_CONFIG_OPTION_GX_VAR_SUPPORT` is not set.
* src/sfnt/ttcolr.c: Protect relevant code with
`TT_CONFIG_OPTION_GX_VAR_SUPPORT`.
2022-07-29 Werner Lemberg <wl@gnu.org>
Fix clang14 compiler warnings.
* include/freetype/internal/ftstream.h (FT_GET_SHORT_LE, FT_GET_USHORT_LE):
Fix type.
* src/sfnt/ttcolr.c (get_deltas_for_var_index_base): Always return boolean
value.
(tt_face_get_colorline_stops): Fix type of `var_index_base`.
2022-07-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[pfr] Fortify the kerning code.
Any array index must be strictly less then the array size. Therefore,
we must reject indexes that are equal to the array size. Alternatively,
we should move the bounds check before the index decrement but that
would be confusing.
In addition, it is ok to decrement zero (.notdef) and get UINT_MAX,
which is then automatically rejected in the bounds check.
* src/pfr/pfrobjs.c (pfr_face_get_kerning): Fix the bounds checking.
2022-07-26 Werner Lemberg <wl@gnu.org>
[pfr] Add some safety guards.
* src/pfr/pfrload.c (pfr_phy_font_load): Check resolutions and number of
characters.
Fixes #1174.
2022-07-26 Werner Lemberg <wl@gnu.org>
* src/pfr/*.c: Trivial improvements and formatting.
2022-07-24 Werner Lemberg <wl@gnu.org>
* configure: s/egrep/grep -E/
`egrep` is deprecated.
2022-07-23 Ben Wagner <bungeman@chromium.org>
[base] Build outlines in amortized constant time.
When resizing the loader's points and contours, resize them to at least 1.5
times their current size. The code currently only reserves as much space as
is currently required, leading to O(n^2) runtime when adding points one at a
time.
This change does not attempt to ever shrink the loader's point and contour
storage since this was not attempted previously either. The 1.5 multiple
was chosen as a trade-off between potentially unused space and the runtime.
* src/base/ftgloader.c (FT_GlyphLoader_CheckPoints): Implement it.
Fixes #1173.
2022-07-09 Dominik Röttsches <drott@chromium.org>
[sfnt] Support variable 'COLR' v1 `PaintVarSkew*`.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW`,
`FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER`, and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER`.
(read_paint): Handle new enumeration values.
2022-07-09 Dominik Röttsches <drott@chromium.org>
[sfnt] Support variable 'COLR' v1 `PaintVarRotate*`.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE` and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER`.
(read_paint): Handle new enumeration values.
2022-07-09 Dominik Röttsches <drott@chromium.org>
[sfnt] Support 'COLR' v1 variable `PaintVarScale*`.
* src/sfnt/ttcolr.c: (FT_PaintFormatInternal): New enumeration values
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE`,
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER`,
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM`, and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER`.
(read_paint): Handle new enumeration values.
2022-07-09 Dominik Röttsches <drott@chromium.org>
[sfnt] Support for 'COLR' v1 variable translate.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE`.
(read_paint): Handle new enumeration value.
2022-07-09 Dominik Röttsches <drott@chromium.org>
[sfnt] Support for 'COLR' v1 variable transforms.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM`.
(read_paint): Handle new enumeration value.
2022-07-09 Dominik Röttsches <drott@chromium.org>
[sfnt] Deltas for 'COLR' v1 gradient coordinates.
* src/sfnt/ttcolr.c (read_paint) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Read and
apply deltas to radial, linear, and sweep gradient coordinates such as 'p0',
'p1', 'p2', 'center', 'radii', and 'angles'.
2022-07-08 Dominik Röttsches <drott@chromium.org>
[sfnt] Support variable 'COLR' v1 color lines.
* include/freetype/ftcolor.h (FT_ColorStopIterator): Add field
`read_variable` to indicate whether a variation index base should be read.
* src/sfnt/ttcolr.c: (FT_PaintFormat_Internal): New enumerations
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_LINEAR_GRADIENT`
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_RADIAL_GRADIENT`, and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SWEEP_GRADIENT`.
(read_color_line): New parameter `read_variable`; update callers.
(read_paint): Handle new enumerations.
2022-07-07 Dominik Röttsches <drott@chromium.org>
[sfnt] Apply variation deltas to `PaintVarSolid`.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal_): New enumeration
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID`.
(get_deltas_for_var_index_base) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New
function to retrieve an array of delta values, which will be used for most
of 'COLR' v1 variation formats (in follow-up commits).
(read_paint): Add `face` parameter; update caller.
Handle `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID`.
2022-07-07 Dominik Röttsches <drott@chromium.org>
[sfnt] Check safety of cast to `TT_Driver` before accessing member.
* src/sfnt/ttcolr.c (VARIABLE_COLRV1_ENABLED): Access
`enable_variable_colrv1` only if driver class matches.
2022-07-06 Stephen Holdaway <stecman@gmail.com>
doc: Clarify description of `FT_Stream_IoFunc`.
The existing documentation comments on `FT_Stream_IoFunc` hinted at the dual
seek/read behavior required for custom stream implementations to work, but
it didn't explicitly explain it. Without looking at the internals of
FreeType, it was easy for someone to assume their implementation should
handle both seek and read operations all the time. If this is done, you get
a variety of errors, but mostly just `Unknown_File_Format` (error code
0x02).
2022-07-04 Dominik Röttsches <drott@chromium.org>
[sfnt] Load variation store for 'COLR' v1.
* src/sfnt/ttcolr.c: Include `ttobjs.h` temporarily.
(VARIABLE_COLRV1_ENABLED): New temporary macro to detect whether variable
COLRv1 is enabled.
(Colr): New fields `var_store` and `delta_set_idx_map`.
(tt_face_load_colr, tt_face_free_colr) [VARIABLE_COLRV1_ENABLED]: Load and
free variation store data using the functions from the Multiple Masters
service.
2022-07-03 Chris Liddell <chris.liddell@artifex.com>
[base] Improve error handling in `FT_GlyphLoader_CheckPoints`.
If `FT_GlyphLoader_CreateExtra` returns an error (and a couple of other
places), `FT_GlyphLoader_CheckPoints` would propagate the error immediately,
rather than cleaning up the partially set up `FT_GlyphLoader`. As a
consequence, a subsequent attempt to create a glyph could result in a crash.
* src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Ensure all the error
conditions exits are consistent, eventually calling `FT_GlyphLoader_Reset`.
2022-07-03 Thomas Sondergaard <thomas@sondergaard.cc>
CMakeLists.txt: Provide both 'freetype' and 'Freetype::Freetype' targets.
FreeType can be located by consuming projects that use
`find_package(Freetype)` either via the old `MODULE` path (which uses
`FindFreetype.cmake` supplied by CMake), or via the new `CONFIG` path (which
uses `freetype-config.cmake` as supplied by this project). Up to this point
the CMake module has supplied the target `Freetype::Freetype` and the config
file provided by this project the target `freetype`. Now we supply both
`freetype` and `Freetype::Freetype` so that consuming projects can always
use the target `Freetype::Freetype` regardless of what path was taken by
`find_package(Freetype)`.
Fixes #1165.
2022-07-02 Werner Lemberg <wl@gnu.org>
include/freetype/ftmm.h: Improve documentation.
2022-07-01 Dominik Röttsches <drott@chromium.org>
[base] Round values in `FT_MulAdd_Fix`.
This avoids regressing Blink layout tests and makes `FT_MulAdd_Fix` delta
retrieval implementation consistent with the previous implementation, which
used `FT_fixedToInt` and included rounding.
* src/base/ftcalc.c (FT_MulAdd_Fix): Implement it.
Also fix remaining `temp` initialization compilation issue.
Fixes #1169.
2022-07-01 Werner Lemberg <wl@gnu.org>
Minor formatting.
2022-06-30 Dominik Röttsches <drott@chromium.org>
Fix initialisation of temp variable in new FT_MulAddFix
src/truetype/ttgxvar.c (FT_MulAddFix): Initialise `temp`.
2022-06-29 Dominik Röttsches <drott@chromium.org>
[truetype] Perform variation store delta computation with 64-bit precision.
* include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Make type
explicitly 32-bit.
* include/freetype/internal/services/svmm.h
(FT_Var_Get_Item_Delta_Func): Change return type to `FT_ItemVarDelta`
* truetype/ttgxvar.h (tt_var_get_item_delta): Change return type to
`FT_ItemVarDelta`.
* truetype/ttgxvar.c (tt_var_get_item_delta): Store scalars and deltas
to intermediate array, perform computation using new method
`FT_MulAddFix`.
2022-06-29 Dominik Röttsches <drott@chromium.org>
New function `FT_MulAddFix` to compute the sum of fixed-point products.
This function, based on the code of `FT_MulFix`, uses 64-bit precision
internally for intermediate computations.
* include/freetype/internal/ftcalc.h, base/ftcalc.c (FT_MulAddFix):
Implement it.
2022-06-22 Werner Lemberg <wl@gnu.org>
CMakeLists.txt: Move inclusion of `FindPkgConfig` down.
It must come after `CMAKE_TOOLCHAIN_FILE`.
Fixes #1167.
2022-06-22 Dominik Röttsches <drott@chromium.org>
[sfnt] Upgrade stop_offset to FT_Fixed from FT_F2Dot14
2022-06-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* docs/CHANGES: Announce impending Infinality removal.
2022-06-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* ttgload.c (TT_Process_Composite_Glyph): Fix a signedness warning.
2022-06-21 Werner Lemberg <wl@gnu.org>
s/fixed point/fixed-point/
2022-06-21 Werner Lemberg <wl@gnu.org>
.gitlab-ci.yml: Correctly upgrade `meson`.
2022-06-21 Dominik Röttsches <drott@chromium.org>
Proposal: Feature control for variable COLRv1
* include/freetype/ftdriver.h (variable-color-v1 property): Add documentation
for variable-colr-v1 property.
* src/truetype/ttdriver.c (tt_property_set): Ingest variable-control property
when called, set to enable_variable_colrv1 driver flag.
* src/truetype/ttobjs.h (TT_DriverRec): Add enable_variable_colrv1 flag.
2022-06-21 Xavier Claessens <xavier.claessens@collabora.com>
[meson] Disable FreeType in HarfBuzz fallback.
This avoids cyclic subproject configuration when the 'harfbuzz' feature is
enabled, or `--wrap-mode=forcefallback` is used, but HarfBuzz is built as a
subproject. HarfBuzz does the same and disables HarfBuzz support when
configuring FreeType as a subproject.
* meson.build (harfbuzz_dep): Implement it.
* subprojects/harfbuzz.wrap: New file.
* .gitlab-ci.yml [windows meson]: Use latest version of the meson 0.59
series, which has a necessary bug fix to make CI work.
2022-06-19 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Clean up phantom point accounting.
This formalizes that the phantom points appended in the outline
do not increase its point count, nor are they tagged or included
in any additional contours. Only their coordinates are stored.
They are counted in the glyph zone, however.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Infer `n_points`
from the outline size plus four phantom points.
* src/truetype/ttgxvar.h (TT_Vary_Apply_Glyph_Deltas): Remove this
argument.
* src/truetype/ttgload.c (tt_prepare_zone): Add phantom four.
(TT_Process_Simple_Glyph, load_truetype_glyph): Update all callers.
2022-06-19 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype/GX] Clean up phantom point adjustment.
This moves phantom point and advance variation adjustment next to
calculations. The logic stays the same, HVAR and VVAR take priority.
* src/truetype/ttgload.c (load_truetype_glyph): Move it from here...
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here
and check for HVAR and VVAR presence outside the main loop.
2022-06-18 Ben Wagner <bungeman@chromium.org>
[stream] Fix reading s32 when long is s64
`FT_READ_LONG`, `FT_GET_LONG`, and related macros did not return
negative values when `long` is more than 32 bits. `FT_Stream_ReadULong`
would read four bytes into the LSB of an `FT_ULong` and return that.
Since this can never set the MSb of the `FT_ULong` when `FT_ULong` is
more than 32 bits the cast to `FT_Long` never resulted in a negative
value.
Fix this by modifying `FT_Stream_Read*` to return a type of the same
size as the bytes it is reading and changing the `FT_READ_*` and
`FT_GET_*` macros to cast to the same type returned by `FT_Stream_Read*`
but with the correctly signed type (instead of casting to what is
assumed to be the type of `var` which will happen automatically anyway).
There exist a few cases like with the `OFF3` variants where there isn't
generally a type with the correct size. `FT_PEEK_OFF3` works around this
loading the bytes into the three most significant bits and then doing a
signed shift down. `FT_NEXT_OFF3` also already worked correctly by
casting this signed value to another signed type. `FT_Stream_GetUOffset`
works correctly but one must be careful not to attempt to cast the
returned value to a signed type. Fortunately there is only
`FT_GET_UOFF3` and no `FT_GET_OFF3`.
All of these cases are handled correctly when reading values through
`FT_Stream_ReadFields` since it generically computes the signed value
through an `FT_Int32`. This change is essentially doing the same for
these macros.
* include/freetype/internal/ftstream.h (FT_NEXT_*, FT_GET_*, FT_READ*):
Update macros and return types to use fixed size types for fixed size
values.
* src/base/ftstream.c (FT_StreamGet*, FT_StreamRead*): Dito.
Issue: #1161
2022-06-17 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype/GX] Fix an old typo.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Vertical
advance is measured along y-coordinate.
2022-06-16 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype/GX] Clean up advance adjustment (Brrr).
* src/truetype/ttgload.c (load_truetype_glyph): Remove remaining code.
2022-06-16 Ben Wagner <bungeman@chromium.org>
[type1] Directly search for eexec in private dict
This code originally just searched for `eexec`. This was later modified
to check that the `eexec` found is valid (not in a string or comment).
This was done by searching for `eexec` as before and then, for each
`eexec` found, searching from the beginning using the correct parsing to
see if the `eexec` was still found. If the private dictionary is large
and contains many copies of `eexec` which are not valid, the initial
part of the private dictionary is scanned once for each, potentially
leading to n^2 parsing time.
Instead of finding an initial `eexec` and then re-parsing to discover if
it is valid, drop the initial search for `eexec` and just parse to find
a valid `eexec`. This is strictly faster since the validation must
happen anyway and avoids restarting from the beginning each time an
`eexec` is found in the data.
* src/type1/t1parse.c (T1_Get_Private_Dict): avoid n^2 parsing
Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1328883
2022-06-16 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype/GX] Clean up advance adjustment.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph):
Move the advance adjustment from here...
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here and
simplify arguments.
* src/truetype/ttgxvar.h (TT_Vary_Apply_Glyph_Deltas): Update prototype
with fewer arguments.
2022-06-14 Ben Wagner <bungeman@chromium.org>
[gzip] Handle inflate returning Z_NEED_DICT
When `inflate` returns `Z_NEED_DICT` this is currently not reported as
an error and callers may assume that the decompression succeeded when it
did not. In particular, a compressed table in a woff file may not
actually be decompressed and written as expected, leaving the backing
memory for the expanded table uninitialized.
* src/gzlip/ftgzip.c (FT_Gzip_Uncompress): treat `Z_NEED_DICT` as
indicating invalid data since there is no means to provide a dictionary.
Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335712
2022-06-13 Ben Wagner <bungeman@chromium.org>
[woff] Don't allocate table entries until needed
* src/sfnt/sfwoff.c (woff_open_font): delay allocating space for the
table entries until they are actually written out with the data.
2022-06-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/sfwoff2.c (woff2_open_font): Partial revert.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47981.
2022-06-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Cosmetic macro change.
2022-06-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[woff, woff2] Avoid buffer zeroing.
* src/sfnt/sfwoff.c (woff_open_font): Use Q-macros.
* src/sfnt/sfwoff2.c: Ditto.
(reconstruct_font): Allocate table_entry on stack.
2022-06-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Fix GCC LTO crashes on Windows.
Fixes #1164 by using a volatile variable around `setjmp`. It is hard to
say how this fixes crashes related to certain link-time optimizations.
This does not decrease the rendering performance.
* src/smooth/ftgrays.c (gray_convert_glyph_inner): Use volatile `error`.
2022-06-09 bruvzg <@bruvzg>
* src/smooth/ftgrays.c [FT_STATIC_RASTER]: Fix compilation.
2022-06-06 Ben Wagner <bungeman@chromium.org>
[svg] Set linear advances when loading SVG glyphs
* include/freetype/freetype.h (FT_GlyphSlotRec_): update doc
* src/cff/cffgload.c (cff_slot_load): do it
* src/truetype/ttgload.c (TT_Load_Glyph): do it
Fixes: #1156
2022-06-01 Ben Wagner <bungeman@chromium.org>
[svg] Clear correct flags for doc ownership
This issue was discovered with an SVG based font with some documents
compressed and other uncompressed. After loading the first compressed
document the ownership flag on the glyph slot was set to true but never
set to false. As a result after loading a compressed document a glyph
from an uncompressed document would load fine, but when this glyph slot
was cleared it would try to free its document resulting in a wild free.
* src/base/ftobjs.c (ft_glyphslot_clear): clear correct flags
Fixes: #1162
2022-06-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[docs] Correct favicon.
2022-06-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[docs] Use hinted favicon.
2022-05-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[docs] Update favicon.
2022-05-25 Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
* src/sfnt/ttmtx.c (tt_face_get_metrics): Apply variations unconditionally.
This causes a speed-up of approx. 20% for getting advance widths.
2022-05-23 Dominik Röttsches <drott@chromium.org>
[truetype] Support reading 32bit/16bit VarStore deltas
* include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Define type
to be used for delta arrays, upgrade to FT_long.
* src/truetype/ttgxvar.c: Adhere to long_words bit and read either
Short/Byte pairs or Long/Short pairs, as defined by spec. For better
readability, define macro for repetitive read code.
2022-05-20 Dominik Röttsches <drott@chromium.org>
[truetype] Handle 0xFFFF special value inside delta retrieval function
* truetype/ttgxvar.c (tt_hvadvance_adjust, tt_apply_mvar,
tt_var_get_item_delta): Remove special 0xFFFF handling in favor of less
redundant handling inside the tt_var_get_item_delta function, as it is
equivalent to returning a 0 delta. Avoids code-duplication checking for
special value 0xFFFF.
2022-05-19 Dominik Röttsches <drott@chromium.org>
[truetype, snft] Add service methods for `DeltaSetIdxMap` and `VarStore`.
This will be needed for 'COLR' v1 variation support.
* src/truetype/ttgxvar.h (GX_ItemVarData, GX_AxisCoords, GX_VarRegion,
GX_VarItemStore, GX_DeltaSetIdxMap): Move structures to...
* include/freetype/internal/ftmmtypes.h: ... this new file.
* include/freetype/internal/service/svmm.h (MultiMasters): Include
`ftmmtypes.h`.
(FT_Var_Load_Delta_Set_Idx_Map_Func, FT_Var_Load_Item_Var_Store_Func,
FT_Var_Get_Item_Delta_Func, FT_Var_Done_Item_Var_Store_Func,
FT_Var_Done_Delta_Set_Idx_Map_Func): New function typedefs.
(MultiMasters): Add them.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.
* src/cff/cffdrivr.c (cff_load_item_variation_store,
cff_load_delta_set_index_mapping, cff_get_item_delta,
cff_done_item_variation_store, cff_done_delta_set_index_map): New wrapper
methods calling into mm service.
(cff_service_multi_masters): Updated.
* src/truetype/ttgxvar.c (ft_var_load_item_variation_store,
ft_var_load_delta_set_index_mapping, ft_var_get_item_delta,
ft_var_done_item_variation_store, ft_var_done_delta_set_index_map): Renamed
to ...
(tt_var_load_item_variation_store, tt_var_load_delta_set_index_mapping,
tt_var_get_item_delta, tt_var_done_item_variation_store,
tt_var_done_delta_set_index_map): ... this for consistency.
Mark them as non-static.
* src/truetype/ttgxvar.h: Add corresponding prototypes.
* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.
2022-05-19 Dominik Röttsches <drott@chromium.org>
[truetype] Move deallocation of `DeltaSetIdxMap` into own function.
This is a preparation for handling `DeltaSetIdxMap` and `VarStore` as a
FreeType service.
* src/truetype/ttgxvar.c (ft_var_done_delta_set_index_map): New function.
(tt_done_blend): Use it.
2022-05-18 Werner Lemberg <wl@gnu.org>
* builds/toplevel.mk (do-dist): Don't remove meson wrap files.
Fixes #1157.
2022-05-18 Werner Lemberg <wl@gnu.org>
* subprojects/zlib.wrap: Update to zlib version 1.2.12.
2022-05-18 Werner Lemberg <wl@gnu.org>
REAMDE: Mention that gitlab's 'download' button doesn't work.
This is because the `git archive` command doesn't preserve submodules.
Note that currently there is no support for disabling the 'download' button
in gitlab (https://gitlab.com/gitlab-org/gitlab/-/issues/17032).
Fixes issue #1158.
2022-05-11 Werner Lemberg <wl@gnu.org>
[truetype] Handle inner/outer index values 0xFFFF/0xFFFF.
This was introduced in OpenType 1.8.4.
* src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping,
tt_hvadvance_adjust, ft_var_load_mvar, tt_apply_mvar): Handle special
inner/outer index values.
(ft_var_load_item_variation_store): Add test.
Fixes #1154.
2022-05-01 Werner Lemberg <wl@gnu.org>
* Version 2.12.1 released.
==========================
Tag sources with `VER-2-12-1'.
* docs/VERSION.TXT: Add entry for version 2.12.1.
* docs/CHANGES, docs/release: Updated.
* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.12.0/2.12.1/, s/2120/2121/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.
* builds/unix/configure.raw (version_info): Set to 24:3:18.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
2022-04-30 Anuj Verma <anuj@posteo.net>
[sdf] Do not throw errors for invisible glyphs.
* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Return `FT_Err_Ok` if
width or height is zero, since some glyphs do not generate visible bitmaps.
Fixes #1150.
2022-04-30 Werner Lemberg <wl@gnu.org>
* src/sfnt/sfobjs.c (sfnt_load_face): Set `FT_FACE_FLAG_COLOR` for SVG fonts.
Fixes #1151.
2022-04-27 Brendan Shanks <bshanks@codeweavers.com>
autogen.sh: Fix building when freetype is itself a git submodule.
There are situations where .git is not a directory, like when
freetype is a submodule in another repository.
2022-04-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Simplify non-desktop UWP check.
Fixes mingw compilation described in !159.
* builds/windows/ftsystem.c: Do not use WINAPI_FAMILY_PARTITION macro.
2022-04-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Reset IUP flags in `TT_RunIns`.
Fixes #1148 by moving the flag initialization back, partly reverting
7809007a and fd03dcc1. Initializing these flags elsewhere skips 'cvt'.
* src/truetype/ttinterp.c (TT_RunIns): Initialize the IUP flag here...
(TT_Run_Context): ... instead of here.
2022-04-24 Xavier Claessens <xavier.claessens@collabora.com>
[meson] Remove `default_library=both` from `default_options`.
It is inconsistent with what all other Meson projects do.
It also prevents static linking to FreeType when it is a subproject because
`default_options` in a subproject takes precedence on values set on the main
project. For example, building 'GStreamer' with `-Ddefault_library=static`
would still dynamically link on FreeType unless the user also sets
`-Dfreetype2:default_library=static`.
* meson.build: Updated.
* .gitlab-ci.yml: Retain `both` option for testing.
2022-04-19 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Integer overflow.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=46792
2022-04-16 Georg Brandl <georg@python.org>
* src/cff/cffgload.c (cff_slot_load) [FT_CONFIG_OPTION_SVG]: Fix segfault.
This can happen if the function is called with `size` being `NULL`.
Fixes #1147.
2022-04-14 Steve Lhomme <robux4@ycbcr.xyz>
.gitlab-ci.yml: Add a Universal Windows build target
It's compiled for Windows 10 and up, ensuring UNICODE is set (default for UWP)
and selecting the proper WINAPI_FAMILY (WINAPI_FAMILY_APP).
Do not try to run the UWP exe in the Docker as it doesn't work.
2022-04-04 Ben Wagner <bungeman@chromium.org>
[sfnt] Correct FT_ColorStopIterator documentation.
* include/freetype/ftcolor.h (FT_ColorStopIterator): the user should not
set `p` to NULL before calling `FT_Get_Colorline_Stops`. `p` and
`num_color_stops` are set by `FT_Get_Paint`. `p` and
`current_color_stop` are updated by `FT_Get_Colorline_Stops`.
2022-04-01 Werner Lemberg <wl@gnu.org>
* builds/unix/configure.raw: Add option `--with-librsvg`.
Since 'librsvg' is written in Rust, this option allows distributions to
avoid a dependency on the entire Rust toolchain to provide the FreeType demo
programs.
Suggested by Lars Wendler in !156.
2022-04-01 Werner Lemberg <wl@gnu.org>
* src/sfnt/sfwoff.c (reconstruct_glyf): Fix gcc 10 warning.
2022-04-01 Werner Lemberg <wl@gnu.org>
[gzip] Update sources to zlib 1.2.12.
2022-04-01 Eric Jing <@CPUcontrol>
CMakeLists.txt: Fix `Info.plist` path.
When building a framework using CMake with `add_subdirectory`, CMake must be
able to find `freetype-Info.plist` when configuring the framework
properties.
Fixes #1145.
2022-04-01 Werner Lemberg <wl@gnu.org>
Whitespace.
2022-04-01 Ben Wagner <bungeman@chromium.org>
[truetype] Use SUB_LONG for component offset.
* src/truetype/ttgload.c (TT_Process_Composite_Component): do it.
Bug: https://crbug.com/1309429
2022-03-31 Werner Lemberg <wl@gnu.org>
CMakeList.txt: Update code to handle recent changes for `freetype.pc`.
Fixes #1144.
2022-03-31 Werner Lemberg <wl@gnu.org>
CMakeLists.txt: s/PKG_CONFIG/PKGCONFIG/, s/REQUIRED_/REQUIRES_/.
2022-03-31 Werner Lemberg <wl@gnu.org>
* Version 2.12.0 released.
==========================
Tag sources with `VER-2-12-0'.
* docs/VERSION.TXT: Add entry for version 2.12.0.
* docs/CHANGES, docs/release: Updated.
* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.11.1/2.12.0/, s/2111/2120/.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 12.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.raw (version_info): Set to 24:2:18.
* CMakeLists.txt (VERSION_MINOR): Set to 12.
(VERSION_PATCH): Set to 0.
* builds/toplevel.mk (do-dist): Generate `ChangeLog` entries for all commits
since version 2.11.0 (when we stopped creating this file manually).
2022-03-31 Werner Lemberg <wl@gnu.org>
Fix clang++ warnings.
* src/base/ftglyph.c (ft_svg_glyph_prepare), src/base/ftobj.c
(ft_glyphslot_init), src/cache/ftccmap.c (ftc_cmap_node_new),
src/cache/ftcimage.c (FTC_INode_New), src/lzw/ftlzw.c (FT_Stream_OpenLZW),
src/psaux/psobjs.c (ps_parser_load_field), src/pshinter/pshglob.c
(psh_globals_new), src/sfnt/ttsvg.c (tt_face_load_svg_doc): Initialize
variables used for allocation.
* src/sdf/ftsdf.c (split_sdf_conic, split_sdf_cubic): Change type of
`max_splits` to FT_UInt.
(sdf_generate_bounding_box): Add cast.
2022-03-30 Werner Lemberg <wl@gnu.org>
Whitespace.
2022-03-30 Werner Lemberg <wl@gnu.org>
[builds] Fix creation of `freetype2.pc` for static-only builds.
We have to help `pkg-config` since it can't recognize that there is no
shared library installed.
Note that meson already does exactly the same.
* builds/unix/configure.raw (REQUIRES_PRIVATE, LIBS_PRIVATE): Rename to...
(PKGCONFIG_REQUIRES_PRIVATE, PKGCONFIG_LIBS_PRIVATE): This. Adjust them
depending on `$enable_shared`.
(PKGCONFIG_REQUIRES, PKGCONFIG_LIBS): New variables.
* builds/unix/freetype2.in, builds/unix/unix-def.in: Use new and updated
variables.
2022-03-25 Werner Lemberg <wl@gnu.org>
Add `FT_FACE_FLAG_SBIX_OVERLAY` and `FT_HAS_SBIX_OVERLAY`.
* include/freetype/freetype.h (FT_FACE_FLAG_SBIX_OVERLAY,
FT_HAS_SBIX_OVERLAY): New macro.
* src/sfnt/ttsbit.c (tt_face_load_sbit): Handle `FT_FACE_FLAG_SBIX_OVERLAY`.
Remove obsolete tracing message.
2022-03-25 Werner Lemberg <wl@gnu.org>
Add `FT_PARAM_TAG_IGNORE_SBIX`.
This is another bit to handle 'sbix' tables as described in the OpenType
specification.
* include/freetype/ftparams.h (FT_PARAM_TAG_IGNORE_SBIX): New macro.
* src/sfnt/sfobjc.c (is_apple_sbix): Rename to...
(has_sbix): ... this.
Check for more sbit tables.
Handle `FT_PARAM_TAG_IGNORE_SBIX` to eventually control `has_sbix`.
Only call sbit table loader if an sbit table is present.
2022-03-25 Werner Lemberg <wl@gnu.org>
[truetype] Fix 'sbix' table handling.
* src/sfnt/ttsbit.c (tt_face_load_sbix_image): Correct calculation of
'metrics->horiBearingY'.
Set vertical metrics.
* src/sfnt/sfobjs.c (sfnt_load_face): Adjust setting of `FT_FACE_FLAG_SBIX`.
Handle metrics of fonts with 'sbix' table.
* src/truetype/ttgload.c (TT_Load_Glyph): For 'sbix' embedded bitmaps, apply
bbox offset and bearing values of the corresponding glyph in the 'glyf'
table if it exists and has a contour.
* src/truetype/ttobjs.c (tt_face_init): Handle font with 'sbix' table.
Fixes issue #998.
2022-03-25 Werner Lemberg <wl@gnu.org>
Add `FT_FACE_FLAG_SBIX` and `FT_HAS_SBIX`.
Fonts with 'sbix' tables need special handling by the application.
* include/freetype/freetype.h (FT_FACE_FLAG_SBIX, FT_HAS_SBIX): New macros.
* src/sfnt/sfobjs.c (sfnt_load_face): Set `FT_FACE_FLAG_SBIX` if 'sbix'
table is present.
2022-03-25 Werner Lemberg <wl@gnu.org>
* include/freetype/freetype.h (FT_LOAD_SBITS_ONLY): Tag macro as public.
2022-03-24 Carlo Bramini <carlo.bramix@libero.it>
[builds/windows] Fix WCE support.
* builds/windows/ftsystem.c [_WIN32_WCE]: Include <malloc.h> needed by
_alloca.
2022-03-24 Steve Lhomme <robux4@ycbcr.xyz>
[build/windows] Improve UWP support.
* builds/windows/ftsystem.c [UWP]: Wrap CreateFile2 into CreateFileA.
2022-03-21 Werner Lemberg <wl@gnu.org>
* src/sfnt/ttkern.c (tt_face_get_kerning): Exit early if no table.
Fixes #1141.
2022-03-20 Ben Wagner <bungeman@chromium.org>
[woff2] Support overlap flag for simple glyphs.
In the woff2 spec it has been proposed to allow the OVERLAP_SIMPLE flag
to be retained through the woff2 format [0].
[0] https://www.w3.org/TR/WOFF2/#glyf_table_format
* src/sfnt/sfwoff2.h (GLYF_OVERLAP_SIMPLE): add glyf flag.
* src/sfnt/sfwoff2.c (reconstruct_glyf): parse optionFlags and
overlapSimpleBitmap[]. (store_points): set OVERLAP_SIMPLE on first point's
flag if the overlap bit is set.
2022-03-19 Werner Lemberg <wl@gnu.org>
[cff] Synchronize `cff_slot_load` with `TT_Load_Glyph`.
* src/cff/cffgload.c (IS_DEFAULT_INSTANCE): New macro.
(cff_slot_load): Use it.
2022-03-19 Werner Lemberg <wl@gnu.org>
* src/base/ftobjs.c (FT_Request_Size): Guard `face->size`.
Fixes #1140.
2022-03-19 Werner Lemberg <wl@gnu.org>
* src/base/ftobjs.c (ft_open_face_internal): Thinko.
2022-03-19 Ben Wagner <bungeman@chromium.org>
[doc] FT_OUTLINE_OVERLAP was introduced in 2.10.3.
* include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): Document when added.
2022-03-19 Werner Lemberg <wl@gnu.org>
* src/base/ftobjs.c (ft_open_face_internal): Properly guard `face_index`.
We must ensure that the cast to `FT_Int` doesn't change the sign.
Fixes #1139.
2022-03-17 Werner Lemberg <wl@gnu.org>
[sfnt] Avoid invalid face index.
Fixes #1138.
* src/sfnt/sfobjs.c (sfnt_init_face), src/sfnt/sfwoff2.c (woff2_open_font):
Check `face_index` before decrementing.
2022-03-07 Werner Lemberg <wl@gnu.org>
Documentation, whitespace.
2022-03-05 Anuj Verma <anuj@womp.xyz>
[sdf] Fix corner checks and improve performance.
* src/sdf/ftsdf.c (sdf_generate_bounding_box): Always check for a corner if
two distances (for different curves) are very close.
(sdf_conic_to): Check whether the conic curve can be treated as a line
(which happens if the control point coincides with any end point).
2022-03-05 Anuj Verma <anuj@womp.xyz>
[sdf] Implement deviation-based splitting for Bezier curves.
* src/sdf/ftsdf.c (split_sdf_cubic, split_sdf_shape): Add checks to figure
out the deviation of Bezier curves and stop splitting if the curve is flat
enough.
* src/sdf/ftsdfcommon.h (ONE_PIXEL): New macro.
2022-03-05 Anuj Verma <anuj@womp.xyz>
* include/freetype/freetype.h: Improve SDF documentation.
2022-03-03 Ben Wagner <bungeman@chromium.org>
[sfnt] Fix bounds check in SVG.
The `SVG_DOCUMENT_LIST_MINIMUM_SIZE` macro is non trivial and not
protected by parentheses. As a result, the expression
`table_size - SVG_DOCUMENT_LIST_MINIMUM_SIZE` expands to
`table_size - 2U + SVG_DOCUMENT_RECORD_SIZE` instead of the expected
`table_size - (2U + SVG_DOCUMENT_RECORD_SIZE)`. This causes an incorrect
bounds check which may lead to reading past the end of the `SVG ` table.
* src/sfnt/ttsvg.c (tt_face_load_svg): wrap macro definitions in
parentheses.
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=45179
2022-02-23 Ben Wagner <bungeman@chromium.org>
[psaux] Full bounds check for OtherSubr 19.
It is possible for OtherSubr 19 to be invoked when `decoder->buildchar` is
NULL (so that `decoder->len_buildchar` is 0), the `blend` is non-NULL with
`blend->num_designs` set to 2, and the user supplied `idx` to be large (for
example 0xFFFFFFFE). Since these are all `FT_UInt32` the existing bounds
check overflows in a well defined manner, allowing for an invalid call to
`memcpy`.
In addition, it is possible to call OtherSubr 19 with
`decoder->len_buildchar`, `blend->num_designs`, and `idx` all zero (implying
that `blend->weight_vector` and `decoder->buildchar` are NULL). This passes
the bounds check (it is logically always fine to copy nothing starting at
index zero) but may invoke undefined behavior in `ft_memcpy` if it is backed
by `memcpy`. Calling `memcpy` with either the `src` or `dst` NULL is
undefined behavior (even if `count` is zero).
* src/psaux/psintrp.c (cf2_interpT2CharString): Correctly check that
`blend->num_designs` can be copied to `decoder->buildchar[idx]`.
Also avoid passing NULL to `ft_memcpy`.
Bug: https://crbug.com/1299259
2022-02-21 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[cmake] Drop the support of CMake 2.x.
* CMakeLists.txt: Require CMake 3.0 (released on 2014) or newer.
The issue #1059 reports the difficulty to support both of
CMake 2.x and newer one by single CMakeLists.txt without
the inflation of cmake_policy() workarounds.
For better maintainability, the support of CMake 2.x is
dropped.
2022-02-19 Werner Lemberg <wl@gnu.org>
* src/bdf/README: Updated.
2022-02-19 Werner Lemberg <wl@gnu.org>
* builds/mac/ftmac.c, src/base/ftmac.c: s|FT_MAC_H|<freetype/ftmac.h>|.
2022-02-19 Werner Lemberg <wl@gnu.org>
src/sfnt/ttkern.c (tt_face_load_kern): Micro-optimize.
A kerning table can be handled by binary search if it has equal entries.
Fixes #1132.
2022-02-17 Steve Lhomme <robux4@ycbcr.xyz>
Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Add support for legacy UWP builds.
* builds/windows/ftsystem.c: Add neccessary macro substitutions to
enable strict UWP builds.
See !141.
2022-02-16 Werner Lemberg <wl@gnu.org>
ftmm.h: Minor documentation improvement.
2022-02-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Tune PSH_STRONG_THRESHOLD_MAXIMUM value.
Before the change, the hinting engine frequently confused horizontal
stem and serif hints making some stems too thin and some serifs too
thick. The value was tuned using serif fonts from the URW+ base 35
collection.
* src/pshinter/pshalgo.c [PSH_STRONG_THRESHOLD_MAXIMUM]: s/30/12/.
2022-02-12 Werner Lemberg <wl@gnu.org>
t1tables.h: Documentation improvements.
2022-02-12 Werner Lemberg <wl@gnu.org>
t1tables.h: Whitespace.
2022-02-11 Werner Lemberg <wl@gnu.org>
[type42] Fix `FT_Get_PS_Font_Private` for this format.
Since Type42 fonts don't have a 'Private' dictionary, the return value
should be `FT_Err_Invalid_Argument`.
* src/type42/t42drivr.c (t42_ps_get_font_private): Removed.
(t42_service_ps_info): Updated.
2022-02-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Clear reused mask.
In PS hinter, memory allocations persist until the module is done.
Therefore, we have to clear reused masks.
* src/pshinter/pshrec.c (ps_mask_table_alloc): Clear reused mask.
2022-02-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Use unsigned indices.
This reduces casting and eliminates some checks.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_table_merge,
ps_dimension_add_t1stem, ps_hints_t1stem3): Updated.
(ps_dimension_add_counter): Updated, unnecessary checks removed.
2022-02-08 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Fix mask merging.
We forgot to update the number of bits when merging a larger mask
into a smaller one. This fix might have rendering effects.
* src/pshinter/pshrec.c (ps_mask_table_merge): Inherit the number
of bits from a larger mask. There is no need to zero unused bits,
already zeroed during allocation.
(ps_mask_clear_bit): Removed.
(ps_mask_ensure): Minor.
2022-02-08 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Revise the hint table handling.
* src/pshinter/pshrec.c (ps_hint_table_ensure): Remove redundant size
check; avoid array zeroing because it is fully initialized when used.
(ps_hint_table_alloc): Fix off-by-one comparison and remove another
zeroing of the array elements.
2022-02-06 Werner Lemberg <wl@gnu.org>
Various minor doc fixes.
2022-02-06 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Add SVG to to project files.
* builds/windows/vc2010/freetype.vcxproj: Updated.
* builds/windows/vc2010/freetype.vcxproj.filters: Updated.
* builds/windows/visualc/freetype.vcproj: Updated.
2022-02-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/winfonts/winfnt.c (fnt_face_get_dll_font): Trace font resources.
2022-02-02 Eric Jing <@CPUcontrol>
[cmake] Fix build on MacOS.
* CMakeLists.txt (CMAKE_OSX_ARCHITECTURES): Update value to fix the building
of a framework on MacOS.
* builds/mac/freetype-Info.plist (CFBundleExecutable): Make identifier
lowercase only.
Fixes #1127.
2022-02-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[psaux] Revise `PS_Table` handling.
The old impleemntation was not using `FT_REALLOC`, buing too careful
with the offset rebasing. It shoudl be safe to rely on the base
movements.
* src/psaux/psobjs.c (reallocate_t1_table, shift_elements): Combine
into...
(ps_table_realloc): ... this function based on `FT_REALLOC`.
(ps_table_done): Simplified.
(ps_table_add): Updated.
2022-02-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcmru.c (FTC_MruList_New): Explain zeroing.
2022-01-31 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Partially revert 9870b6c07e2c.
Fix crashes reported by Werner.
* src/cache/ftcmru.c (FTC_MruList_New): Use `FT_ALLOC` again.
2022-01-31 Werner Lemberg <wl@gnu.org>
freetype.h: Minor documentation improvement.
2022-01-31 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Fix fallouts from edd4fedc5427.
Reported by Werner.
* src/cache/ftcimage.c (FTC_INode_New): Always initialize FT_Glyph.
* src/cache/ftcsbits.c (FTC_SNode_New): Always initialize FT_SBit.
2022-01-31 Alexei Podtelezhnikov <apodtele@gmail.com>
Clean-up - do not doubt FT_FREE.
* src/base/ftobjs.c (memory_stream_close): Do not reassign zero
after `FT_FREE`.
* src/sfnt/sfwoff.c (sfnt_stream_close): Ditto.
* src/sfnt/sfwoff2.c (stream_close): Ditto.
* src/psaux/psobjs.c (ps_parser_load_field): Ditto.
* src/truetype/ttgxvar.c (ft_var_load_avar, tt_set_mm_blend,
tt_set_mm_blend): Ditto.
2022-01-30 Werner Lemberg <wl@gnu.org>
* CMakeLists.txt: Include 'FindPkgConfig' module.
Older cmake versions don't provide `pkg_check_modules` by default.
Fixes #1126.
2022-01-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/psaux/psobjs.c (ps_parser_load_field): Reduce `string` scope.
2022-01-29 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[cmake] Check the availability of `bzip2.pc'.
(CMakeLists.txt): Check the availability of `bzip2.pc'.
* If `bzip2.pc' is available, Requires.private should include
bzip2, but Libs.private should not include -lbz2.
* If `bzip2.pc' is unavailable, Requires.private cannot include
bzip2, but Libs.private should include -lbz2.
Fix #897.
2022-01-28 Werner Lemberg <wl@gnu.org>
* unix/configure.raw: We need 'librsvg' version 2.46.0 or newer.
Older versions don't have function `rsvg_handle_get_intrinsic_dimensions`.
2022-01-28 Alexei Podtelezhnikov <apodtele@gmail.com>
Minor clean-ups.
* src/base/ftrfork.c (raccess_make_file_name): Do not set error.
* src/sfnt/sfdriver.c (get_win_string, get_apple_string): Ditto.
* src/cff/cffobjs.c (cff_strcpy): Do not confuse about error.
* src/psaux/psobjs.c (ps_table_done): Ditto.
* src/truetype/ttgxvar.c (ft_var_readpacked*, ft_var_load_avar): Ditto.
2022-01-27 Ben Wagner <bungeman@chromium.org>
Document `FT_Outline_Decompose` degenerate segments.
`FT_Outline_Decompose` does not filter out and can return degenerate
segments in an outline. This can be surprising when attemping to
stroke such an outline. Clarify the existing documentation on this
matter to cover all forms of degeneracy (without specifying exactly
how they will be reported), why they might arise, and better explain in
what cases they may be an issue.
* include/freetype/ftoutlin.h (FT_Outline_Decompose): update
documentation.
Fixes #952.
2022-01-27 Anuj Verma <anujv@posteo.net>
Fix sdf computation while `USE_SQUARED_DISTANCES`.
Function `map_fixed_to_sdf` expects spread to be absolute
and not squared.
* src/sdf/ftbsdf.c (finalize_sdf): Pass absolute spread
while `map_fixed_to_sdf`.
* src/sdf/ftsdf.c (sdf_generate_bounding_box): Ditto.
2022-01-27 Tapish Ojha <tapishojha2000@gmail.com>
[sfnt] Improve sRGB constants.
* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use slightly
more precise values.
Fixes #1018.
2022-01-27 Werner Lemberg <wl@gnu.org>
docs/release: Updated.
2022-01-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pfr/pfrload.c (pfr_phy_font_load): Use FT_QNEW_ARRAY.
2022-01-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sdf/ftsdf.c (sdf_*_new): Use standard macro.
2022-01-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[pcf] Delay encoding allocation and avoid its zeroing.
* src/pcf/pcfread.c (pcf_get_encodings): Refactor and use FT_QNEW_ARRAY.
2022-01-25 Werner Lemberg <wl@gnu.org>
Aarg, typo.
2022-01-25 Werner Lemberg <wl@gnu.org>
freetype.h: More updates to `FT_LOAD_COLOR` description.
2022-01-25 Werner Lemberg <wl@gnu.org>
* builds/unix/configure.raw (FT_DEMO_CFLAGS): Pass `-DHAVE-LIBRSVG`.
This helps in decoupling library support from `pkg-config` for other
platforms.
2022-01-25 Werner Lemberg <wl@gnu.org>
Update documentation for `FT_LOAD_COLOR`.
2022-01-24 Ben Wagner <bungeman@chromium.org>
[pshinter] Ensure all point flags are initialized.
Only off curve point flags were fully initialized.
* src/pshinter/pshalgo.c (psh_glyph_init): always initialize flags.
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43930
2022-01-24 Werner Lemberg <wl@gnu.org>
.mailmap: Typo.
2022-01-23 Werner Lemberg <wl@gnu.org>
* src/svg/ftsvg.c (ft_svg_property_set): Disallow NULL pointers.
2022-01-23 Werner Lemberg <wl@gnu.org>
.mailmap: Updated.
2022-01-23 Werner Lemberg <wl@gnu.org>
More documentation on handling OT-SVG.
2022-01-23 Werner Lemberg <wl@gnu.org>
* src/svg/ftsvg.c: Rename `svg_hooks` to `svg-hooks` for consistency.
2022-01-22 Werner Lemberg <wl@gnu.org>
[sfnt] Reject malformed SVG tables.
* src/sfnt/ttsvg.c (SVG_TABLE_HEADER_SIZE, SVG_DOCUMENT_RECORD_SIZE,
SVG_DOCUMENT_LIST_MINIMUM_SIZE, SVG_MINIMUM_SIZE): New macros.
(tt_face_load_svg): Check offsets.
Check table and record sizes.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43918
2022-01-22 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/psaux/psobjs.c (ps_table_new): Revert to zeroing.
2022-01-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[psaux, type1, type42] Avoid annecessary zeroing.
* src/psaux/psobjs.c (ps_table_new): Use FT_QNEW_ARRAY.
* src/type1/t1load.c (parse_encoding): Ditto.
* src/type42/t42parse.c (t42_parse_encoding): Ditto.
2022-01-20 Werner Lemberg <wl@gnu.org>
[builds/unix] Handle 'librsvg' for demo programs.
* builds/unix/configure.raw: Check for 'librsvg'.
(LIB_CLOCK_GETTIME): Don't call `AC_SUBST` on this but on...
(FT_DEMO_CFLAGS, FT_DEMO_LDFLAGS): ... these two new variables.
* builds/unix/unix-cc.in (LIB_CLOCK_GETTIME): Replaced by...
(FT_DEMO_CFLAGS, FT_DEMO_LDFLAGS): ... these two new variables.
2022-01-20 Moazin Khatti <moazinkhatri@gmail.com>
Add 'svg' module for OT-SVG rendering.
* CMakeLists.txt (BASE_SRCS): Add svg module file.
* meson.build (ft2_public_headers): Add `otsvg.h`.
* modules.cfg (RASTER_MODULES): Add `svg` module.
* builds/meson/parse_modules_cfg.py: Add svg module.
* include/freetype/config/ftmodule.h: Add `ft_svg_renderer_class`.
* include/freetype/fterrdef.h: Add `Invalid_SVG_Document` and
`Missing_SVG_Hooks` error codes.
* include/freetype/internal/fttrace.h: Add tracing for `otsvg`.
* include/freetype/internal/svginterface.h: New file. It adds an interface
to enable the presetting hook from the `base` module.
* include/freetype/otsvg.h (SVG_Lib_Init_Func, SVG_Lib_Free_Func,
SVG_Lib_Render_Func, SVG_Lib_Preset_Slot_Func): New hooks for SVG rendering.
(SVG_RendererHooks): New structure to access them.
* src/base/ftobjs.c: Include `svginterface.h`.
(ft_glyphslot_preset_bitmap): Add code for presetting the slot for SVG
glyphs.
(ft_add_renderer): Updated.
* src/svg/*: New files.
2022-01-20 Moazin Khatti <moazinkhatri@gmail.com>
Add `FT_Glyph` support for OT-SVG glyphs.
* include/freetype/ftglyph.h (FT_SvgGlyphRec, FT_SvgGlyph): New structure.
* src/base/ftglyph.c: Include `otsvg.h`.
(ft_svg_glyph_init, ft_svg_glyph_done, ft_svg_glyph_copy,
ft_svg_glyph_transform, ft_svg_glyph_prepare): New function.
(ft_svg_glyph_class): New class.
(FT_New_Glyph, FT_Glyph_To_Bitmap): Updated to handle OT-SVG glyphs.
* src/base/ftglyph.h: Updated.
2022-01-20 Moazin Khatti <moazinkhatri@gmail.com>
[truetype, cff] Add code to load SVG document.
* src/cff/cffgload.c (cff_slot_load): Add code to load SVG doc.
* src/truetype/ttgload.c (TT_Load_Glyph): Add code to load SVG doc.
2022-01-20 Moazin Khatti <moazinkhatri@gmail.com>
Add code to load OT-SVG glyph documents.
* include/freetype/config/ftheader.h (FT_OTSVG_H): New macro.
* include/freetype/freetype.h (FT_FACE_FLAG_SVG, FT_HAS_SVG): New macros.
(FT_LOAD_SVG_ONLY): New internal macro.
* include/freetype/ftimage.h (FT_Glyph_Format): New enumeration value
`FT_GLYPH_FORMAT_SVG`.
* include/freetype/internal/ftobjs.h (FT_GLYPH_OWN_GZIP_SVG): New macro.
* include/freetype/internal/fttrace.h: Add `ttsvg` for `ttsvg.c`.
* include/freetype/internal/sfnt.h(load_svg, free_svg, load_svg_doc): New
functions.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add `svg` for
the SVG table.
* include/freetype/otsvg.h (FT_SVG_DocumentRec): New structure to hold the
SVG document and other necessary information of an OT-SVG glyph in a glyph
slot.
* include/freetype/tttags.h (TTAG_SVG): New macro.
* src/base/ftobjs.c: Include `otsvg.h`.
(ft_glyphslot_init): Allocate `FT_SVG_DocumentRec` in `slot->other`
if the SVG table exists.
(ft_glyphslot_clear): Free it upon clean-up if it is a GZIP compressed
glyph.
(ft_glyphslot_done): Free the document data if it is a GZIP compressed
glyph.
(FT_Load_Glyph): Don't auto-hint SVG documents.
* src/cache/ftcbasic.c (ftc_basic_family_load_glyph): Add support for
FT_GLYPH_FORMAT_SVG.
* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttsvg.c`.
* src/sfnt/sfdriver.c: Include `ttsvg.h`.
(sfnt_interface): Add `tt_face_load_svg`, `tt_face_free_svg` and
`tt_face_load_svg_doc`.
* src/sfnt/sfnt.c: Include `ttsvg.c`.
* src/sfnt/sfobjs.c (sfnt_load_face, sfnt_done_face): Add code to load and
free data of the the SVG table.
* src/sfnt/ttsvg.c: New file, implementing `tt_face_load_svg`,
`tt_face_free_svg` and `tt_face_load_svg_doc`.
* src/sfnt/ttsvg.h: Declarations of the SVG functions in
`ttsvg.c`.
2022-01-20 Moazin Khatti <moazinkhatri@gmail.com>
Add flag `FT_CONFIG_OPTION_SVG`.
This flag is going to be used to conditionally compile support for OT-SVG
glyphs. FreeType will do the parsing and rely on external hooks for
rendering of OT-SVG glyphs.
* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_SVG): New flag.
2022-01-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Avoid unnecessary zeroing.
* src/pshinter/pshalgo.c (psh_hint_table_init,psh_glyph_init,
psh_glyph_interpolate_normal_points): Use FT_QNEW_ARRAY.
2022-01-20 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/freetype.h: Clarify `FT_Size` life cycle.
2022-01-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Undefined scale means no scale.
It might be surprising that FreeType does not have default ppem and
the size has to be set explicitly or face undefined behavior with
undefined variables and errors. This offers an alternative to
missing or zero scale by simply setting FT_LOAD_NO_SCALE. Defined
behavior is bettr than undefined one.
This is alternative to !132 and discussed in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43708
* src/base/ftobjs.c (FT_Load_Glyph): Deal with zero scale.
* include/freetype/freetype.h: Document it.
2022-01-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/autofit/afglobal.c (af_face_globals_new): Reduce zeroing.
Everything in AF_FaceGlobals is initialized except metrics. Those
are zeroed here and initialized on demand later.
2022-01-16 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf,type1] Avoid unnecessary hash zeroing.
* src/bdf/bdflib.c (_bdf_parse_start): Use `FT_QALLOC`.
* src/type1/t1load.c (parse_subrs): Use `FT_QNEW`.
2022-01-16 Ozkan Sezer <sezeroz@gmail.com>
Add Watcom C/C++ calling.
In the unlikely case the source is built with OpenWatcom's -ec?
switches to enforce a calling convention, the qsort() compare
function must still be set to __watcall.
* include/freetype/internal/compiler-macros.h (FT_COMPARE_DEF):
Updated.
2022-01-15 Ben Wagner <bungeman@chromium.org>
[pshinter] Avoid accessing uninitialized zone.
The `normal_top.count` may be 0, implying no `normal_top.zones` exist.
The code must not access these (non-existent) `normal_top.zones`.
* src/pshinter/pshalgo.c (ps_hints_apply): Do not assume that
`normal_top.zones[0]` is initialized. Test `normal_top.count`
before using `normal_top.zones[0]`. Do not rescale if there are no
`zones`.
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43675
2022-01-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Avoid unnecessary zeroing.
* src/cache/ftccmap.c (ftc_cmap_node_new): Use `FT_QNEW`.
* src/cache/ftcimage.c (FTC_INode_New): Ditto.
* src/cache/ftcsbits.c (FTC_SNode_New): Ditto.
2022-01-15 Ozkan Sezer <sezeroz@gmail.com>
Add Watcom C/C++ support.
* include/freetype/config/integer-types.h: Make sure `long long` is
used then available.
* include/freetype/internal/ftcalc.h (FT_MSB): Add Watcom C/C++ pragma.
2022-01-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sdf/ftbsdf.c (ED): s/near/prox/.
This works around the Watcom C definition of `near` as restricted
__near.
2022-01-15 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/internal/compiler-macros.h [FT_COMPARE_DEF]: Tighten.
This works around Watcom C library using __watcall.
2022-01-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pshinter/pshglob.c (psh_globals_new): Avoid zeroing.
This large allocation is followed by careful initialization. Whatever
is missed should be initialized manually.
2022-01-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/fthash.c (hash_insert): Avoid unnecessary zeroing.
2022-01-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (_bdf_parse_glyphs): Remove redundant assignment.
2022-01-13 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/lzw/ftlzw.c (FT_Stream_OpenLZW): Avoid unnecessary zeroing.
2022-01-13 Ben Wagner <bungeman@chromium.org>
[bzip2] Reset bzip stream on any error.
According to the bzip documentation it is undefined what will happen if
`BZ2_bzDecompress` is called on a `bz_stream` it has previously returned an
error against. If `BZ2_bzDecompress` returns anything other than `BZ_OK`
the only valid next action is `BZ2_bzDecompressEnd`.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43564
* src/bzip2/ftbzip2.c (FT_BZip2FileRec_): Add `reset` to track the need to
reset the stream.
(ft_bzip2_file_init): Initialize `reset` to 0.
(ft_bzip2_file_reset): Set `reset` to 0 after resetting.
(ft_bzip2_file_fill_output): Set `reset` to 1 when `BZ2_bzDecompress`
returns anything other than `BZ_OK`.
2022-01-12 Werner Lemberg <wl@gnu.org>
.gitlab-ci.yml: Minor comment cleanups.
2022-01-12 Azamat H. Hackimov <azamat.hackimov@gmail.com>
.gitlab-ci.yml: Add steps to `before_script` to ensure recent CA.
Fetch current list of valid CAs from Windows Update and manually import them
to trusted datastore. This action is required to make downloads work from
sites that need recent Let's Encrypt ISRG Root X1 certificate.
2022-01-11 Ben Wagner <bungeman@chromium.org>
Revert "[bzip2] Avoid use of uninitialized memory."
This reverts commit d276bcb7f0c02c20d3585b2e5626702df6d140a6.
The original commit did avoid the use of uninitialized memory. However,
it appears that the original commit is no longer required. The
underlying issue was resolved by a change in freetype2-testing "Build
bzip2 correctly." [0]. Prior to [0] bzip2 was built without msan, so
bzip2 writes were not tracked or considered initialized. Clearing
`buffer` in the original commit allowed msan to see the `buffer` content
initialized once in FreeType code, but msan saw no writes into buffer
from bzip2. With bzip2 now built with msan, the bzip2 writes are
properly instrumented and msan sees the bzip2 writes into the buffer. As
a result the original commit can be safely reverted to allow for better
detection of other uninitialized data scenarios.
* src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Revert to using `FT_QNEW`.
[0] https://github.com/freetype/freetype2-testing/commit/3c052a837a3c960709227a0d6ddd256e87b88853
2022-01-11 Ben Wagner <bungeman@chromium.org>
[type42] Track how much type42 ttf data is available.
Currently `T42_Open_Face` eagerly allocates 12 bytes for the ttf header
data which it expects `t42_parse_sfnts` to fill out from /sfnts data.
However, there is no guarantee that `t42_parse_sfnts` will actually be
called while parsing the type42 data as the /sfnts array may be missing
or very short. This is also confusing behavior as it means
`T42_Open_Face` is tightly coupled to the implementation of the very
distant `t42_parse_sfnts` code which requires at least 12 bytes to
already be reserved in `face->ttf_data`.
`t42_parse_sfnts` itself eagerly updates `face->ttf_size` to track how
much space is reserved for ttf data instead of traking how much data has
actually been written into `face->ttf_data`. It will also act strangely
in the presense of multiple /sfnts arrays.
* src/type42/t42objs.c (T42_Open_Face): ensure `ttf_data` is initialized
to NULL. Free `ttf_data` on error.
* src/type42/t42parse.c (t42_parse_sfnts): delay setting `ttf_size` and
set it to the actual number of bytes read. Ensure `ttf_data` is freed
if there are multiple /sfnts arrays or there are any errors.
2022-01-11 Dominik Röttsches <drott@chromium.org>
[sfnt] Fix limit checks for `COLR` v1 ClipBoxes
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Fix off-by-one in
limit checks.
2022-01-11 Werner Lemberg <wl@gnu.org>
Update all copyright notices.
2022-01-11 Werner Lemberg <wl@gnu.org>
* src/sfnt/ttcolr.c (read_paint): Fix undefined left-shift operation.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43151
2022-01-11 Werner Lemberg <wl@gnu.org>
* src/type42/t42objs.c (T42_Open_Face): Avoid use of uninitialized memory.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43508
2022-01-11 Werner Lemberg <wl@gnu.org>
.gitlab-ci.yml: Fix typo in previous commit.
2022-01-11 Werner Lemberg <wl@gnu.org>
.gitlab-ci.yml: Update Windows image.
The old image produced errors like
```
Downloading zlib patch from
https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch
A fallback URL could be specified using patch_fallback_url key in the wrap file
WrapDB connection failed to
https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch
with error
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
failed: certificate has expired (_ssl.c:1122)>
```
2022-01-11 Werner Lemberg <wl@gnu.org>
* subprojects/zlib.wrap: Update from upstream.
2022-01-10 Werner Lemberg <wl@gnu.org>
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Add limit checks.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40716
2022-01-10 Werner Lemberg <wl@gnu.org>
[zlib] Don't typedef `ptrdiff_t`.
While using zlib in 'solo' mode (via the `Z_SOLO` macro), we actually
include some standard header files, making the typedef fail on systems where
the native `ptrdiff_t` type differs.
Fixes #1124.
* src/zlib/zutil.h: Comment out definition; it doesn't work on Windows.
* src/zlib/patches/freetype-zlib.diff: Updated.
2022-01-10 Werner Lemberg <wl@gnu.org>
[zlib] Some organizational changes.
We now first apply zlib's `zlib2ansi` script, then FreeType's patch file.
* src/gzip/README.freetype: Updated.
* patches/0001-zlib-Fix-zlib-sources-to-compile-for-FreeType.patch: Renamed
to...
* patches/freetype-zlib.diff: This.
Clean up description, then regenerate it as follows:
- Copy unmodified files from `zlib` repository.
- Run `zlib2ansi` script.
- Run `git diff -R > patches/freetype-zlib.diff.new`.
- Insert patch description of old diff file, then replace old diff with
new diff file.
2022-01-09 David Turner <david@freetype.org>
[gzip] Update sources to zlib 1.2.11
This can be tested by building with the Unix development build
make setup devel
make
or by building the freetype-demos programs with
meson setup build -Dfreetype2:zlib=internal
meson compile -C out
and trying to run `ftview` with a `.pcf.gz` font file.
* src/gzip/ftgzip.c, src/gzip/rules.mk: Update for new zlib sources. Also
remove the temporary fix introduced in commit 6a431038 to work around the
fact that the internal sources were too old.
* src/gzip/README.freetype: New file describing the origin of the sources
and how they were modified.
* src/gzip/patches/*: Patch files applied to original sources.
* src/gzip/*: Updated zlib sources with the patch file(s) from
`src/gzip/patches/` applied, followed by a conversion with zlib's
`zlib2ansi` script.
2022-01-09 David Turner <david@freetype.org>
[meson] Change Zlib configuration option.
* meson_options.txt, meson.build: Change the format of the 'zlib' meson
build configuration option to be a combo with the following choices:
- none: Do not support gzip-compressed streams at all.
- internal: Support gzip-compressed streams using the copy of the gzip
sources under `src/gzip/`; this should only be used during development
to ensure these work properly.
- external: Support gzip-compressed streams using the 'zlib' Meson
subproject, linked as a static library.
- system: Support gzip-compressed streams using a system-installed version
of zlib.
- auto: Support gzip-compressed streams using a system-installed version
of zlib, if available, or using the 'zlib' subproject otherwise. This
is the default.
- disabled: Backward-compatible alias for 'none'.
- enabled: Backward-compatible alias for 'auto'.
2022-01-09 Werner Lemberg <wl@gnu.org>
[bzip2] Avoid use of uninitialized memory.
* src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Don't use `FT_QNEW` but
`FT_NEW` for setting up `zip` to avoid uninitialized memory access while
handling malformed PCF fonts later on.
Fixes
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42800
2022-01-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Fix off-by-one error.
The 0-base index is equal to the number of previosly parsed entries.
It is an error to adjust it by one to get the number truncated by
a stream error. This is probably inconsequential because valid
entries are correctly accounted for.
* src/sfnt/ttload.c (check_table_dir): Do not adjust the truncated
number of tables.
2022-01-08 Werner Lemberg <wl@gnu.org>
[sfnt, type42] Correct previous commit.
Really fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42773.
* src/sfnt/ttload.c (check_table_dir): Revert change.
* src/type42/t42.parse.c (t42_parse_sfnts): Don't use `FT_QREALLOC` but
`FT_REALLOC` for setting up `ttf_data` to avoid uninitialized memory access
while handling malformed TrueType fonts later on.
2022-01-07 Werner Lemberg <wl@gnu.org>
* src/sfnt/ttload.c (check_table_dir): Initialize `table`.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42773
2022-01-07 Werner Lemberg <wl@gnu.org>
[sfnt] Avoid 'runtime error: applying zero offset to null pointer'.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_byte_aligned): Exit early if
`line` is NULL.
2022-01-07 Werner Lemberg <wl@gnu.org>
[autofit, pshinter] Use `FT_OFFSET`.
This avoids
```
runtime error: applying zero offset to null pointer
```
warnings of clang's undefined behaviour sanitizer.
* src/autofit/afcjk.c (af_cjk_hints_link_segments,
af_cjk_hints_compute_edges, af_cjk_hints_compute_blue_edges,
af_cjk_hint_edges, af_cjk_align_edge_points): Do it.
* src/autofit/afhints.c (af_glyph_hints_align_edge_points,
af_glyph_hints_align_strong_points): Ditto.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_hints_link_segments, af_latin_hints_compute_edges,
af_latin_hints_compute_blue_edges, af_latin_hint_edges): Ditto.
* src/pshinter/pshalgo.c (psh_hint_table_init): Ditto.
2022-01-06 Ben Wagner <bungeman@chromium.org>
[truetype] Reset localpoints when varying cvt.
When iterating over the cvt tuples and reading in the points it is necessary
to set all of `localpoints`, `points`, and `point_count` in all cases. The
existing code did not reset `localpoints` to `NULL` when there were no
private point numbers. If the previous tuple did have private point numbers
and set `localpoints` to `ALL_POINTS` this would not be cleared and the
wrong branch would be taken later, leading to possible heap buffer overflow.
* src/truetype/ttgxvar.c (tt_face_vary_cvt): Reset `localpoints` to `NULL`
when it isn't valid.
Fixes: https://crbug.com/1284742
2022-01-02 Werner Lemberg <wl@gnu.org>
* builds/unix/configure.raw: Restore `SYSTEM_ZLIB` variable.
This was accidentally removed with commit 93ebcbd0 almost eight years ago.
2021-12-27 Alexander Borsuk <me@alex.bio>
Fix warnings for CMake Unity builds.
* src/cache/ftcbasic.c (FT_COMPONENT): Undefine macro before redefinition.
* src/smooth/ftgrays.c (TRUNC, FRACT): Ditto.
2021-12-18 Alexander Borsuk <alexander.borsuk@qnective.com>
Clang-Tidy warning fixes.
* src/base/ftobjs.c (FT_Get_Paint): Operator has equivalent nested operands.
* src/bdf/bdflib.c (_bdf_add_property): Value stored to `fp` is never read.
* src/sdf/ftbsdf.c (bsdf_init_distance_map): Value stored to `pixel` is
never read.
* src/sdf/ftsdf.c (split_sdf_shape): Value stored to `error` is never read.
2021-12-17 Eli Schwartz <eschwartz@archlinux.org>
* meson.build: Optimize lookup for `python3` program.
The python module's `find_installation` method is intended to provide
routines for compiling and installing python modules into the
`site-packages` directory. It does a couple of slow things, including run
an introspection command to scrape sysconfig info from the detected
interpreter, which are not needed for the sole use case of invoking the
found installation as an executable.
Furthermore, when invoked without the name or path of a python binary, it is
hardcoded to always look for `python3` corresponding to the interpreter
meson itself uses to run. So using `find_installation` did not even allow
detecting `python2` as a fallback.
Instead, switch to a simple `find_program` lookup that finishes as soon as
the program is found.
2021-12-17 Eli Schwartz <eschwartz@archlinux.org>
* builds/meson/*.py: Fix name of python executable for auxiliary scripts.
The previous change to check the return code of `run_command` invocations
caused the CI to fail. Although most scripts used `python_exe` as the
program command, the script to determine the project version did not.
But, all scripts used `python` as the shebang, and this is not available on
all systems. Particularly Debian does not provide a `python` command,
though `python3` does exist. This meant that formerly the version number
was lacking, and now the build simply fails.
Instead, rely on `python3` since it is guaranteed to exist when running
meson, and `python2` is end of life anyway.
2021-12-17 Eli Schwartz <eschwartz@archlinux.org>
* meson.build: Check the return value of `run_command`.
By default, errors are not checked and a command that is somehow broken will
just capture incorrect output (likely an empty string). Current development
versions of meson now raise a warning for this implicit behavior, and advise
explicitly setting the `check:` keyword argumend to determine whether a
failing return code should be considered an error.
Since none of the commands in this project are expected to fail, mark them
as required to succeed.
2021-12-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Upstream the hdmx binary search.
* src/truetype/ttobjs.h (TT_SizeRec): Add `widthp` for the hdmx
widths.
* src/truetype/ttobjs.c (tt_size_reset): Initialize `widthp` even
though it might never be used by the interpreter.
* src/truetype/ttgload.c (tt_loader_init): Avoid repeated searches
in the hdmx table.
2021-12-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Reset the IUP-called flags for each subglyph.
This fixes fall-out from 7809007a5b88b15, where the composite
accents were no longer hinted.
* src/truetype/ttgload.c (ttloader_init): Move the IUP-called flag
initialization from here...
* src/truetype/ttinterp.c (TT_Run_Context): ... to here.
2021-12-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Binary search through the `hdmx` records.
The `hdmx` table is supposed to be sorted by ppem size, which
enables binary search. We also drop the check for the sufficient
length of the record because it is now enforced when the table
is loaded.
* include/freetype/internal/tttypes.h (TT_FaceRec): Store the `hdmx`
record pointers sorted by ppem instead of ppem's themselves.
* src/truetype/ttpload.c (tt_face_load_hdmx): Prudently sort records.
(tt_face_get_device_metrics): Implement binary search to retrieve
advances.
2021-12-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Honor FT_LOAD_ADVANCE_ONLY if `hdmx` is usable.
This simply shortcuts the glyph loading if FT_LOAD_ADVANCE_ONLY
is specified by FT_Get_Advances and the `hdmx` data are located.
Particularly, the classic v35 interpreter or "verified" ClearType
fonts might see 100x speed up in retrieving the hdmx cache.
* src/truetype/ttgload.c (TT_Load_Glyph): Insert the shortcut.
2021-12-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Initialize the loader with `hdmx` data.
The `hdmx` matching can be done before the glyph is loaded.
* include/freetype/internal/tttypes.h (TT_LoaderRec): Add a field.
* src/truetype/ttgload.c (compute_glyph_metrics): Relocate the `hdmx`
code from here...
(tt_loader_init): ... to here, before the glyph is loaded.
2021-12-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Relocate subpixel flag setting.
`TT_RunIns` is too busy to deal with subpixel flags. It is better
to set them in `tt_loader_init`, which is executed before each
glyph program.
* src/truetype/ttinterp.c (TT_RunIns): Move the flag setting from
here...
* src/truetype/ttgload.c (tt_loader_init): ... to here.
2021-12-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Limit INSTCTRL appication within specs.
* src/truetype/ttinterp.c (Ins_INSTCTRL): Limit its global effects
to the CVT program and local effects to the glyph program.
This also fixes an Infinality buglet. The `ignore_x_mode` should be
locally unset by the glyph program.
2021-12-09 Ben Wagner <bungeman@chromium.org>
[bdf] Fix use of uninitialized value.
In _bdf_readstream if the data contained no newline then the buffer
would continue to grow and uninitialized data read until either the
uninitialized data contained a newline or the buffer reached its
maxiumum size. The assumption was that the line was always too long and
the buffer had been filled, however this case can also happen when there
is not enough data to fill the buffer.
Correct this by properly setting the cursor to the end of the available
data, which may be different from the end of the buffer. This may still
result in one extra allocation, but only on malformed fonts.
* src/bdf/bdflib.c (_bfd_readstream): Correctly update cursor. Remove
unread set of `avail`.
Bug: https://lists.nongnu.org/archive/html/freetype-devel/2021-12/msg00001.html
2021-12-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Reduce Infinality footprint again.
* src/truetype/ttgload.c (compute_glyph_metrics): Streamline and
prioritize the Infinality checks to use `hdmx`.
2021-12-07 Cameron Cawley <ccawley2011@gmail.com>
[builds/windows] Guard some non-ancient API.
We can support Windows 98 and NT 4.0 in principle...
* builds/windows/ftdebug.c, builds/windows/ftsystem.c: Check for the
ancient SDK using _WIN32_WINDOWS, _WIN32_WCE, or _WIN32_WINNT.
2021-12-07 Cameron Cawley <ccawley2011@gmail.com>
* builds/windows/visualc/freetype.vcproj: Add missing file.
2021-12-02 Werner Lemberg <wl@gnu.org>
* Version 2.11.1 released.
==========================
Tag sources with `VER-2-11-1'.
* docs/VERSION.TXT: Add entry for version 2.11.1.
* docs/CHANGES, docs/release: Updated.
* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.11.0/2.11.1/, s/2110/2111/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.
* builds/unix/configure.raw (version_info): Set to 24:1:18.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
* builds/toplevel.mk (version_tag, CHANGELOG_SCRIPT): New variables.
(do-dist): Generate `ChangeLog` file with all commits since last release.
2021-11-30 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Improve debugging.
* builds/windows/ftdebug.c (FT_Message, FT_Panic): Buffer output
and call `OutputDebugStringA` only if `IsDebuggerPresent`.
[_WIN32_WCE] (OutputDebugStringA): Implement the missing API.
2021-11-29 Seigo Nonaka <nona@google.com>
* src/base/ftobjs.c (FT_Request_Metrics): Fix build warning on Android.
Use casts since `FT_USHORT_MAX` is unsigned short in bionic (libc used in
Android).
2021-11-28 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/vc2010/freetype.vcxproj (DlgCopy): Minor tweak.
2021-11-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttpload.c (tt_face_load_hdmx): Added comments.
2021-11-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Quietly reject out-of-spec `hdmx` tables.
The `hdmx` table is optional and can be safely rejected without
an error if it does not follow specifications. The record size
must be equal to the number of glyphs + 2 + 32-bit padding.
* src/truetype/ttpload.c (tt_face_load_hdmx): Thoroughly check
the record size and improve tracing.
2021-11-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Partly revert 5b626281.
Fixes #1118.
* src/truetype/ttpload.c (tt_face_load_hdmx): Do not assume that
`record_size` is rounded even though the records are padded.
2021-11-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/vc2010/freetype.vcxproj (DlgCopy): Use transforms.
2021-11-22 Werner Lemberg <wl@gnu.org>
Update `CHANGES` files, other minor whitespace and documentation issues.
2021-11-21 Werner Lemberg <wl@gnu.org>
formats.txt: Add info about WOFF and WOFF2.
2021-11-21 Werner Lemberg <wl@gnu.org>
meson.build: Initialize `common_ldflags`.
2021-11-21 Lukas Oberhuber <@lukaso>
* meson.build: Fix compatibility version on MacOS.
Fixes #1117.
2021-11-21 Werner Lemberg <wl@gnu.org>
* src/truetype/ttinterp.c (Ins_MD): Avoid `FT_ABS`.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38562
2021-11-20 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/fttypes.h (FT_MAKE_TAG): Remove the same casting.
2021-11-20 Werner Lemberg <wl@gnu.org>
[gxvalid] Fix minor compilation warning.
* src/gxvalid/gxvmort5.c (gxv_mort_subtable_type5_subtable_setup): Declare
as static.
2021-11-20 Werner Lemberg <wl@gnu.org>
[smooth] Fix stand-alone compilation.
* src/smooth/ftgrays.c (FT_Trace_Enable, FT_Trace_Disable)[STANDALONE_]:
Define.
2021-11-20 Werner Lemberg <wl@gnu.org>
Avoid undefined left-shifts.
We really have to use double casts to avoid issues with C's and C++'s
signedness propagation rules in implicit casts.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41178
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41182
* include/freetype/config/public-macros.h (FT_STATIC_CAST,
FT_REINTERPRET_CAST): Modify macro to take two arguments.
Update all callers.
(FT_STATIC_BYTE_CAST): New macro.
* include/freetype/freetype.h (FT_ENC_TAG): Use `FT_STATIC_BYTE_CAST`.
* include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto.
* include/freetype/fttypes.h (FT_MAKE_TAG): Ditto.
Use `FT_Tag` for casting.
* src/ftraster/ftmisc.h (FT_MAKE_TAG): Removed, no longer needed.
(FT_STATIC_BYTE_CAST): New macro.
* src/smooth/ftgrays.c (FT_STATIC_CAST): Replace with...
(FT_STATIC_BYTE_CAST): ... this.
2021-11-18 Werner Lemberg <wl@gnu.org>
Provide C++ versions for public macros with casts.
Many FreeType clients use C++. However `g++ -Wold-style-cast` warns for
macros with C-style casts even for system header files; this also affects
directories included with `-isystem`. While this could be seen as a problem
with g++, the problem is more a philosophical one: Over the time, C and C++
diverged more and more, and some features of C are no longer the 'right'
solution in C++.
* include/freetype/config/public-macros.h (FT_STATIC_CAST,
FT_REINTERPRET_CAST): New macros.
* include/freetype/freetype.h (FT_ENC_TAG, FT_LOAD_TARGET_,
FT_LOAD_TARGET_MODE): Use `FT_STATIC_CAST`.
Correctly handle negative 'signed char' input.
* include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto.
* include/freetype/fttypes.h (FT_MAKE_TAG, FT_BOOL): Ditto.
* include/freetype/ftmodapi.h (FT_FACE_DRIVER_NAME): Use
`FT_REINTERPRET_CAST`.
* src/smooth/ftgrays.c (FT_STATIC_CAST)[STANDALONE_]: New macro.
[!STANDALONE]: Include `FT_CONFIG_CONFIG_H`.
Fixes #1116.
2021-11-16 Werner Lemberg <wl@gnu.org>
Fix clang++ warnings.
* src/*: Initialize some variables to NULL.
2021-11-16 Werner Lemberg <wl@gnu.org>
[truetype] Updates for the forthcoming OpenType 1.9 standard (2/2).
* src/truetype/ttgxvar.c (ft_var_load_item_variation_store):
s/shortDeltaCount/wordDeltaCount/ (as done in the specification, too).
Recognize new format and reject it for now.
2021-11-16 Werner Lemberg <wl@gnu.org>
[truetype] Updates for the forthcoming OpenType 1.9 standard (1/2).
This is in preparation for implementing `DeltaSetIndexMap` format 1, which
is used by `COLR` v1 tables, and which allows 32bit indices.
https://docs.microsoft.com/en-us/typography/opentype/otspec190/delta/otvarcommonformats_delta.html
* src/truetype/ttgxvar.h (GX_DeltaSetIdxMapRec): Change type of `mapCount`
to `FT_ULong`.
* src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add argument
for passing the table size; update caller.
Implement new format.
2021-11-14 Werner Lemberg <wl@gnu.org>
Fix clang warnings.
* src/gxvalid/gxvcmmn.h (GXV_SET_ERR_IF_PARANOID): Use 'do' block.
* src/gxvalid/gxvmod.c (GXV_TABLE_LOAD, GXV_TABLE_VALIDATE): Ditto.
* src/smooth/ftgrays.c (gray_convert_glyph): Add cast.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Remove cast.
* src/type1/t1load.c (read_binay_data): Use `FT_ULong` for `size` parameter.
(parse_subrs, parse_charstrings, parse_dict): Ditto; also add some casts.
2021-11-13 Dominik Röttsches <drott@chromium.org>
[sfnt] Avoid undefined shifts in `COLR` v1 paint parsing
* src/sfnt/ttcolr.c (read_paint, tt_face_get_paint): Tighten shift
behavior by using multiplication, mostly using macros from ftcalc.h.
Fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=1269168
2021-11-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Improve `DlgCopy` target.
Fixes #1113.
* builds/windows/vc2010/freetype.vcxproj: Run `DlgCopy` conditionally
and decouple it from `Build`.
2021-11-12 Alexei Podtelezhnikov <apodtele@gmail.com>
Explicitly define `FT_MSB` for Clang.
* include/freetype/internal/ftcalc.h [__clang__] (FT_MSB): Updated.
2021-11-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgxvar.c (ft_var_to_normalized): Edge optimization.
2021-11-10 Alexei Podtelezhnikov <apodtele@gmail.com>
Additional `FT_MSB` macro definitions.
Better macros for Windoes CE and ARM in general, based on !109
from metarutaiga.
* include/freetype/internal/ftcalc.h [_MSC_VER] (FT_MSB): Updated.
2021-11-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[build/windows] Remove logging from default debug configurations.
DLG is rather costly for performance and should be used judiciously.
This removes it from the default configurations but gives an example
how to enable it using the `UserDefines` property.
* builds/windows/vc2010/freetype.vcxproj: Hide FT_DEBUG_LOGGING.
2021-11-08 Werner Lemberg <wl@gnu.org>
* src/sfnt/sfobjs.c (sfnt_open_font): Fix typo.
2021-11-08 Werner Lemberg <wl@gnu.org>
* src/gxvalid.*, src/otvalid.*: Fix `-Wformat` warnings.
2021-11-08 Werner Lemberg <wl@gnu.org>
[pshinter] Fix C++ compilation.
* src/pshinter/pshalgo.c (psh_compute_dir): Fix type of `result`.
(psh_hint_table_find_strong_points): Add cast.
2021-11-08 Werner Lemberg <wl@gnu.org>
[sfnt] Reduce footprint if WOFF and WOFF2 support is not needed.
Based on a patch from metarutaiga (MR !106). The gist of this commit is
that it doesn't make sense to support WOFF without compression (which would
be only possible in WOFF 1.0 anyway).
* src/sfnt/sfobjs.c (sfnt_open_font): Guard WOFF code with
`FT_CONFIG_OPTION_USE_ZLIB` block.
Guard WOFF2 code with `FT_CONFIG_OPTION_USE_BROTLI` block.
* src/sfnt/sfwoff.c, src/sfnt/sfwoff.h: Guard files with
`FT_CONFIG_OPTION_USE_ZLIB` blocks, not parts of the code.
* src/sfnt/sfwoff2.c, src/sfnt/sfwoff2.h, src/sfnt/woff2tags.c,
src/sfnt/woff2tags.h: Guard files with `FT_CONFIG_OPTION_USE_BROTLI` blocks,
not parts of the code.
Fixes #1111.
2021-11-08 Werner Lemberg <wl@gnu.org>
[truetype] Make trickyness checks depend on TT_USE_BYTECODE_INTERPRETER.
Based on a patch from metarutaiga (MR !106).
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag,
tt_check_trickyness_family, tt_synth_sfnt_checksum, tt_get_sfnt_checksum,
tt_check_trickyness_sfnt_ids, tt_check_trickyness): Put functions into a
`TT_USE_BYTECODE_INTERPRETER` block.
(tt_face_init): Put trickyness checks into a `TT_USE_BYTECODE_INTERPRETER`
block.
Fixes #1111.
2021-11-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttload.c (tt_face_load_gasp): Fix a type mismatch warning.
2021-11-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[dlg] Define DLG_STATIC explicitly.
DLG_STATIC is intended to disable Windows DLL linking attributes.
It does not hurt to define it explicitly when we wrap DLG code.
This fixes tons of LNK4286 and C4273 warnings from MSVC if we
forget to define DLG_STATIC as a compiler option.
* builds/windows/vc2010/freetype.vcxproj: Remove DLG_STATIC option.
* src/dlg/dlgwrap.c [FT_DEBUG_LOGGING]: Define DLG_STATIC.
* include/freetype/internal/ftdebug.h [FT_DEBUG_LOGGING]: Ditto.
2021-11-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[dlg] Lighten up the inclusions.
The DLG wrapper needs to know if FT_DEBUG_LOGGING is defined in
`ftoption.h`. It does not need entire FreeType.
* src/dlg/dlgwrap.c: Include FT_CONFIG_OPTIONS_H directly.
2021-11-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Avoid some memory zeroing in variations.
* src/truetype/ttgxvar.c (ft_var_readpackeddeltas, ft_var_load_avar,
ft_var_load_item_variation_store, ft_var_load_gvar): Use FT_QNEW_ARRAY
if memory immediately initialized or discarded otherwise.
2021-11-05 Jany Belluz <jany.belluz@daltonmaag.com>
[truetype] Fix handling of packed deltas in Variation Fonts.
* src/truetype/ttgxvar (ft_var_readpackeddeltas): Don't expect the number of
bytes used to encode the deltas to be higher than the number of encoded
values. The specification allows a very compact encoding; for example, a
list of 200 zeros can be encoded with just a couple of bytes.
We now count the consumed bytes to make sure to not read more than expected.
2021-11-04 Jany Belluz <jany.belluz@daltonmaag.com>
[truetype] Fix CVAR handling of tuples for all points.
* src/truetype/ttgxvar (tt_face_vary_cvt): Function
`ft_var_readpackedpoints`, when it returns `ALL_POINTS`, also sets
`point_count` to value 0. However, the CVAR code was incorrectly expecting
that `point_count` would be set to match the length of the CVT table.
2021-11-04 Jany Belluz <jany.belluz@daltonmaag.com>
* src/truetype/ttgxvar.c: Fix typos in macros that guard CVAR code.
2021-11-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* docs/INSTALL: Mention Meson and MSBuild more prominently.
2021-11-03 Gabor Kertesz <gabor.kertesz@linaro.org>
[libpng] Update Meson wrap for win-arm64
1.6.37-5 released patches for win-arm64 to successfully build
libpng with Meson:
https://github.com/mesonbuild/wrapdb/pull/205
https://github.com/mesonbuild/wrapdb/pull/216
Updated by the following command:
meson wrap update libpng
Tested on win-arm64 and x64.
2021-11-03 Dominik Röttsches <drott@chromium.org>
[sfnt] Clarify `COLR` v1 FT_Paint* format representations
* include/freetype/ftcolor.h (FT_PaintLinearGradient,
FT_PaintRadialGradient, FT_PaintSweepGradient, FT_PaintTransform,
FT_PaintTranslate, FT_PaintScale, FT_PaintRotate, FT_PaintSkew): Clarify
16.16 fixed point representation of struct fields.
* src/sfnt/ttcolr.c (read_paint): Shift coordinates for
FT_PaintLinearGradient, FT_PaintRadialGradient, FT_PaintSweepGradient
accordingly.
Fixes: https://gitlab.freedesktop.org/freetype/freetype/-/issues/1110
2021-11-03 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Let MSBuild handle DLG copy.
* builds/windows/vc2010/freetype.vcxproj: Specify DlgCopy target.
* builds/windows/vc2010/script.bat: Deleted.
2021-10-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (load_truetype_glyph): Fix MSVC warning C4312.
2021-10-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Separate MSVC linker and librarian.
MSVC uses LIB for static and LINK for dynamic libraries. They are
related but the former has much smaller set of options.
* builds/windows/vc2010/freetype.vcxproj: Updated.
2021-10-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Revise MSVC linking optimizations.
* builds/windows/vc2010/freetype.vcxproj: Optimize DLL linking only.
* builds/windows/visualc/freetype.dsp: Ditto.
* builds/windows/visualc/freetype.vcproj: Ditto.
2021-10-28 Alexei Podtelezhnikov <apodtele@gmail.com>
[woff] Optimize table tagging.
* include/freetype/internal/wofftypes.h (WOFF_TableRec): Use
32-bit tag.
* src/sfnt/sfwoff.c (woff_open_font): Use 32-bit tag.
2021-10-28 Alexei Podtelezhnikov <apodtele@gmail.com>
[woff2] Optimize table tagging.
Fixes #1107.
* include/freetype/internal/wofftypes.h (WOFF2_TableRec): Use
32-bit tag.
* src/sfnt/sfwoff2.c (compare_tags, find_table, woff2_open_font):
Use 32-bit tag.
* src/sfnt/woff2tags.[ch] (woff2_known_tags): Use static storage and
return 32-bit tag.
2021-10-26 Werner Lemberg <wl@gnu.org>
Formatting.
2021-10-26 Ben Wagner <bungeman@chromium.org>
[mm] Tolerate missing Blend dictionary entries
In a Multiple Master font, the Blend dictionary must contain valid
Private, FontInfo, and FontBBox. The current code will error if any of
these are present and invalid, but will not error and will provide
uninitialized data if the Blend dictionary exists but does not contain
one of these entries. This change reverts to the older behavior of
treating any missing entries as containing all zero data and not
returning an error.
In the future it may be best to keep track of when these are actually
initialized and error if they are not.
* src/type1/t1load.c (t1_allocate_blend): Zero initiailize.
2021-10-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Add MSVC linker optimazations.
We continue to build static libraries with statically linked C run-
time and add options to optimize references.
* builds/windows/vc2010/freetype.vcxproj: Sort entries, add options.
2021-10-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/vc2010/freetype.vcxproj: Use MachineARM64.
2021-10-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Prioritize x64.
* builds/windows/vc2010/freetype.sln: Sort entries.
2021-10-22 Gabor Kertesz <gabor.kertesz@linaro.org>
[builds/windows] Add ARM64 platform.
* builds/windows/vc2010/freetype.sln: Updated
* builds/windows/vc2010/freetype.vcxproj: Updated.
* builds/windows/vc2010/freetype.vcxproj.filters: Minor fix.
2021-10-21 Ben Wagner <bungeman@chromium.org>
[mm] Delay setting blend weight and design position.
Previously the `blend->weight_vector`, `blend->default_weight_vector`,
and `blend->design_pos` were set early to allocated but uninitialized
memory under the assumption that the memory would eventually be
initialized. However, it is possible that some of the required
keywords may not actually be present, leaving the memory uninitialized.
This is different from a present but invalid table, which would produce
an error.
Reported as
https://bugs.chromium.org/p/chromium/issues/detail?id=1261762
* src/type1/t1load.c (t1_allocate_blend): Remove early allocation and
initialization.
(parse_blend_design_positions, parse_weight_vector): Parse into local
and assign to blend if valid.
(T1_Open_Face): Check that if a blend exists that it has the weight
vector and design positions.
2021-10-21 Ben Wagner <bungeman@chromium.org>
[cff] Commit vstore data and regions on allocation.
The vstore->regionCount and vstore->dataCount were read directly
from the data. However, vstore->varRegionList and vstore->varData
would still contain uninitialized entries with uninitialized
pointers in the event of an error, leading to issues when attempting
to clean up.
Reportd as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40104
* src/cff/cffload.c (cff_vstore_load): Read the region and data counts
into locals and update the vstore counts immediately after each entry
becomes free-able.
2021-10-20 Ben Wagner <bungeman@chromium.org>
[sfnt] Delay setting gasp ranges and count until computed.
Previously, the gasp.numRanges was set and gasp.gaspRanges was
allocated and assigned before a possible early exit if the frame could
not be entered. It is also possible that the gaspRanges allocation
could fail but the numRanges still be set to non-zero. In such cases
an error would be returned, but the face would have a gasp in an
inconsistent state which may still be accessed.
Reported as
https://bugs.chromium.org/p/chromium/issues/detail?id=1261450
* src/sfnt/ttload.c (tt_face_load_gasp): Delay setting gasp.numRanges
and gasp.gaspRanges until after the ranges are initialized.
2021-10-20 Ben Wagner <bungeman@chromium.org>
[sfnt] Delay setting names and langTags until computed.
Previously, the table->names and table->langTags fields were created
pointing to uninitialized memory and an early exit could happen if the
frame could not be entered. The caller would then be unable to properly
dispose of the memory as the string fields had not been initialized.
Reported as
https://bugs.chromium.org/p/chromium/issues/detail?id=1261343
* src/sfnt/ttload.c (tt_face_load_name): delay setting table->langTags
and table->names until after the memory they will point to is fully
initialized.
2021-10-20 Alexei Podtelezhnikov <apodtele@gmail.com>
* tests/issue-1063/main.c: s/PATH_MAX/FILENAME_MAX/.
Closes !97 for Windows by using a standard macro.
2021-10-19 Werner Lemberg <wl@gnu.org>
[bdf, cid, pfr, winfonts] Improve rejection of other font formats.
This is mainly for better diagnostics of malformed fonts.
* src/bdf/bdflib.c (_bfd_readstream): Stop font format testing if the first
input line is too long or doesn't end with `\r` or `\n`.
* src/cid/cidparse.c (cid_parser_new): Don't handle too short input as an
error but as an unknown format.
* src/pfr/pfrobjs.c (pfr_face_init): Ditto.
* src/winfonts/winfnt.c (fnt_font_load, fnt_face_get_dll_font): Ditto.
2021-10-19 Alexei Podtelezhnikov <apodtele@gmail.com>
[pcf] Zero out the allocated properties.
Fallout reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40033
* src/pcf/pcfread.c (pcf_get_properties): Use FT_NEW_ARRAY and zero
out `properties` in case of failure.
2021-10-18 Werner Lemberg <wl@gnu.org>
configure: Use string comparison for directory inodes.
Inode values might be larger than integers supported by the shell.
Fixes #1105.
2021-10-17 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttload.c (tt_face_load_name): NULL-initialize langTag.
Another attempt to fix fallout reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40024
2021-10-17 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Fix up user properties.
Fallout reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40027
* src/bdf/bdflib.c (_bdf_add_property): Cosmetic NULL.
(bdf_create_property): Limit allocations to customary signed
FT_Long and NULL-initialize unused storage.
(bdf_free_font): Do not free unused storage.
2021-10-17 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttload.c (tt_face_load_name): Accounting fix.
Fallout reported as
https://crbug.com/40024
2021-10-16 Ben Wagner <bungeman@chromium.org>
Fix typos in memory macros.
FT_QNEW_ARRAY and FT_QRENEW_ARRAY were using the non-Q
FT_MEM_NEW_ARRAY and FT_MEM_RENEW_ARRAY. Change these to use the Q
versions. Also fix the one issue discovered in tt_face_load_name
where table->names is created with FT_QNEW_ARRAY but the extra
string member is not initialized to NULL.
* include/freetype/internal/ftmemory.h (FT_Q(RE)NEW_ARRAY):
Use FT_MEM_Q(RE)NEW_ARRAY as needed.
* src/sfnt/ttload.c (tt_face_load_name): Initialize `entry->string`.
2021-10-15 Ben Wagner <bungeman@chromium.org>
[truetype] Reload context after re-executing `prep`.
When a different hinting mode from the current is selected, the `prep` table
must be re-executed with the new mode. After this happens the context must
be re-loaded in preparation for the glyph program to be run.
Fixes #1104.
* truetype/ttgload.c (tt_loader_init): Add call to `TT_Load_Context`.
2021-10-15 Werner Lemberg <wl@gnu.org>
[truetype] Minor documentation improvements.
2021-10-14 Anurag Thakur <anuthadev@gmail.com>
Add clang build to linux CI
2021-10-12 Anurag Thakur <anuthadev@gmail.com>
CI: Add macOS CI, including a clang build
2021-10-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidload.c (parse_fd_array): Protect against trancation.
2021-10-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[type1] Revert to signed size for binary data.
Recently introduced and reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39838
* src/type1/t1load.c (read_binary_data): Reject negative size.
(parse_subrs, parse_charstrings): Use customary signed size.
2021-10-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[psaux] Signedness revisions.
Unsigned indexes are easier to check.
* src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Updated.
* src/psaux/psintrp.c (cf2_interpT2CharString): Ditto.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto.
* src/type1/t1load.c (read_binary_data): Ditto.
2021-10-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[cid] Signedness revisions.
Unsigned checks are simpler.
* include/freetype/t1tables.h (CID_FaceInfoRec): Change to unsignd
`num_dicts`.
* src/cid/cidparse.h (CID_Parser): Change to unsigned `num_dict`.
* src/cid/cidgload.c (cid_load_glyph): Updated.
* src/cid/cidload.c (cid_load_keyword, parse_fd_array,
parse_expansion_factor, parse_font_name, cid_read_subrs,
cid_face_open): Updated.
* src/cid/cidobjs.c (cid_face_done): Updated.
* src/cid/cidparse.c (cid_parser_new): Updated.
2021-10-09 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidload.c (cid_face_open): Streamline CIDCount check.
2021-10-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidload.c (cid_face_open): Streamline SubrCount check.
2021-10-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidgload.c (cid_load_glyph): Fortify incremental loading.
2021-10-08 Alexei Podtelezhnikov <apodtele@gmail.com>
Signedness revisions.
This eliminates explicit casting by switching to unsigned fields.
The revisions mostly impact the handling of CID fonts.
* include/freetype/fttypes.h (FT_Data): Change to unsigned `length`.
* include/freetype/t1tables.h (CID_FaceDictRec): Ditto for `sd_bytes`.
(CID_FaceInfoRec): Ditto for `gd_bytes` and `gd_bytes`.
* include/freetype/internal/tttypes.h (TT_LoaderRec): Ditto for
`byte_len`.
* src/cid/cidgload.c (cid_load_glyph): Updated.
* src/cid/cidload.h (cid_get_offset): Update argument.
* src/cid/cidload.c (cid_get_offset, cid_read_subrs, cid_face_open):
Updated.
* src/cff/cffgload.c (cff_get_glyph_data, cff_free_glyph_data):
Updated.
* src/psaux/psft.c (cf2_getT1SeacComponent): Updated.
* src/truetype/ttgload.c (TT_Process_Composite_Glyph,
load_truetype_glyph): Updated.
2021-10-07 Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
meson.build (gen_docs): Use `current_source_dir` instead of `source_root`.
These two are not equal when FreeType is used as a subproject, such as in
`freetype-demos`. In that case, `source_root` points at the root project,
causing the docs build to fail.
2021-10-05 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (FT_DIV_MOD): Limit the ARM workaround.
2021-10-05 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/unix, builds/vms] Standardize `mmap` failure.
* builds/unix/ftsystem.c (FT_Stream_Open): Check for MAP_FAILED.
* builds/vms/ftsystem.c (FT_Stream_Open): Ditto.
This should cover https://savannah.nongnu.org/patch/?5909 as well.
2021-10-05 Hugh McMaster <hugh.mcmaster@outlook.com>
autogen.sh: Only copy submodules if building from a git branch.
`autogen.sh` fails if building from a standard source tarball. Firstly, git
expects to be called in a git repository, then `copy_submodule_files`
blindly attempts to copy files.
Debian, Ubuntu, Linux Mint, and other derivatives all run `autogen.sh`
before compiling to regenerate build files.
This patch ensures that various git commands are only called and 'dlg' files
are only copied if `autogen.sh` is called from a git repository.
2021-10-05 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/internal/ftgloadr.h: Add missing header.
Noticed by Jouk Jansen.
2021-10-05 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Additional clean-ups.
* src/pshinter/pshalgo.h (psh_hint_table_find_strong_points): Streamline code.
* src/pshinter/pshalgo.h (PSH_Glyph): Remove unused fields.
2021-10-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] More convenient direction definition.
It is easier to check directions using flags than integer values.
* src/pshinter/pshalgo.h (PSH_Dir): Redefine directions.
(PSH_PointRec): Use them as an enum type.
* src/pshinter/pshalgo.c (psh_compute_dir): Modify return type.
(psh_glyph_init, psh_hint_table_find_strong_points,
psh_glyph_find_blue_points): Update users.
2021-10-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Remove unnecessary check.
* src/pshinter/pshalgo.c (psh_hint_table_find_strong_points): Do not
check if direction is defined before checking how.
2021-10-02 AnuthaDev <anuthadev@gmail.com>
CI: Hardcode meson version to fix build failure on windows
2021-10-01 Alexei Podtelezhnikov <apodtele@gmail.com>
Additional `FT_MSB` macro definitions.
* include/freetype/internal/ftcalc.h [__DECC,_CRAYC]: Use builtins
and intrinsics.
2021-10-01 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/autofit/afhints.c (af_glyph_hints_reload): Decrease casting.
2021-09-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/tools/apinames.c: Facilitate OpenVMS linker options.
2021-09-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/winfonts/winfnt.c (FNT_Face_Init): Correct reallocation.
2021-09-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/unix] Do not use autoconf SIZEOF.
* builds/unix/ftconfig.h.in [FT_USE_AUTOCONF_SIZEOF_TYPES]: Removed.
* builds/unix/configure.raw: Remove AC_CHECK_SIZEOF and update.
After this commit, autoconf builds will fully rely on <limits.h>
rather than falling back on it if AC_CHECK_SIZEOF failed for some
reason. There is a risk that misconfigured cross-compilation might
have wrong headers. Note that Meson and CMake builds always relied on
<limits.h> for sizes and availability of integer types.
2021-09-25 Alexei Podtelezhnikov <apodtele@gmail.com>
Propagate sign when reading OFF3.
Signed 24-bit values are extremely rare. FreeType only reads them in
PFR fonts with bitmap strikes conditionally. They have not been seen
in the known fonts. That is why this bug could never be discovered.
`FT_FRAME_OFF3` propagates sign correctly.
* include/freetype/internal/ftstream.h (FT_PEEK_OFF3, FT_PEEK_OFF3_LE):
Propagate sign into 32-bit value.
(FT_GET_OFF3, FT_READ_OFF3): Needed fixing but removed as unused.
2021-09-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Simplify comment collection or lack thereof.
BDF comments are neither actually collected nor retrieved. There is
no need to be fancy with delimiters.
* src/bdf/bdflib.c (_add_bdf_comment): Delimit comments with zeros...
(bdf_load_font): ...and do not null-terminate comments additionally.
(_bdf_parse_glyphs): Check if comments are kept, which they are not.
(_bdf_parse_start): Minor clean up.
2021-09-24 Alexei Podtelezhnikov <apodtele@gmail.com>
Use NULL for pointers only.
* src/bdf/bdflib.c (*): Code changes.
* include/freetype/freetype.h: Comments only.
* src/cff/cffload.c, src/cff/cffobjs.c: Ditto.
* src/winfonts/winfnt.c: Ditto.
2021-09-23 Werner Lemberg <wl@gnu.org>
Minor documentation fixes and improvements.
2021-09-23 Alexei Podtelezhnikov <apodtele@gmail.com>
Reference `fopen` in the docs.
2021-09-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf, pcf] Minor optimization.
* src/pcf/pcfread.c (pcf_load_font): Do not call `FT_MulDiv` for a
small job.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Ditto.
* src/bdf/bdflib.c (_bdf_parse_glyphs): Fix a comment.
2021-09-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Initialize stream memory earlier.
With Windows memory management tracking heap, it is important to use
it during the stream opening fallback. In Unix, the argument is
unused, but it is better to set it correctly.
* src/base/ftobjs.c (FT_Stream_New): Set memory before calling
`FT_Stream_Open`.
* builds/windows/ftsystem.c, builds/unix/ftsystem.c (FT_Stream_Open,
ft_close_stream_by_free): Call `ft_alloc` and `ft_free` with proper
memory argumment.
2021-09-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Revert back to `CreateFileA` only.
Calling `CreateFileW` without making sure that the patname is really
`wchar_t` is a bad idea and can lead to unpredictable overreads. For
Windows CE, we impelemnt the missing API.
Fixes #1098 and !76 again.
* builds/windows/ftsystem.c (FT_Stream_Open): Call `CreateFileA`.
[_WIN32_WCE] (CreateFileA, FileSizeEx): Implement missing interfaces.
2021-09-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (_bdf_parse_{start,glyphs}): Use appropriate scanner.
2021-09-21 Alexei Podtelezhnikov <apodtele@gmail.com>
Minor.
2021-09-20 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffdrivr.c (cff_ps_get_font_{info,extra}): Use FT_QNEW.
2021-09-18 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Minor clean-ups.
* src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Remove parantheses.
* src/cache/ftccache.c (FTC_Cache_Lookup): Ditto.
(FTC_Cache_RemoveFaceID): Remove unnecessary variable.
2021-09-17 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Try both wide and narrow `CreateFile`
Windows handles wchar_t* UTF-16 and char* ANSI (presently UTF-8)
filenames using alternative -A and -W API. We'll try them both
when opening a file. This means that you should not worry about
about conversions.
Fixes #1098 and !76.
* builds/windows/ftsystem.c (FT_Stream_Open): Call alternative
`CreateFile` in the case of failure.
2021-09-17 Edwin Steiner <edwin.steiner@gmail.com>
[cff] Explicitly set StandardEncoding or ExpertEncoding offsets.
Fixes #1097.
* src/cff/cffload.c (cff_encoding_load): Set special offset values.
2021-09-16 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Miscellaneous clean-ups.
* src/cache/ftccache.c (ftc_get_top_node_for_hash, FTC_Cache_Clear):
Remove barely used variables.
(ftc_cache_add): Adjust casting.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Remove casting.
* src/cache/ftcsbits.c (ftc_snode_load): Remove casting.
2021-09-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffload.c (cff_fd_select_get): Remove casting.
2021-09-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pcf/pcfread.c (pcf_read_TOC): Remove casting.
2021-09-15 Alexei Podtelezhnikov <apodtele@gmail.com>
Minor type adjustments.
* src/cff/cffobjs.c (cff_face_init): Reduce casting.
* src/truetype/ttobjs.c (tt_size_ready_bytecode): Ditto.
* src/type1/t1load.c (T1_Set_MM_Design): Ditto.
2021-09-15 Alexei Podtelezhnikov <apodtele@gmail.com>
Replace boolean allocation macros with MEM ones.
* src/base/ftbitmap.c (FT_Bitmap_Copy): Use MEM-macro.
* src/base/ftobjs.c (ft_glyphslot_alloc_bitmap): Ditto.
* src/bzip2/ftbzip2.c (ft_bzip2_alloc): Ditto.
* src/cache/ftccache.c (ftc_cache_init): Ditto
* src/gzip/ftgzip.c (ft_gzip_alloc): Ditto.
* src/psnames/psmodule.c (ps_unicodes_init): Ditto.
* src/sfnt/sfobjs.c (sfnt_load_face): Ditto.
* src/sfnt/ttload.c (tt_face_load_name): Ditto.
2021-09-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Revert to some zeroing.
* src/cache/ftccache.c (ftc_cache_init, ftc_cache_resize): Zero
`buckets` again to fix some crashes.
2021-09-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pshinter/pshrec.c (ps_mask_table_merge_all): Tweak loops.
Fixes fallout from 731d0b685685 reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38685
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff, pshinter] Clean up unsigned counters.
Loops with unsigned decrement can be reliably stopped when the counter
wraps around after reaching zero.
* src/cff/cffload.c (cff_charset_compute_cids): Use unsigned counter.
* src/pshinter/pshalgo.c (psh_hint_table_activate_mask): Ditto.
* src/pshinter/pshrec.c (ps_mask_table_merge): Ditto.
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf, psnames, sfnt] Avoid some memory zeroing.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Use Q-macro.
* src/sfnt/sfobjs.c (sfnt_load_face): Ditto.
* src/psnames/psmodule.c (src/psnames/psmodule.c): Remove zero.
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftobjs.c (FT_CMap_New): Revert to zeroing.
Fixes fallout from c1fa7aa2bc96, reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38641
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Clean up `exec` initialization.
* src/truetype/ttinterp.c (Init_Context): Absorbed into...
(TT_New_Context): ... this function.
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Avoid some memory zeroing.
* src/truetype/ttgload.c (load_truetype_glyph): Use Q-macro.
* src/truetype/ttinterp.c (Update_Max): Ditto.
* src/truetype/ttpload.c (src/truetype/ttpload.c): Ditto.
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Avoid some memory zeroing.
* src/base/ftobjs.c (FT_New_Size, FT_CMap_New, FT_CMap_Done,
ft_open_face_internal, ft_open_face_internal): Use Q-macros.
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache, psaux] Remove zeros.
* src/cache/ftcmru.c (FTC_MruList_New): Remove initialization.
* src/psaux/psstack.c (cf2_stack_init): Ditto.
2021-09-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Avoid some memory zeroing.
* src/cache/ftcmru.c (FTC_MruList_New): Use Q-macro.
* src/cache/ftcmanag.c (FTC_Manager_RegisterCache): Ditto.
* src/cache/ftccache.c (ftc_cache_init, ftc_cache_resize): Ditto.
2021-09-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcmanag.c (FTC_Manager_New): Add missing zero.
Fixes fall out from a7b199d081e7.
2021-09-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Tweak `hdmx` checking.
Fixes #1096.
* src/truetype/ttpload.c (tt_face_load_hdmx): Account for padding.
2021-09-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Tweak `loca` clamping.
Fixes #1095.
* src/truetype/ttpload.c (tt_face_load_loca): Fix up clamping.
* include/freetype/internal/tttypes.h (TT_Face): Correct docs.
2021-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
Fortify memory debugging (cont'd).
* src/base/ftdbgmem.c (FT_DumpMemory): Check for active debugger.
(ft_mem_table_destroy): Move `FT_DumpMemory` call from here...
(ft_mem_debug_done): ... to here.
2021-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
Fortify memory debugging.
These changes are neccessary to properly recover `memory->user` that
holds the Windows heap handle now.
* src/base/ftdbgmem.c (ft_mem_debug_init): Handle all table allocations,
initializations, and sizing instead of...
(ft_mem_table_new): ... this function removed.
(ft_mem_debug_done): Better check for the active debugger and free the
debugger table here instead of...
(ft_mem_table_destroy): ... here.
2021-09-08 Werner Lemberg <wl@gnu.org>
src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): Set to 600.
This allows C99 compilation on Solaris.
Problem reported by Mojca Miklavec.
2021-09-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Use native memory allocation API.
* builds/windows/ftsystem.c (ft_alloc, ft_realloc, ft_free):
Wrap HeapAlloc, HeapReAlloc, and HeapFree.
(FT_New_Memory): Set the heap handle.
2021-09-07 Werner Lemberg <wl@gnu.org>
[dlg] Synchronize with upstream.
* src/dlg/dlgwrap.c (_XOPEN_SOURCE): Set to 600.
Fixes #1093.
2021-09-04 Alexei Podtelezhnikov <apodtele@gmail.com>
Cosmetic zeros.
2021-09-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (_bdf_parse_start): Keep parser memory.
2021-09-03 Werner Lemberg <wl@gnu.org>
autogen.sh: Make it work with old Solaris 10 shell.
2021-09-03 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth, raster, sdf] Clean up initialization calls.
* src/raster/ftraster.c (ft_black_init): Removed.
(ft_black_new): Clean up.
* src/sdf/ftbsdf.c (bsdf_raster_new): Ditto.
* src/sdf/ftsdf.c (sdf_raster_new): Ditto.
* src/smooth/ftgrays.c (gray_raster_new): Ditto.
2021-09-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcmanag.c (FTC_Manager_New): Avoid some zeroing.
2021-09-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_load_font): Remove memory shuffling.
2021-09-03 Alexei Podtelezhnikov <apodtele@gmail.com>
Cosmetic zeros.
2021-09-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Clean up stream reading.
* src/base/ftstream.c (FT_Stream_ReadUShort, FT_Stream_ReadUOffset,
FT_Stream_ReadULong and their LE variants): Remove unnecessary
initialization and slightly refactor.
(FT_Stream_GetByte, FT_Stream_ReadByte): Rename to return unsigned
value and align with sister functions.
* include/freetype/internal/ftstream.h (FT_Stream_GetByte,
FT_Stream_ReadByte): Update prototypes and caller macros.
2021-09-02 Alexei Podtelezhnikov <apodtele@gmail.com>
s/0/NULL/ where appropriate.
2021-08-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/ftsystem.c (FT_Stream_Open): Fix double-close.
2021-08-30 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Reduce shift in multiply-shift optimization.
* src/smooth/ftgrays.c (FT_UDIVPREP, FT_UDIV): Reduce shift.
Smaller shifts that keep the division operands of FT_UDIVPREP within
32 bits result in slightly faster divisions, which is noticeable in
the overall performance. The loss of precision is tolerable until the
divisors (the components dx and dy) approach 32 - PIXEL_BITS. With
PIXEL_BITS = 8, this corresponds to 65,000 pixels or the bitmap size
that we refuse to render anyway.
Using `ftbench -p -s60 -t5 -bc timesi.ttf`,
Before: 8.52 us/op
After: 8.32 us/op
2021-08-28 Werner Lemberg <wl@gnu.org>
[truetype] Fix compilation if !TT_CONFIG_OPTION_BYTECODE_INTERPRETER.
* src/truetype/ttgxvar.c (tt_cvt_ready_iterator): Compile function
conditionally.
(tt_face_vary_cvt) [!TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Add code.
Fixes #1091.
2021-08-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Revise SSE2 settings.
* builds/windows/vc2010/freetype.vcxproj [x64]: Remove explicit SSE2.
* builds/windows/visualc/freetype.vcproj [Win32]: Add explicit SSE2.
2021-08-27 Ben Wagner <bungeman@chromium.org>
[smooth] Detect SSE2 with MSVC for x86
MSVC does not set `__SSE2__`. Instead one must check whether `_M_IX86_FP` is
defined and greater than or equal to 2.
* src/smooth/ftgrays.c (FT_SSE2): New macro.
Use it where appropriate.
2021-08-26 Alexei Podtelezhnikov <apodtele@gmail.com>
Expand comment (cont'd).
2021-08-26 Alexei Podtelezhnikov <apodtele@gmail.com>
Expand comment.
2021-08-24 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (gray_render_conic): Refactor redundancy.
2021-08-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Fix for the family name shorter than 8 characters.
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag):
If the family name to be checked is shorter than 8 characters,
do not check its syntax.
2021-08-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Simplify `trick_names'.
* src/truetype/ttobjs.c (tt_check_trickyness_family): For the case
that the beginning part of a long tricky family name is already
registered as another tricky family name, no need to double-check
the longer one. Such long tricky family names are removed from
the `trick_names'.
2021-08-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Add 2 tricky font names.
Additional fix for the issue #1087.
* src/truetype/ttobjs.c (tt_check_trickyness_family): Add 2 tricky
font names reported in #1087.
2021-08-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] New function to skip the randomization tag.
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag):
New function to skip the randomization tag in the names of the
fonts embedded in a PDF. It is used by tt_check_trickyness_family(),
to keep from mistaking "DLC" in the randomization tag as a
tricky font name. See discussion in:
https://lists.nongnu.org/archive/html/freetype-devel/2021-02/msg00002.html
For technical detail about the randomization tag, please find
PDF Reference 5.5.3 "Font Subsets". Thanks to Justyna Wawrzynska
for pointing out the issue caused by the randomization tag.
2021-08-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Add checksums for 2 tricky fonts.
Thanks to Ting717 for providing sample PDF. Fixes #1087.
* src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): Add
checksums for 2 tricky fonts `DFHei-Bd-WIN-HK-BF' and
`DFMing-Md-WIN-HK-BF'.
2021-08-23 Alexei Podtelezhnikov <apodtele@gmail.com>
Whitespace formatting.
2021-08-22 Alexei Podtelezhnikov <apodtele@gmail.com>
Decorate const arguments.
* src/base/ftglyph.c (FT_Glyph_Transform, FT_Glyph_To_Bitmap): Do it.
* include/freetype/ftglyph.h (FT_Glyph_Transform, FT_Glyph_To_Bitmap):
Do it.
2021-08-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Clean up the null cell usage.
Put the null cell at the end of the pool and store it explicitly so that
we can use it as both the limit and the dumpster.
* src/smooth/ftgrays.c (gray_TWorker): Store the last `cell_null` and
remove unnecesary fields.
(NULL_CELL_PTR, CELL_IS_NULL): Remove in favor of explicit `cell_null`.
(gray_dump_cells, gray_set_cell, gray_sweep{,_direct}): Update callers.
(gray_convert_glyph_inner): Trace remaining cells (oh well).
(gray_convert_glyph): Set up `cell_null` and slightly improve the pool
management.
2021-08-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Restore quiet no-op rendering of bitmap glyphs.
Fixes #1076.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Discard an error when
rendering a bitmap glyph.
2021-08-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Fortify 64-bit algorithm.
* src/smooth/ftgrays.c (FT_UDIVPREP, FT_UDIV): s/long/FT_Int64/ and
s/unsigned long/FT_UInt64/.
(gray_render_line): Adjust a critical variable type.
2021-08-20 Carlo Bramini <carlo.bramix@libero.it>
* builds/windows/ftsystem.c (FT_Stream_Open): Support legacy Windows.
2021-08-20 Alexei Podtelezhnikov <apodtele@gmail.com>
Determine `long long` availability based on its size.
MSVC, for example, used `long long` even without full C99 support.
* include/freetype/config/ftstdlib.h: Check if `long long` limits are
defined in <limits.h>.
* include/freetype/config/integer-types.h: Check `long long` size and
use it to typedef FT_Int64.
2021-08-19 Dominik Röttsches <drott@chromium.org>
[sfnt] Fix format expectation for `COLR` v1 ClipList
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Change ClipList
format expectation to 1 instead of 0 to make it compliant with the
latest spec.
2021-08-19 Alexei Podtelezhnikov <apodtele@gmail.com>
Readily use `long long` as a 64-bit type in C99 mode.
* include/freetype/config/integer-types.h (FT_INT64):
FT_CONFIG_OPTION_FORCE_INT64 is no longer required to use `long long`.
2021-08-19 Alexei Podtelezhnikov <apodtele@gmail.com>
Use FT_INT64 instead of FT_LONG64.
* include/freetype/config/integer-types.h: Remove synonymous FT_LONG64.
* include/freetype/internal/ftcalc.h: s/FT_LONG64/FT_INT64/.
* src/base/ftcalc.c: Ditto.
* src/base/fttrigon.c: Ditto.
* src/smooth/ftgrays.c: Ditto.
2021-08-18 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Do not set CharacterSet for VC++.
* builds/windows/vc2010/freetype.vcxproj: s/Unicode/NotSet/.
* builds/windows/visualc/freetype.vcproj: s/"1"/"0"/.
2021-08-18 Werner Lemberg <wl@gnu.org>
* src/sdf/ftsdf.c (get_control_box): Fix compiler warning.
2021-08-18 Werner Lemberg <wl@gnu.org>
[base] Fix ppem size overflow.
Fixes #1086.
* src/base/ftobjs.c (FT_Request_Metrics): Add return value.
Check whether ppem values fit into unsigned short values.
(FT_Request_Size): Updated.
* include/freetype/internal/ftobjs.h: Updated.
* src/cff/cffobjs.c (cff_size_request), src/cid/cidobjs.c
(cid_size_request), src/truetype/ttdriver.c (tt_size_request),
src/type1/t1objs.c (T1_Size_Request): Updated.
2021-08-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/ftsystem.c (FT_Stream_Open): Cast to remove warning.
2021-08-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/ftsystem.c (FT_Stream_Open): Support UNICODE compilation.
2021-08-09 Werner Lemberg <wl@gnu.org>
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Minor fix.
2021-08-09 Dominik Röttsches <drott@chromium.org>
[sfnt] Add missing blend mode 'plus' to 'COLR' v1.
* include/freetype/ftcolor.h (FT_Composite_Mode): Add missing blend mode
'plus' after it was added to the spec.
2021-08-08 Werner Lemberg <wl@gnu.org>
include/freetype/freetype.h (FT_Encoding): Improve documentation.
Based on a suggestion by Antony Lee <anntzer.lee@gmail.com>.
2021-08-07 Werner Lemberg <wl@gnu.org>
[smooth] Avoid integer overflow.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36243
* src/smooth/ftgrays.c(ADD_LONG, SUB_LONG, MUL_LONG, NEG_LONG)
[STANDALONE_]: Removed, unused.
(ADD_INT) [STANDALONE_]: New macro.
(FT_INTEGRATE): Use ADD_INT.
2021-08-07 Dominik Röttsches <drott@chromium.org>
[sfnt] Add API for retrieving a 'COLR' v1 'ClipBox' table.
The optional 'COLR' v1 glyph-specific clip box helps upstream graphics
libraries allocate a sufficiently large bitmap for a glyph without having to
traverse the glyph graph for that. See
https://github.com/googlefonts/colr-gradients-spec/issues/251
for background on the introduction of this specification change.
* include/freetype/ftcolor.h (FT_ClipBox): New structure.
(FT_Get_Color_Glyph_ClipBox): New function declaration.
* include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_ClipBox_Func):
New function type.
(SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Use it.
* src/base/ftobjs.c (FT_Get_Color_Glyph_ClipBox): New function to link API
with SFNT implementation.
* src/sfnt/sfdriver.c (sfnt_interface): Updated.
* src/sfnt/ttcolr.c (Colr): New field `clip_list`.
(tt_face_load_colr): Parse global clip list offset.
(tt_face_get_color_glyph_clipbox): New function to find the clip box for a
glyph id from the clip list array.
* src/sfnt/ttcolr.h: Updated.
2021-08-06 Werner Lemberg <wl@gnu.org>
[smooth] Fix left shifts of negative numbers.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36241
* src/smooth/ftgrays.c (LEFT_SHIFT): New macro.
(gray_render_conic) [BEZIER_USE_DDA]: Use it.
2021-08-02 Werner Lemberg <wl@gnu.org>
* meson.build: Fix zlib support.
This commit synchronizes zlib support with both autotools and cmake: If no
external zlib is found (or intentionally disabled on the command line), use
the internal zlib by undefining `FT_CONFIG_OPTION_SYSTEM_ZLIB` without
modifying `FT_CONFIG_OPTION_USE_ZLIB`.
Also improve summary output.
Problem reported by Moazin.
2021-08-02 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Fix out-of-range-access.
* src/sdf/ftbsdf.c (first_pass, second_pass): Fix range during forward pass.
Otherwise the index goes out of range for the last column.
Fixes issue #1077.
2021-08-02 Anuj Verma <anujv@iitbhilai.ac.in>
Fix invalid memory access in `bsdf` rasterizer.
Do not generate SDF from bitmap if the `FT_GLYPH_OWN_BITMAP` flag is not
set. In some cases the bitmap buffer is freed but still points to a valid
address; to handle those cases check the flag before accessing the memory.
* src/sdf/ftsdfrend.c (ft_bsdf_render): Handle the above case.
Also, return an error message if the bitmap's rows/pitch is invalid,
otherwise `slot->buffer` might be assigned to some invalid memory location.
(ft_sdf_render): Same as above.
Plus, move the outline back to original state after rasterization and not if
any error occurs.
2021-07-29 Heiko Becker <heirecka@exherbo.org>
* meson.build: Honor `--includedir` instead of hard-coding 'include'.
2021-07-29 Werner Lemberg <wl@gnu.org>
src/sfnt/ttcolr.c: Minor formatting.
2021-07-29 Dominik Röttsches <drott@chromium.org>
[sfnt] 'COLR' v1 PaintSweepGradient spec update
* src/sfnt/ttcolr.c (read_paint): PaintSweepGradient follows other
spec changes and now has the angles specified as F2DOT14, reflect
that in the implementation.
* include/freetype/ftcolor.h (FT_PaintSweepGradient): Update
documentation.
2021-07-29 Dominik Röttsches <drott@chromium.org>
[sfnt] Retrieve affine matrix from offset in 'COLR' v1 parsing.
* src/sfnt/ttcolr.c (read_paint): Implement spec change where
affine transform matrix is now referenced by offset instead of
being placed inline in the PaintTransform table.
2021-07-29 Dominik Röttsches <drott@chromium.org>
[sfnt] 'COLR' v1 PaintSkew related spec updates
* src/sfnt/ttcolr.c (read_paint): Implement spec changes around
PaintSkew, PaintSkewAroundCenter. Update parsing to read shorter
values as changed in the spec.
* include/freetype/ftcolor.h (FT_PaintSkew): Update documentation.
2021-07-29 Dominik Röttsches <drott@chromium.org>
[sfnt] PaintRotate/PaintRotateAroundCenter spec updates
* src/sfnt/ttcolr.c (read_paint): Implement spec change where
PaintRotate and PaintRotateAroundCenter were split for a more
compact format definition. Update parsing to read shorter values
as changed in the spec.
* include/freetype/ftcolor.h (FT_PaintRotate): Update documentation.
2021-07-29 Dominik Röttsches <drott@chromium.org>
[sfnt] 'COLR' v1 PaintTranslate and PaintScale precision
* src/sfnt/ttcolr.c (read_paint): Implement spec changes in
PaintTranslate and PaintScale and friends. Update parsing to read
new shorter values.
2021-07-29 AnuthaDev <anuthadev@gmail.com>
README.git: Add Code of Conduct.
2021-07-25 Werner Lemberg <wl@gnu.org>
ChangeLog housekeeping.
Archive old `ChangeLog` file.
We no longer write ChangeLog entries manually; instead, the file will be
created from commit messages (which should be formatted in GNU's ChangeLog
style) by a call to
gitlog-to-changelog --format='%B%n'
or something similar (this script is part of the 'gnulib' repository).
2021-07-24 Werner Lemberg <wl@gnu.org>
Fix some `cppcheck` warnings.
* src/bzip2/ftbzip2.c (ft_bzip2_file_skip_output), src/gzip/ftgzip.c
(ft_gzip_file_skip_output): Reduce scope of `delta`.
* src/psaux/psintrp.c, src/psaux/psintrp.h (cf2_interpT2CharString): Add
`const` to `buf` parameter.
* src/raster/ftraster.c (DelOld): Add `const` to `profile` parameter.
(Vertical_Sweep_Span): Reduce scope of `target`.
(FT_Outline_Get_CBox): Reduce scope of `xMin`, `xMax`, `yMin`, `yMax`.
* src/smooth/ftgrays.c (gray_render_conic): Reduce scope of `split`.
(gray_sweep, gray_sweep_direct): Reduce scope of `area`.
* src/tools/apinames.c (names_dump) <OUTPUT_WATCOM_LBC>: Reduce scope of
`temp`.
2021-07-24 AnuthaDev <anuthadev@gmail.com>
* .gitlab-ci.yml: Fixed cmake build, using correct options.
2021-07-24 AnuthaDev <anuthadev@gmail.com>
* CMakeLists.txt: Make `cmake` handle disabled dependencies correctly.
Include 'CMakeDependentOption'.
Replace `FT_WITH_XXX` options with `FT_DISABLE_XXX` and `FT_REQUIRE_XXX`
pairs. Update option logic accordingly.
Fixes #1066.
2021-07-24 Ben Wagner <bungeman@chromium.org>
[autofit] Split `afwrtsys.h`.
The header file `afwrtsys.h` has two distinct functions: to include the
required writing system headers and also to generate code for each writing
system. At each current use site only one or the other is used, with
various macro trickery selecting one or the other. Split this header into
`afws-decl.h` for the required writing system declarations and `afws-iter.h`
for iterating over the writing systems to generate code.
The motivation for this change is that the Visual C++ compiler treats the
standard include guard idiom like `#pragma once` 'if no non-comment code or
preprocessor directive comes before or after the standard form of the
idiom'. It appears to check this after macro expansion, so if
`WRITING_SYSTEM` expands to empty the bottom of `afwrtsys.h` is empty and
looks like the standard include guard idiom which is treated like `#pragma
once`, so subsequent inclusion of `afwrtsys.h` is elided.
Fixes #1075.
* src/autofit/afglobal.c (af_writing_system_classes), src/autofit/aftypes.h
(AF_WritingSystem), src/autofit/rules.mk (AUTOF_DRV_H): Updated.
* src/autofit/afwrtsys.h: Split into...
* src/autofit/afws-decl.h, src/autofit/afws-iter.h: New files.
|