1 2<!doctype html> 3<html lang="en" class="no-js"> 4 <head> 5 6 <meta charset="utf-8"> 7 <meta name="viewport" content="width=device-width,initial-scale=1"> 8 9 <meta name="description" content="API Reference Documentation for FreeType-2.12.1"> 10 11 12 13 <meta name="author" content="FreeType Contributors"> 14 15 16 <link rel="icon" href="images/favico.ico"> 17 <meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.9"> 18 19 20 21 <title>Subpixel Rendering - FreeType-2.12.1 API Reference</title> 22 23 24 25 <link rel="stylesheet" href="assets/stylesheets/main.ca7ac06f.min.css"> 26 27 28 <link rel="stylesheet" href="assets/stylesheets/palette.f1a3b89f.min.css"> 29 30 31 32 <meta name="theme-color" content="#4cae4f"> 33 34 35 36 37 38 39 40 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> 41 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noto+Serif:300,400,400i,700%7CRoboto+Mono&display=fallback"> 42 <style>:root{--md-text-font-family:"Noto Serif";--md-code-font-family:"Roboto Mono"}</style> 43 44 45 46 47 <link rel="stylesheet" href="stylesheets/extra.css"> 48 49 50 51 52 53 54 55 </head> 56 57 58 59 60 61 62 63 <body dir="ltr" data-md-color-scheme="" data-md-color-primary="green" data-md-color-accent="green"> 64 65 66 <script>function __prefix(e){return new URL(".",location).pathname+"."+e}function __get(e,t=localStorage){return JSON.parse(t.getItem(__prefix(e)))}</script> 67 68 <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off"> 69 <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off"> 70 <label class="md-overlay" for="__drawer"></label> 71 <div data-md-component="skip"> 72 73 74 <a href="#subpixel-rendering" class="md-skip"> 75 Skip to content 76 </a> 77 78 </div> 79 <div data-md-component="announce"> 80 81 </div> 82 83 <header class="md-header" data-md-component="header"> 84 <nav class="md-header__inner md-grid" aria-label="Header"> 85 <a href="index.html" title="FreeType-2.12.1 API Reference" class="md-header__button md-logo" aria-label="FreeType-2.12.1 API Reference" data-md-component="logo"> 86 87 <img src="images/favico.ico" alt="logo"> 88 89 </a> 90 <label class="md-header__button md-icon" for="__drawer"> 91 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg> 92 </label> 93 <div class="md-header__title" data-md-component="header-title"> 94 <div class="md-header__ellipsis"> 95 <div class="md-header__topic"> 96 <span class="md-ellipsis"> 97 FreeType-2.12.1 API Reference 98 </span> 99 </div> 100 <div class="md-header__topic" data-md-component="header-topic"> 101 <span class="md-ellipsis"> 102 103 Subpixel Rendering 104 105 </span> 106 </div> 107 </div> 108 </div> 109 110 111 112 <label class="md-header__button md-icon" for="__search"> 113 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg> 114 </label> 115 116<div class="md-search" data-md-component="search" role="dialog"> 117 <label class="md-search__overlay" for="__search"></label> 118 <div class="md-search__inner" role="search"> 119 <form class="md-search__form" name="search"> 120 <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active" required> 121 <label class="md-search__icon md-icon" for="__search"> 122 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg> 123 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg> 124 </label> 125 <button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1"> 126 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg> 127 </button> 128 </form> 129 <div class="md-search__output"> 130 <div class="md-search__scrollwrap" data-md-scrollfix> 131 <div class="md-search-result" data-md-component="search-result"> 132 <div class="md-search-result__meta"> 133 Initializing search 134 </div> 135 <ol class="md-search-result__list"></ol> 136 </div> 137 </div> 138 </div> 139 </div> 140</div> 141 142 143 </nav> 144</header> 145 146 <div class="md-container" data-md-component="container"> 147 148 149 150 151 <main class="md-main" data-md-component="main"> 152 <div class="md-main__inner md-grid"> 153 154 155 156 <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" > 157 <div class="md-sidebar__scrollwrap"> 158 <div class="md-sidebar__inner"> 159 160 161 162<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0"> 163 <label class="md-nav__title" for="__drawer"> 164 <a href="index.html" title="FreeType-2.12.1 API Reference" class="md-nav__button md-logo" aria-label="FreeType-2.12.1 API Reference" data-md-component="logo"> 165 166 <img src="images/favico.ico" alt="logo"> 167 168 </a> 169 FreeType-2.12.1 API Reference 170 </label> 171 172 <ul class="md-nav__list" data-md-scrollfix> 173 174 175 176 177 178 179 180 181 <li class="md-nav__item"> 182 <a href="index.html" class="md-nav__link"> 183 TOC 184 </a> 185 </li> 186 187 188 189 190 191 192 193 194 195 196 <li class="md-nav__item"> 197 <a href="ft2-index.html" class="md-nav__link"> 198 Index 199 </a> 200 </li> 201 202 203 204 205 206 207 208 209 210 211 212 <li class="md-nav__item md-nav__item--nested"> 213 214 215 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3" type="checkbox" id="__nav_3" > 216 217 <label class="md-nav__link" for="__nav_3"> 218 General Remarks 219 <span class="md-nav__icon md-icon"></span> 220 </label> 221 <nav class="md-nav" aria-label="General Remarks" data-md-level="1"> 222 <label class="md-nav__title" for="__nav_3"> 223 <span class="md-nav__icon md-icon"></span> 224 General Remarks 225 </label> 226 <ul class="md-nav__list" data-md-scrollfix> 227 228 229 230 231 232 <li class="md-nav__item"> 233 <a href="ft2-preamble.html" class="md-nav__link"> 234 Preamble 235 </a> 236 </li> 237 238 239 240 241 242 243 244 <li class="md-nav__item"> 245 <a href="ft2-header_inclusion.html" class="md-nav__link"> 246 FreeType's header inclusion scheme 247 </a> 248 </li> 249 250 251 252 253 254 255 256 <li class="md-nav__item"> 257 <a href="ft2-user_allocation.html" class="md-nav__link"> 258 User allocation 259 </a> 260 </li> 261 262 263 264 </ul> 265 </nav> 266 </li> 267 268 269 270 271 272 273 274 275 276 277 278 <li class="md-nav__item md-nav__item--nested"> 279 280 281 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4" type="checkbox" id="__nav_4" > 282 283 <label class="md-nav__link" for="__nav_4"> 284 Core API 285 <span class="md-nav__icon md-icon"></span> 286 </label> 287 <nav class="md-nav" aria-label="Core API" data-md-level="1"> 288 <label class="md-nav__title" for="__nav_4"> 289 <span class="md-nav__icon md-icon"></span> 290 Core API 291 </label> 292 <ul class="md-nav__list" data-md-scrollfix> 293 294 295 296 297 298 <li class="md-nav__item"> 299 <a href="ft2-version.html" class="md-nav__link"> 300 FreeType Version 301 </a> 302 </li> 303 304 305 306 307 308 309 310 <li class="md-nav__item"> 311 <a href="ft2-basic_types.html" class="md-nav__link"> 312 Basic Data Types 313 </a> 314 </li> 315 316 317 318 319 320 321 322 <li class="md-nav__item"> 323 <a href="ft2-base_interface.html" class="md-nav__link"> 324 Base Interface 325 </a> 326 </li> 327 328 329 330 331 332 333 334 <li class="md-nav__item"> 335 <a href="ft2-glyph_variants.html" class="md-nav__link"> 336 Unicode Variation Sequences 337 </a> 338 </li> 339 340 341 342 343 344 345 346 <li class="md-nav__item"> 347 <a href="ft2-color_management.html" class="md-nav__link"> 348 Glyph Color Management 349 </a> 350 </li> 351 352 353 354 355 356 357 358 <li class="md-nav__item"> 359 <a href="ft2-layer_management.html" class="md-nav__link"> 360 Glyph Layer Management 361 </a> 362 </li> 363 364 365 366 367 368 369 370 <li class="md-nav__item"> 371 <a href="ft2-glyph_management.html" class="md-nav__link"> 372 Glyph Management 373 </a> 374 </li> 375 376 377 378 379 380 381 382 <li class="md-nav__item"> 383 <a href="ft2-mac_specific.html" class="md-nav__link"> 384 Mac Specific Interface 385 </a> 386 </li> 387 388 389 390 391 392 393 394 <li class="md-nav__item"> 395 <a href="ft2-sizes_management.html" class="md-nav__link"> 396 Size Management 397 </a> 398 </li> 399 400 401 402 403 404 405 406 <li class="md-nav__item"> 407 <a href="ft2-header_file_macros.html" class="md-nav__link"> 408 Header File Macros 409 </a> 410 </li> 411 412 413 414 </ul> 415 </nav> 416 </li> 417 418 419 420 421 422 423 424 425 426 427 428 <li class="md-nav__item md-nav__item--nested"> 429 430 431 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5" type="checkbox" id="__nav_5" > 432 433 <label class="md-nav__link" for="__nav_5"> 434 Format-Specific API 435 <span class="md-nav__icon md-icon"></span> 436 </label> 437 <nav class="md-nav" aria-label="Format-Specific API" data-md-level="1"> 438 <label class="md-nav__title" for="__nav_5"> 439 <span class="md-nav__icon md-icon"></span> 440 Format-Specific API 441 </label> 442 <ul class="md-nav__list" data-md-scrollfix> 443 444 445 446 447 448 <li class="md-nav__item"> 449 <a href="ft2-multiple_masters.html" class="md-nav__link"> 450 Multiple Masters 451 </a> 452 </li> 453 454 455 456 457 458 459 460 <li class="md-nav__item"> 461 <a href="ft2-truetype_tables.html" class="md-nav__link"> 462 TrueType Tables 463 </a> 464 </li> 465 466 467 468 469 470 471 472 <li class="md-nav__item"> 473 <a href="ft2-type1_tables.html" class="md-nav__link"> 474 Type 1 Tables 475 </a> 476 </li> 477 478 479 480 481 482 483 484 <li class="md-nav__item"> 485 <a href="ft2-sfnt_names.html" class="md-nav__link"> 486 SFNT Names 487 </a> 488 </li> 489 490 491 492 493 494 495 496 <li class="md-nav__item"> 497 <a href="ft2-bdf_fonts.html" class="md-nav__link"> 498 BDF and PCF Files 499 </a> 500 </li> 501 502 503 504 505 506 507 508 <li class="md-nav__item"> 509 <a href="ft2-cid_fonts.html" class="md-nav__link"> 510 CID Fonts 511 </a> 512 </li> 513 514 515 516 517 518 519 520 <li class="md-nav__item"> 521 <a href="ft2-pfr_fonts.html" class="md-nav__link"> 522 PFR Fonts 523 </a> 524 </li> 525 526 527 528 529 530 531 532 <li class="md-nav__item"> 533 <a href="ft2-winfnt_fonts.html" class="md-nav__link"> 534 Window FNT Files 535 </a> 536 </li> 537 538 539 540 541 542 543 544 <li class="md-nav__item"> 545 <a href="ft2-svg_fonts.html" class="md-nav__link"> 546 OpenType SVG Fonts 547 </a> 548 </li> 549 550 551 552 553 554 555 556 <li class="md-nav__item"> 557 <a href="ft2-font_formats.html" class="md-nav__link"> 558 Font Formats 559 </a> 560 </li> 561 562 563 564 565 566 567 568 <li class="md-nav__item"> 569 <a href="ft2-gasp_table.html" class="md-nav__link"> 570 Gasp Table 571 </a> 572 </li> 573 574 575 576 </ul> 577 </nav> 578 </li> 579 580 581 582 583 584 585 586 587 588 589 590 591 592 <li class="md-nav__item md-nav__item--active md-nav__item--nested"> 593 594 595 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" checked> 596 597 <label class="md-nav__link" for="__nav_6"> 598 Controlling FreeType Modules 599 <span class="md-nav__icon md-icon"></span> 600 </label> 601 <nav class="md-nav" aria-label="Controlling FreeType Modules" data-md-level="1"> 602 <label class="md-nav__title" for="__nav_6"> 603 <span class="md-nav__icon md-icon"></span> 604 Controlling FreeType Modules 605 </label> 606 <ul class="md-nav__list" data-md-scrollfix> 607 608 609 610 611 612 <li class="md-nav__item"> 613 <a href="ft2-auto_hinter.html" class="md-nav__link"> 614 The auto-hinter 615 </a> 616 </li> 617 618 619 620 621 622 623 624 <li class="md-nav__item"> 625 <a href="ft2-cff_driver.html" class="md-nav__link"> 626 The CFF driver 627 </a> 628 </li> 629 630 631 632 633 634 635 636 <li class="md-nav__item"> 637 <a href="ft2-t1_cid_driver.html" class="md-nav__link"> 638 The Type 1 and CID drivers 639 </a> 640 </li> 641 642 643 644 645 646 647 648 <li class="md-nav__item"> 649 <a href="ft2-tt_driver.html" class="md-nav__link"> 650 The TrueType driver 651 </a> 652 </li> 653 654 655 656 657 658 659 660 <li class="md-nav__item"> 661 <a href="ft2-pcf_driver.html" class="md-nav__link"> 662 The PCF driver 663 </a> 664 </li> 665 666 667 668 669 670 671 672 <li class="md-nav__item"> 673 <a href="ft2-ot_svg_driver.html" class="md-nav__link"> 674 The SVG driver 675 </a> 676 </li> 677 678 679 680 681 682 683 684 <li class="md-nav__item"> 685 <a href="ft2-properties.html" class="md-nav__link"> 686 Driver properties 687 </a> 688 </li> 689 690 691 692 693 694 695 696 <li class="md-nav__item"> 697 <a href="ft2-parameter_tags.html" class="md-nav__link"> 698 Parameter Tags 699 </a> 700 </li> 701 702 703 704 705 706 707 708 709 710 <li class="md-nav__item md-nav__item--active"> 711 712 <input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc"> 713 714 715 716 717 718 <label class="md-nav__link md-nav__link--active" for="__toc"> 719 Subpixel Rendering 720 <span class="md-nav__icon md-icon"></span> 721 </label> 722 723 <a href="ft2-lcd_rendering.html" class="md-nav__link md-nav__link--active"> 724 Subpixel Rendering 725 </a> 726 727 728<nav class="md-nav md-nav--secondary" aria-label="Table of contents"> 729 730 731 732 733 734 735 <label class="md-nav__title" for="__toc"> 736 <span class="md-nav__icon md-icon"></span> 737 Table of contents 738 </label> 739 <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix> 740 741 <li class="md-nav__item"> 742 <a href="#synopsis" class="md-nav__link"> 743 Synopsis 744 </a> 745 746</li> 747 748 <li class="md-nav__item"> 749 <a href="#ft_lcdfilter" class="md-nav__link"> 750 FT_LcdFilter 751 </a> 752 753</li> 754 755 <li class="md-nav__item"> 756 <a href="#ft_library_setlcdfilter" class="md-nav__link"> 757 FT_Library_SetLcdFilter 758 </a> 759 760</li> 761 762 <li class="md-nav__item"> 763 <a href="#ft_library_setlcdfilterweights" class="md-nav__link"> 764 FT_Library_SetLcdFilterWeights 765 </a> 766 767</li> 768 769 <li class="md-nav__item"> 770 <a href="#ft_lcdfivetapfilter" class="md-nav__link"> 771 FT_LcdFiveTapFilter 772 </a> 773 774</li> 775 776 <li class="md-nav__item"> 777 <a href="#ft_library_setlcdgeometry" class="md-nav__link"> 778 FT_Library_SetLcdGeometry 779 </a> 780 781</li> 782 783 </ul> 784 785</nav> 786 787 </li> 788 789 790 791 </ul> 792 </nav> 793 </li> 794 795 796 797 798 799 800 801 802 803 804 805 <li class="md-nav__item md-nav__item--nested"> 806 807 808 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7" type="checkbox" id="__nav_7" > 809 810 <label class="md-nav__link" for="__nav_7"> 811 Cache Sub-System 812 <span class="md-nav__icon md-icon"></span> 813 </label> 814 <nav class="md-nav" aria-label="Cache Sub-System" data-md-level="1"> 815 <label class="md-nav__title" for="__nav_7"> 816 <span class="md-nav__icon md-icon"></span> 817 Cache Sub-System 818 </label> 819 <ul class="md-nav__list" data-md-scrollfix> 820 821 822 823 824 825 <li class="md-nav__item"> 826 <a href="ft2-cache_subsystem.html" class="md-nav__link"> 827 Cache Sub-System 828 </a> 829 </li> 830 831 832 833 </ul> 834 </nav> 835 </li> 836 837 838 839 840 841 842 843 844 845 846 847 <li class="md-nav__item md-nav__item--nested"> 848 849 850 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_8" type="checkbox" id="__nav_8" > 851 852 <label class="md-nav__link" for="__nav_8"> 853 Support API 854 <span class="md-nav__icon md-icon"></span> 855 </label> 856 <nav class="md-nav" aria-label="Support API" data-md-level="1"> 857 <label class="md-nav__title" for="__nav_8"> 858 <span class="md-nav__icon md-icon"></span> 859 Support API 860 </label> 861 <ul class="md-nav__list" data-md-scrollfix> 862 863 864 865 866 867 <li class="md-nav__item"> 868 <a href="ft2-computations.html" class="md-nav__link"> 869 Computations 870 </a> 871 </li> 872 873 874 875 876 877 878 879 <li class="md-nav__item"> 880 <a href="ft2-list_processing.html" class="md-nav__link"> 881 List Processing 882 </a> 883 </li> 884 885 886 887 888 889 890 891 <li class="md-nav__item"> 892 <a href="ft2-outline_processing.html" class="md-nav__link"> 893 Outline Processing 894 </a> 895 </li> 896 897 898 899 900 901 902 903 <li class="md-nav__item"> 904 <a href="ft2-quick_advance.html" class="md-nav__link"> 905 Quick retrieval of advance values 906 </a> 907 </li> 908 909 910 911 912 913 914 915 <li class="md-nav__item"> 916 <a href="ft2-bitmap_handling.html" class="md-nav__link"> 917 Bitmap Handling 918 </a> 919 </li> 920 921 922 923 924 925 926 927 <li class="md-nav__item"> 928 <a href="ft2-raster.html" class="md-nav__link"> 929 Scanline Converter 930 </a> 931 </li> 932 933 934 935 936 937 938 939 <li class="md-nav__item"> 940 <a href="ft2-glyph_stroker.html" class="md-nav__link"> 941 Glyph Stroker 942 </a> 943 </li> 944 945 946 947 948 949 950 951 <li class="md-nav__item"> 952 <a href="ft2-system_interface.html" class="md-nav__link"> 953 System Interface 954 </a> 955 </li> 956 957 958 959 960 961 962 963 <li class="md-nav__item"> 964 <a href="ft2-module_management.html" class="md-nav__link"> 965 Module Management 966 </a> 967 </li> 968 969 970 971 972 973 974 975 <li class="md-nav__item"> 976 <a href="ft2-gzip.html" class="md-nav__link"> 977 GZIP Streams 978 </a> 979 </li> 980 981 982 983 984 985 986 987 <li class="md-nav__item"> 988 <a href="ft2-lzw.html" class="md-nav__link"> 989 LZW Streams 990 </a> 991 </li> 992 993 994 995 996 997 998 999 <li class="md-nav__item"> 1000 <a href="ft2-bzip2.html" class="md-nav__link"> 1001 BZIP2 Streams 1002 </a> 1003 </li> 1004 1005 1006 1007 1008 1009 1010 1011 <li class="md-nav__item"> 1012 <a href="ft2-debugging_apis.html" class="md-nav__link"> 1013 External Debugging APIs 1014 </a> 1015 </li> 1016 1017 1018 1019 </ul> 1020 </nav> 1021 </li> 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 <li class="md-nav__item md-nav__item--nested"> 1034 1035 1036 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_9" type="checkbox" id="__nav_9" > 1037 1038 <label class="md-nav__link" for="__nav_9"> 1039 Error Codes 1040 <span class="md-nav__icon md-icon"></span> 1041 </label> 1042 <nav class="md-nav" aria-label="Error Codes" data-md-level="1"> 1043 <label class="md-nav__title" for="__nav_9"> 1044 <span class="md-nav__icon md-icon"></span> 1045 Error Codes 1046 </label> 1047 <ul class="md-nav__list" data-md-scrollfix> 1048 1049 1050 1051 1052 1053 <li class="md-nav__item"> 1054 <a href="ft2-error_enumerations.html" class="md-nav__link"> 1055 Error Enumerations 1056 </a> 1057 </li> 1058 1059 1060 1061 1062 1063 1064 1065 <li class="md-nav__item"> 1066 <a href="ft2-error_code_values.html" class="md-nav__link"> 1067 Error Code Values 1068 </a> 1069 </li> 1070 1071 1072 1073 </ul> 1074 </nav> 1075 </li> 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 <li class="md-nav__item md-nav__item--nested"> 1088 1089 1090 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_10" type="checkbox" id="__nav_10" > 1091 1092 <label class="md-nav__link" for="__nav_10"> 1093 Miscellaneous 1094 <span class="md-nav__icon md-icon"></span> 1095 </label> 1096 <nav class="md-nav" aria-label="Miscellaneous" data-md-level="1"> 1097 <label class="md-nav__title" for="__nav_10"> 1098 <span class="md-nav__icon md-icon"></span> 1099 Miscellaneous 1100 </label> 1101 <ul class="md-nav__list" data-md-scrollfix> 1102 1103 1104 1105 1106 1107 <li class="md-nav__item"> 1108 <a href="ft2-gx_validation.html" class="md-nav__link"> 1109 TrueTypeGX/AAT Validation 1110 </a> 1111 </li> 1112 1113 1114 1115 1116 1117 1118 1119 <li class="md-nav__item"> 1120 <a href="ft2-incremental.html" class="md-nav__link"> 1121 Incremental Loading 1122 </a> 1123 </li> 1124 1125 1126 1127 1128 1129 1130 1131 <li class="md-nav__item"> 1132 <a href="ft2-truetype_engine.html" class="md-nav__link"> 1133 The TrueType Engine 1134 </a> 1135 </li> 1136 1137 1138 1139 1140 1141 1142 1143 <li class="md-nav__item"> 1144 <a href="ft2-ot_validation.html" class="md-nav__link"> 1145 OpenType Validation 1146 </a> 1147 </li> 1148 1149 1150 1151 </ul> 1152 </nav> 1153 </li> 1154 1155 1156 1157 </ul> 1158</nav> 1159 </div> 1160 </div> 1161 </div> 1162 1163 1164 1165 <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" > 1166 <div class="md-sidebar__scrollwrap"> 1167 <div class="md-sidebar__inner"> 1168 1169<nav class="md-nav md-nav--secondary" aria-label="Table of contents"> 1170 1171 1172 1173 1174 1175 1176 <label class="md-nav__title" for="__toc"> 1177 <span class="md-nav__icon md-icon"></span> 1178 Table of contents 1179 </label> 1180 <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix> 1181 1182 <li class="md-nav__item"> 1183 <a href="#synopsis" class="md-nav__link"> 1184 Synopsis 1185 </a> 1186 1187</li> 1188 1189 <li class="md-nav__item"> 1190 <a href="#ft_lcdfilter" class="md-nav__link"> 1191 FT_LcdFilter 1192 </a> 1193 1194</li> 1195 1196 <li class="md-nav__item"> 1197 <a href="#ft_library_setlcdfilter" class="md-nav__link"> 1198 FT_Library_SetLcdFilter 1199 </a> 1200 1201</li> 1202 1203 <li class="md-nav__item"> 1204 <a href="#ft_library_setlcdfilterweights" class="md-nav__link"> 1205 FT_Library_SetLcdFilterWeights 1206 </a> 1207 1208</li> 1209 1210 <li class="md-nav__item"> 1211 <a href="#ft_lcdfivetapfilter" class="md-nav__link"> 1212 FT_LcdFiveTapFilter 1213 </a> 1214 1215</li> 1216 1217 <li class="md-nav__item"> 1218 <a href="#ft_library_setlcdgeometry" class="md-nav__link"> 1219 FT_Library_SetLcdGeometry 1220 </a> 1221 1222</li> 1223 1224 </ul> 1225 1226</nav> 1227 </div> 1228 </div> 1229 </div> 1230 1231 1232 <div class="md-content" data-md-component="content"> 1233 <article class="md-content__inner md-typeset"> 1234 1235 1236 1237 <p><a href="https://www.freetype.org">FreeType</a> » <a href="../">Docs</a> » <a href="index.html#controlling-freetype-modules">Controlling FreeType Modules</a> » Subpixel Rendering</p> 1238<hr /> 1239<h1 id="subpixel-rendering">Subpixel Rendering<a class="headerlink" href="#subpixel-rendering" title="Permanent link">¶</a></h1> 1240<h2 id="synopsis">Synopsis<a class="headerlink" href="#synopsis" title="Permanent link">¶</a></h2> 1241<p>FreeType provides two alternative subpixel rendering technologies. Should you define <code>FT_CONFIG_OPTION_SUBPIXEL_RENDERING</code> in your <code>ftoption.h</code> file, this enables ClearType-style rendering. Otherwise, Harmony LCD rendering is enabled. These technologies are controlled differently and API described below, although always available, performs its function when appropriate method is enabled and does nothing otherwise.</p> 1242<p>ClearType-style LCD rendering exploits the color-striped structure of LCD pixels, increasing the available resolution in the direction of the stripe (usually horizontal RGB) by a factor of 3. Using the subpixel coverages unfiltered can create severe color fringes especially when rendering thin features. Indeed, to produce black-on-white text, the nearby color subpixels must be dimmed evenly. Therefore, an equalizing 5-tap FIR filter should be applied to subpixel coverages regardless of pixel boundaries and should have these properties:</p> 1243<ol> 1244<li> 1245<p>It should be symmetrical, like { a, b, c, b, a }, to avoid any shifts in appearance.</p> 1246</li> 1247<li> 1248<p>It should be color-balanced, meaning a + b = c, to reduce color fringes by distributing the computed coverage for one subpixel to all subpixels equally.</p> 1249</li> 1250<li> 1251<p>It should be normalized, meaning 2a + 2b + c = 1.0 to maintain overall brightness.</p> 1252</li> 1253</ol> 1254<p>Boxy 3-tap filter {0, ⅓, ⅓, ⅓, 0} is sharper but is less forgiving of non-ideal gamma curves of a screen (and viewing angles), beveled filters are fuzzier but more tolerant.</p> 1255<p>Use the <code><a href="ft2-lcd_rendering.html#ft_library_setlcdfilter">FT_Library_SetLcdFilter</a></code> or <code><a href="ft2-lcd_rendering.html#ft_library_setlcdfilterweights">FT_Library_SetLcdFilterWeights</a></code> API to specify a low-pass filter, which is then applied to subpixel-rendered bitmaps generated through <code><a href="ft2-base_interface.html#ft_render_glyph">FT_Render_Glyph</a></code>.</p> 1256<p>Harmony LCD rendering is suitable to panels with any regular subpixel structure, not just monitors with 3 color striped subpixels, as long as the color subpixels have fixed positions relative to the pixel center. In this case, each color channel can be rendered separately after shifting the outline opposite to the subpixel shift so that the coverage maps are aligned. This method is immune to color fringes because the shifts do not change integral coverage.</p> 1257<p>The subpixel geometry must be specified by xy-coordinates for each subpixel. By convention they may come in the RGB order: {{-⅓, 0}, {0, 0}, {⅓, 0}} for standard RGB striped panel or {{-⅙, ¼}, {-⅙, -¼}, {⅓, 0}} for a certain PenTile panel.</p> 1258<p>Use the <code><a href="ft2-lcd_rendering.html#ft_library_setlcdgeometry">FT_Library_SetLcdGeometry</a></code> API to specify subpixel positions. If one follows the RGB order convention, the same order applies to the resulting <code><a href="ft2-basic_types.html#ft_pixel_mode">FT_PIXEL_MODE_LCD</a></code> and <code><a href="ft2-basic_types.html#ft_pixel_mode">FT_PIXEL_MODE_LCD_V</a></code> bitmaps. Note, however, that the coordinate frame for the latter must be rotated clockwise. Harmony with default LCD geometry is equivalent to ClearType with light filter.</p> 1259<p>As a result of ClearType filtering or Harmony shifts, the resulting dimensions of LCD bitmaps can be slightly wider or taller than the dimensions the original outline with regard to the pixel grid. For example, for <code><a href="ft2-base_interface.html#ft_render_mode">FT_RENDER_MODE_LCD</a></code>, the filter adds 2 subpixels to the left, and 2 subpixels to the right. The bitmap offset values are adjusted accordingly, so clients shouldn't need to modify their layout and glyph positioning code when enabling the filter.</p> 1260<p>The ClearType and Harmony rendering is applicable to glyph bitmaps rendered through <code><a href="ft2-base_interface.html#ft_render_glyph">FT_Render_Glyph</a></code>, <code><a href="ft2-base_interface.html#ft_load_glyph">FT_Load_Glyph</a></code>, <code><a href="ft2-base_interface.html#ft_load_char">FT_Load_Char</a></code>, and <code><a href="ft2-glyph_management.html#ft_glyph_to_bitmap">FT_Glyph_To_Bitmap</a></code>, when <code><a href="ft2-base_interface.html#ft_render_mode">FT_RENDER_MODE_LCD</a></code> or <code><a href="ft2-base_interface.html#ft_render_mode">FT_RENDER_MODE_LCD_V</a></code> is specified. This API does not control <code><a href="ft2-outline_processing.html#ft_outline_render">FT_Outline_Render</a></code> and <code><a href="ft2-outline_processing.html#ft_outline_get_bitmap">FT_Outline_Get_Bitmap</a></code>.</p> 1261<p>The described algorithms can completely remove color artefacts when combined with gamma-corrected alpha blending in linear space. Each of the 3 alpha values (subpixels) must by independently used to blend one color channel. That is, red alpha blends the red channel of the text color with the red channel of the background pixel.</p> 1262<h2 id="ft_lcdfilter">FT_LcdFilter<a class="headerlink" href="#ft_lcdfilter" title="Permanent link">¶</a></h2> 1263<p>Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h).</p> 1264<div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">enum</span> FT_LcdFilter_ 1265 { 1266 <a href="ft2-lcd_rendering.html#ft_lcd_filter_none">FT_LCD_FILTER_NONE</a> = 0, 1267 <a href="ft2-lcd_rendering.html#ft_lcd_filter_default">FT_LCD_FILTER_DEFAULT</a> = 1, 1268 <a href="ft2-lcd_rendering.html#ft_lcd_filter_light">FT_LCD_FILTER_LIGHT</a> = 2, 1269 <a href="ft2-lcd_rendering.html#ft_lcd_filter_legacy1">FT_LCD_FILTER_LEGACY1</a> = 3, 1270 <a href="ft2-lcd_rendering.html#ft_lcd_filter_legacy">FT_LCD_FILTER_LEGACY</a> = 16, 1271 1272 FT_LCD_FILTER_MAX /* do not remove */ 1273 1274 } <b>FT_LcdFilter</b>; 1275</code></pre></div> 1276 1277<p>A list of values to identify various types of LCD filters.</p> 1278<h4>values</h4> 1279<table class="fields"> 1280<tr><td class="val" id="ft_lcd_filter_none">FT_LCD_FILTER_NONE</td><td class="desc"> 1281<p>Do not perform filtering. When used with subpixel rendering, this results in sometimes severe color fringes.</p> 1282</td></tr> 1283<tr><td class="val" id="ft_lcd_filter_default">FT_LCD_FILTER_DEFAULT</td><td class="desc"> 1284<p>This is a beveled, normalized, and color-balanced five-tap filter with weights of [0x08 0x4D 0x56 0x4D 0x08] in 1/256th units.</p> 1285</td></tr> 1286<tr><td class="val" id="ft_lcd_filter_light">FT_LCD_FILTER_LIGHT</td><td class="desc"> 1287<p>this is a boxy, normalized, and color-balanced three-tap filter with weights of [0x00 0x55 0x56 0x55 0x00] in 1/256th units.</p> 1288</td></tr> 1289<tr><td class="val" id="ft_lcd_filter_legacy">FT_LCD_FILTER_LEGACY</td><td class="desc"> 1290 1291</td></tr> 1292<tr><td class="val" id="ft_lcd_filter_legacy1">FT_LCD_FILTER_LEGACY1</td><td class="desc"> 1293<p>This filter corresponds to the original libXft color filter. It provides high contrast output but can exhibit really bad color fringes if glyphs are not extremely well hinted to the pixel grid. This filter is only provided for comparison purposes, and might be disabled or stay unsupported in the future. The second value is provided for compatibility with FontConfig, which historically used different enumeration, sometimes incorrectly forwarded to FreeType.</p> 1294</td></tr> 1295</table> 1296 1297<h4>since</h4> 1298 1299<p>2.3.0 (<code>FT_LCD_FILTER_LEGACY1</code> since 2.6.2)</p> 1300<hr> 1301 1302<h2 id="ft_library_setlcdfilter">FT_Library_SetLcdFilter<a class="headerlink" href="#ft_library_setlcdfilter" title="Permanent link">¶</a></h2> 1303<p>Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h).</p> 1304<div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> ) 1305 <b>FT_Library_SetLcdFilter</b>( <a href="ft2-base_interface.html#ft_library">FT_Library</a> library, 1306 <a href="ft2-lcd_rendering.html#ft_lcdfilter">FT_LcdFilter</a> filter ); 1307</code></pre></div> 1308 1309<p>This function is used to change filter applied to LCD decimated bitmaps, like the ones used when calling <code><a href="ft2-base_interface.html#ft_render_glyph">FT_Render_Glyph</a></code> with <code><a href="ft2-base_interface.html#ft_render_mode">FT_RENDER_MODE_LCD</a></code> or <code><a href="ft2-base_interface.html#ft_render_mode">FT_RENDER_MODE_LCD_V</a></code>.</p> 1310<h4>input</h4> 1311<table class="fields"> 1312<tr><td class="val" id="library">library</td><td class="desc"> 1313<p>A handle to the target library instance.</p> 1314</td></tr> 1315<tr><td class="val" id="filter">filter</td><td class="desc"> 1316<p>The filter type.</p> 1317<p>You can use <code><a href="ft2-lcd_rendering.html#ft_lcdfilter">FT_LCD_FILTER_NONE</a></code> here to disable this feature, or <code><a href="ft2-lcd_rendering.html#ft_lcdfilter">FT_LCD_FILTER_DEFAULT</a></code> to use a default filter that should work well on most LCD screens.</p> 1318</td></tr> 1319</table> 1320 1321<h4>return</h4> 1322 1323<p>FreeType error code. 0 means success.</p> 1324<h4>note</h4> 1325 1326<p>Since 2.10.3 the LCD filtering is enabled with <code><a href="ft2-lcd_rendering.html#ft_lcdfilter">FT_LCD_FILTER_DEFAULT</a></code>. It is no longer necessary to call this function explicitly except to choose a different filter or disable filtering altogether with <code><a href="ft2-lcd_rendering.html#ft_lcdfilter">FT_LCD_FILTER_NONE</a></code>.</p> 1327<p>This function does nothing but returns <code>FT_Err_Unimplemented_Feature</code> if the configuration macro <code>FT_CONFIG_OPTION_SUBPIXEL_RENDERING</code> is not defined in your build of the library.</p> 1328<h4>since</h4> 1329 1330<p>2.3.0</p> 1331<hr> 1332 1333<h2 id="ft_library_setlcdfilterweights">FT_Library_SetLcdFilterWeights<a class="headerlink" href="#ft_library_setlcdfilterweights" title="Permanent link">¶</a></h2> 1334<p>Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h).</p> 1335<div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> ) 1336 <b>FT_Library_SetLcdFilterWeights</b>( <a href="ft2-base_interface.html#ft_library">FT_Library</a> library, 1337 <span class="keyword">unsigned</span> <span class="keyword">char</span> *weights ); 1338</code></pre></div> 1339 1340<p>This function can be used to enable LCD filter with custom weights, instead of using presets in <code><a href="ft2-lcd_rendering.html#ft_library_setlcdfilter">FT_Library_SetLcdFilter</a></code>.</p> 1341<h4>input</h4> 1342<table class="fields"> 1343<tr><td class="val" id="library">library</td><td class="desc"> 1344<p>A handle to the target library instance.</p> 1345</td></tr> 1346<tr><td class="val" id="weights">weights</td><td class="desc"> 1347<p>A pointer to an array; the function copies the first five bytes and uses them to specify the filter weights in 1/256th units.</p> 1348</td></tr> 1349</table> 1350 1351<h4>return</h4> 1352 1353<p>FreeType error code. 0 means success.</p> 1354<h4>note</h4> 1355 1356<p>This function does nothing but returns <code>FT_Err_Unimplemented_Feature</code> if the configuration macro <code>FT_CONFIG_OPTION_SUBPIXEL_RENDERING</code> is not defined in your build of the library.</p> 1357<p>LCD filter weights can also be set per face using <code><a href="ft2-base_interface.html#ft_face_properties">FT_Face_Properties</a></code> with <code><a href="ft2-parameter_tags.html#ft_param_tag_lcd_filter_weights">FT_PARAM_TAG_LCD_FILTER_WEIGHTS</a></code>.</p> 1358<h4>since</h4> 1359 1360<p>2.4.0</p> 1361<hr> 1362 1363<h2 id="ft_lcdfivetapfilter">FT_LcdFiveTapFilter<a class="headerlink" href="#ft_lcdfivetapfilter" title="Permanent link">¶</a></h2> 1364<p>Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h).</p> 1365<div class = "codehilite"><pre><code>#<span class="keyword">define</span> FT_LCD_FILTER_FIVE_TAPS 5 1366 1367 <span class="keyword">typedef</span> <a href="ft2-basic_types.html#ft_byte">FT_Byte</a> <b>FT_LcdFiveTapFilter</b>[FT_LCD_FILTER_FIVE_TAPS]; 1368</code></pre></div> 1369 1370<p>A typedef for passing the five LCD filter weights to <code><a href="ft2-base_interface.html#ft_face_properties">FT_Face_Properties</a></code> within an <code><a href="ft2-base_interface.html#ft_parameter">FT_Parameter</a></code> structure.</p> 1371<h4>since</h4> 1372 1373<p>2.8</p> 1374<hr> 1375 1376<h2 id="ft_library_setlcdgeometry">FT_Library_SetLcdGeometry<a class="headerlink" href="#ft_library_setlcdgeometry" title="Permanent link">¶</a></h2> 1377<p>Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h).</p> 1378<div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> ) 1379 <b>FT_Library_SetLcdGeometry</b>( <a href="ft2-base_interface.html#ft_library">FT_Library</a> library, 1380 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a> sub[3] ); 1381</code></pre></div> 1382 1383<p>This function can be used to modify default positions of color subpixels, which controls Harmony LCD rendering.</p> 1384<h4>input</h4> 1385<table class="fields"> 1386<tr><td class="val" id="library">library</td><td class="desc"> 1387<p>A handle to the target library instance.</p> 1388</td></tr> 1389<tr><td class="val" id="sub">sub</td><td class="desc"> 1390<p>A pointer to an array of 3 vectors in 26.6 fractional pixel format; the function modifies the default values, see the note below.</p> 1391</td></tr> 1392</table> 1393 1394<h4>return</h4> 1395 1396<p>FreeType error code. 0 means success.</p> 1397<h4>note</h4> 1398 1399<p>Subpixel geometry examples:</p> 1400<ul> 1401<li> 1402<p>{{-21, 0}, {0, 0}, {21, 0}} is the default, corresponding to 3 color stripes shifted by a third of a pixel. This could be an RGB panel.</p> 1403</li> 1404<li> 1405<p>{{21, 0}, {0, 0}, {-21, 0}} looks the same as the default but can specify a BGR panel instead, while keeping the bitmap in the same RGB888 format.</p> 1406</li> 1407<li> 1408<p>{{0, 21}, {0, 0}, {0, -21}} is the vertical RGB, but the bitmap stays RGB888 as a result.</p> 1409</li> 1410<li> 1411<p>{{-11, 16}, {-11, -16}, {22, 0}} is a certain PenTile arrangement.</p> 1412</li> 1413</ul> 1414<p>This function does nothing and returns <code>FT_Err_Unimplemented_Feature</code> in the context of ClearType-style subpixel rendering when <code>FT_CONFIG_OPTION_SUBPIXEL_RENDERING</code> is defined in your build of the library.</p> 1415<h4>since</h4> 1416 1417<p>2.10.0</p> 1418<hr> 1419 1420 1421 1422 1423 1424 1425 1426 </article> 1427 </div> 1428 </div> 1429 1430 </main> 1431 1432 1433<footer class="md-footer"> 1434 1435 <nav class="md-footer__inner md-grid" aria-label="Footer"> 1436 1437 1438 <a href="ft2-parameter_tags.html" class="md-footer__link md-footer__link--prev" aria-label="Previous: Parameter Tags" rel="prev"> 1439 <div class="md-footer__button md-icon"> 1440 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg> 1441 </div> 1442 <div class="md-footer__title"> 1443 <div class="md-ellipsis"> 1444 <span class="md-footer__direction"> 1445 Previous 1446 </span> 1447 Parameter Tags 1448 </div> 1449 </div> 1450 </a> 1451 1452 1453 1454 <a href="ft2-cache_subsystem.html" class="md-footer__link md-footer__link--next" aria-label="Next: Cache Sub-System" rel="next"> 1455 <div class="md-footer__title"> 1456 <div class="md-ellipsis"> 1457 <span class="md-footer__direction"> 1458 Next 1459 </span> 1460 Cache Sub-System 1461 </div> 1462 </div> 1463 <div class="md-footer__button md-icon"> 1464 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg> 1465 </div> 1466 </a> 1467 1468 </nav> 1469 1470 <div class="md-footer-meta md-typeset"> 1471 <div class="md-footer-meta__inner md-grid"> 1472 <div class="md-footer-copyright"> 1473 1474 <div class="md-footer-copyright__highlight"> 1475 Copyright 2022 <a href = "https://www.freetype.org/license.html">The FreeType Project</a>. 1476 </div> 1477 1478 Made with 1479 <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener"> 1480 Material for MkDocs 1481 </a> 1482 1483 </div> 1484 1485 </div> 1486 </div> 1487</footer> 1488 1489 </div> 1490 <div class="md-dialog" data-md-component="dialog"> 1491 <div class="md-dialog__inner md-typeset"></div> 1492 </div> 1493 <script id="__config" type="application/json">{"base": ".", "features": [], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "search": "assets/javascripts/workers/search.477d984a.min.js", "version": null}</script> 1494 1495 1496 <script src="assets/javascripts/bundle.82b56eb2.min.js"></script> 1497 1498 <script src="javascripts/extra.js"></script> 1499 1500 1501 </body> 1502</html>