3 <html lang="en" class="no-js">
7 <meta name="viewport" content="width=device-width,initial-scale=1">
9 <meta name="description" content="API Reference Documentation for FreeType-2.13.2">
13 <meta name="author" content="FreeType Contributors">
16 <link rel="icon" href="images/favico.ico">
17 <meta name="generator" content="mkdocs-1.4.3, mkdocs-material-7.1.9">
21 <title>Subpixel Rendering - FreeType-2.13.2 API Reference</title>
25 <link rel="stylesheet" href="assets/stylesheets/main.ca7ac06f.min.css">
28 <link rel="stylesheet" href="assets/stylesheets/palette.f1a3b89f.min.css">
32 <meta name="theme-color" content="#4cae4f">
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>
47 <link rel="stylesheet" href="stylesheets/extra.css">
63 <body dir="ltr" data-md-color-scheme="" data-md-color-primary="green" data-md-color-accent="green">
66 <script>function __prefix(e){return new URL(".",location).pathname+"."+e}function __get(e,t=localStorage){return JSON.parse(t.getItem(__prefix(e)))}</script>
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">
74 <a href="#subpixel-rendering" class="md-skip">
79 <div data-md-component="announce">
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.13.2 API Reference" class="md-header__button md-logo" aria-label="FreeType-2.13.2 API Reference" data-md-component="logo">
87 <img src="images/favico.ico" alt="logo">
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>
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.13.2 API Reference
100 <div class="md-header__topic" data-md-component="header-topic">
101 <span class="md-ellipsis">
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>
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>
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>
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">
135 <ol class="md-search-result__list"></ol>
146 <div class="md-container" data-md-component="container">
151 <main class="md-main" data-md-component="main">
152 <div class="md-main__inner md-grid">
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">
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.13.2 API Reference" class="md-nav__button md-logo" aria-label="FreeType-2.13.2 API Reference" data-md-component="logo">
166 <img src="images/favico.ico" alt="logo">
169 FreeType-2.13.2 API Reference
172 <ul class="md-nav__list" data-md-scrollfix>
181 <li class="md-nav__item">
182 <a href="index.html" class="md-nav__link">
196 <li class="md-nav__item">
197 <a href="ft2-index.html" class="md-nav__link">
212 <li class="md-nav__item md-nav__item--nested">
215 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3" type="checkbox" id="__nav_3" >
217 <label class="md-nav__link" for="__nav_3">
219 <span class="md-nav__icon md-icon"></span>
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>
226 <ul class="md-nav__list" data-md-scrollfix>
232 <li class="md-nav__item">
233 <a href="ft2-preamble.html" class="md-nav__link">
244 <li class="md-nav__item">
245 <a href="ft2-header_inclusion.html" class="md-nav__link">
246 FreeType's header inclusion scheme
256 <li class="md-nav__item">
257 <a href="ft2-user_allocation.html" class="md-nav__link">
278 <li class="md-nav__item md-nav__item--nested">
281 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4" type="checkbox" id="__nav_4" >
283 <label class="md-nav__link" for="__nav_4">
285 <span class="md-nav__icon md-icon"></span>
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>
292 <ul class="md-nav__list" data-md-scrollfix>
298 <li class="md-nav__item">
299 <a href="ft2-basic_types.html" class="md-nav__link">
310 <li class="md-nav__item">
311 <a href="ft2-library_setup.html" class="md-nav__link">
322 <li class="md-nav__item">
323 <a href="ft2-face_creation.html" class="md-nav__link">
334 <li class="md-nav__item">
335 <a href="ft2-font_testing_macros.html" class="md-nav__link">
346 <li class="md-nav__item">
347 <a href="ft2-sizing_and_scaling.html" class="md-nav__link">
358 <li class="md-nav__item">
359 <a href="ft2-glyph_retrieval.html" class="md-nav__link">
370 <li class="md-nav__item">
371 <a href="ft2-character_mapping.html" class="md-nav__link">
382 <li class="md-nav__item">
383 <a href="ft2-information_retrieval.html" class="md-nav__link">
384 Information Retrieval
394 <li class="md-nav__item">
395 <a href="ft2-other_api_data.html" class="md-nav__link">
416 <li class="md-nav__item md-nav__item--nested">
419 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5" type="checkbox" id="__nav_5" >
421 <label class="md-nav__link" for="__nav_5">
423 <span class="md-nav__icon md-icon"></span>
425 <nav class="md-nav" aria-label="Extended API" data-md-level="1">
426 <label class="md-nav__title" for="__nav_5">
427 <span class="md-nav__icon md-icon"></span>
430 <ul class="md-nav__list" data-md-scrollfix>
436 <li class="md-nav__item">
437 <a href="ft2-glyph_variants.html" class="md-nav__link">
438 Unicode Variation Sequences
448 <li class="md-nav__item">
449 <a href="ft2-color_management.html" class="md-nav__link">
450 Glyph Color Management
460 <li class="md-nav__item">
461 <a href="ft2-layer_management.html" class="md-nav__link">
462 Glyph Layer Management
472 <li class="md-nav__item">
473 <a href="ft2-glyph_management.html" class="md-nav__link">
484 <li class="md-nav__item">
485 <a href="ft2-mac_specific.html" class="md-nav__link">
486 Mac Specific Interface
496 <li class="md-nav__item">
497 <a href="ft2-sizes_management.html" class="md-nav__link">
508 <li class="md-nav__item">
509 <a href="ft2-header_file_macros.html" class="md-nav__link">
530 <li class="md-nav__item md-nav__item--nested">
533 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" >
535 <label class="md-nav__link" for="__nav_6">
537 <span class="md-nav__icon md-icon"></span>
539 <nav class="md-nav" aria-label="Format-Specific API" data-md-level="1">
540 <label class="md-nav__title" for="__nav_6">
541 <span class="md-nav__icon md-icon"></span>
544 <ul class="md-nav__list" data-md-scrollfix>
550 <li class="md-nav__item">
551 <a href="ft2-multiple_masters.html" class="md-nav__link">
562 <li class="md-nav__item">
563 <a href="ft2-truetype_tables.html" class="md-nav__link">
574 <li class="md-nav__item">
575 <a href="ft2-type1_tables.html" class="md-nav__link">
586 <li class="md-nav__item">
587 <a href="ft2-sfnt_names.html" class="md-nav__link">
598 <li class="md-nav__item">
599 <a href="ft2-bdf_fonts.html" class="md-nav__link">
610 <li class="md-nav__item">
611 <a href="ft2-cid_fonts.html" class="md-nav__link">
622 <li class="md-nav__item">
623 <a href="ft2-pfr_fonts.html" class="md-nav__link">
634 <li class="md-nav__item">
635 <a href="ft2-winfnt_fonts.html" class="md-nav__link">
646 <li class="md-nav__item">
647 <a href="ft2-svg_fonts.html" class="md-nav__link">
658 <li class="md-nav__item">
659 <a href="ft2-font_formats.html" class="md-nav__link">
670 <li class="md-nav__item">
671 <a href="ft2-gasp_table.html" class="md-nav__link">
694 <li class="md-nav__item md-nav__item--active md-nav__item--nested">
697 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7" type="checkbox" id="__nav_7" checked>
699 <label class="md-nav__link" for="__nav_7">
700 Controlling FreeType Modules
701 <span class="md-nav__icon md-icon"></span>
703 <nav class="md-nav" aria-label="Controlling FreeType Modules" data-md-level="1">
704 <label class="md-nav__title" for="__nav_7">
705 <span class="md-nav__icon md-icon"></span>
706 Controlling FreeType Modules
708 <ul class="md-nav__list" data-md-scrollfix>
714 <li class="md-nav__item">
715 <a href="ft2-auto_hinter.html" class="md-nav__link">
726 <li class="md-nav__item">
727 <a href="ft2-cff_driver.html" class="md-nav__link">
738 <li class="md-nav__item">
739 <a href="ft2-t1_cid_driver.html" class="md-nav__link">
740 The Type 1 and CID drivers
750 <li class="md-nav__item">
751 <a href="ft2-tt_driver.html" class="md-nav__link">
762 <li class="md-nav__item">
763 <a href="ft2-pcf_driver.html" class="md-nav__link">
774 <li class="md-nav__item">
775 <a href="ft2-ot_svg_driver.html" class="md-nav__link">
786 <li class="md-nav__item">
787 <a href="ft2-properties.html" class="md-nav__link">
798 <li class="md-nav__item">
799 <a href="ft2-parameter_tags.html" class="md-nav__link">
812 <li class="md-nav__item md-nav__item--active">
814 <input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
820 <label class="md-nav__link md-nav__link--active" for="__toc">
822 <span class="md-nav__icon md-icon"></span>
825 <a href="ft2-lcd_rendering.html" class="md-nav__link md-nav__link--active">
830 <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
837 <label class="md-nav__title" for="__toc">
838 <span class="md-nav__icon md-icon"></span>
841 <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
843 <li class="md-nav__item">
844 <a href="#synopsis" class="md-nav__link">
850 <li class="md-nav__item">
851 <a href="#ft_lcdfilter" class="md-nav__link">
857 <li class="md-nav__item">
858 <a href="#ft_library_setlcdfilter" class="md-nav__link">
859 FT_Library_SetLcdFilter
864 <li class="md-nav__item">
865 <a href="#ft_library_setlcdfilterweights" class="md-nav__link">
866 FT_Library_SetLcdFilterWeights
871 <li class="md-nav__item">
872 <a href="#ft_lcdfivetapfilter" class="md-nav__link">
878 <li class="md-nav__item">
879 <a href="#ft_library_setlcdgeometry" class="md-nav__link">
880 FT_Library_SetLcdGeometry
907 <li class="md-nav__item md-nav__item--nested">
910 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_8" type="checkbox" id="__nav_8" >
912 <label class="md-nav__link" for="__nav_8">
914 <span class="md-nav__icon md-icon"></span>
916 <nav class="md-nav" aria-label="Cache Sub-System" data-md-level="1">
917 <label class="md-nav__title" for="__nav_8">
918 <span class="md-nav__icon md-icon"></span>
921 <ul class="md-nav__list" data-md-scrollfix>
927 <li class="md-nav__item">
928 <a href="ft2-cache_subsystem.html" class="md-nav__link">
949 <li class="md-nav__item md-nav__item--nested">
952 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_9" type="checkbox" id="__nav_9" >
954 <label class="md-nav__link" for="__nav_9">
956 <span class="md-nav__icon md-icon"></span>
958 <nav class="md-nav" aria-label="Support API" data-md-level="1">
959 <label class="md-nav__title" for="__nav_9">
960 <span class="md-nav__icon md-icon"></span>
963 <ul class="md-nav__list" data-md-scrollfix>
969 <li class="md-nav__item">
970 <a href="ft2-computations.html" class="md-nav__link">
981 <li class="md-nav__item">
982 <a href="ft2-list_processing.html" class="md-nav__link">
993 <li class="md-nav__item">
994 <a href="ft2-outline_processing.html" class="md-nav__link">
1005 <li class="md-nav__item">
1006 <a href="ft2-quick_advance.html" class="md-nav__link">
1007 Quick retrieval of advance values
1017 <li class="md-nav__item">
1018 <a href="ft2-bitmap_handling.html" class="md-nav__link">
1029 <li class="md-nav__item">
1030 <a href="ft2-raster.html" class="md-nav__link">
1041 <li class="md-nav__item">
1042 <a href="ft2-glyph_stroker.html" class="md-nav__link">
1053 <li class="md-nav__item">
1054 <a href="ft2-system_interface.html" class="md-nav__link">
1065 <li class="md-nav__item">
1066 <a href="ft2-module_management.html" class="md-nav__link">
1077 <li class="md-nav__item">
1078 <a href="ft2-gzip.html" class="md-nav__link">
1089 <li class="md-nav__item">
1090 <a href="ft2-lzw.html" class="md-nav__link">
1101 <li class="md-nav__item">
1102 <a href="ft2-bzip2.html" class="md-nav__link">
1113 <li class="md-nav__item">
1114 <a href="ft2-debugging_apis.html" class="md-nav__link">
1115 External Debugging APIs
1135 <li class="md-nav__item md-nav__item--nested">
1138 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_10" type="checkbox" id="__nav_10" >
1140 <label class="md-nav__link" for="__nav_10">
1142 <span class="md-nav__icon md-icon"></span>
1144 <nav class="md-nav" aria-label="Error Codes" data-md-level="1">
1145 <label class="md-nav__title" for="__nav_10">
1146 <span class="md-nav__icon md-icon"></span>
1149 <ul class="md-nav__list" data-md-scrollfix>
1155 <li class="md-nav__item">
1156 <a href="ft2-error_enumerations.html" class="md-nav__link">
1167 <li class="md-nav__item">
1168 <a href="ft2-error_code_values.html" class="md-nav__link">
1189 <li class="md-nav__item md-nav__item--nested">
1192 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_11" type="checkbox" id="__nav_11" >
1194 <label class="md-nav__link" for="__nav_11">
1196 <span class="md-nav__icon md-icon"></span>
1198 <nav class="md-nav" aria-label="Miscellaneous" data-md-level="1">
1199 <label class="md-nav__title" for="__nav_11">
1200 <span class="md-nav__icon md-icon"></span>
1203 <ul class="md-nav__list" data-md-scrollfix>
1209 <li class="md-nav__item">
1210 <a href="ft2-gx_validation.html" class="md-nav__link">
1211 TrueTypeGX/AAT Validation
1221 <li class="md-nav__item">
1222 <a href="ft2-incremental.html" class="md-nav__link">
1233 <li class="md-nav__item">
1234 <a href="ft2-truetype_engine.html" class="md-nav__link">
1245 <li class="md-nav__item">
1246 <a href="ft2-ot_validation.html" class="md-nav__link">
1267 <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
1268 <div class="md-sidebar__scrollwrap">
1269 <div class="md-sidebar__inner">
1271 <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
1278 <label class="md-nav__title" for="__toc">
1279 <span class="md-nav__icon md-icon"></span>
1282 <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
1284 <li class="md-nav__item">
1285 <a href="#synopsis" class="md-nav__link">
1291 <li class="md-nav__item">
1292 <a href="#ft_lcdfilter" class="md-nav__link">
1298 <li class="md-nav__item">
1299 <a href="#ft_library_setlcdfilter" class="md-nav__link">
1300 FT_Library_SetLcdFilter
1305 <li class="md-nav__item">
1306 <a href="#ft_library_setlcdfilterweights" class="md-nav__link">
1307 FT_Library_SetLcdFilterWeights
1312 <li class="md-nav__item">
1313 <a href="#ft_lcdfivetapfilter" class="md-nav__link">
1319 <li class="md-nav__item">
1320 <a href="#ft_library_setlcdgeometry" class="md-nav__link">
1321 FT_Library_SetLcdGeometry
1334 <div class="md-content" data-md-component="content">
1335 <article class="md-content__inner md-typeset">
1339 <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>
1341 <h1 id="subpixel-rendering">Subpixel Rendering<a class="headerlink" href="#subpixel-rendering" title="Permanent link">¶</a></h1>
1342 <h2 id="synopsis">Synopsis<a class="headerlink" href="#synopsis" title="Permanent link">¶</a></h2>
1343 <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>
1344 <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>
1347 <p>It should be symmetrical, like { a, b, c, b, a }, to avoid any shifts in appearance.</p>
1350 <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>
1353 <p>It should be normalized, meaning 2a + 2b + c = 1.0 to maintain overall brightness.</p>
1356 <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>
1357 <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-glyph_retrieval.html#ft_render_glyph">FT_Render_Glyph</a></code>.</p>
1358 <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>
1359 <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>
1360 <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>
1361 <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-glyph_retrieval.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>
1362 <p>The ClearType and Harmony rendering is applicable to glyph bitmaps rendered through <code><a href="ft2-glyph_retrieval.html#ft_render_glyph">FT_Render_Glyph</a></code>, <code><a href="ft2-glyph_retrieval.html#ft_load_glyph">FT_Load_Glyph</a></code>, <code><a href="ft2-character_mapping.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-glyph_retrieval.html#ft_render_mode">FT_RENDER_MODE_LCD</a></code> or <code><a href="ft2-glyph_retrieval.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>
1363 <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>
1364 <h2 id="ft_lcdfilter">FT_LcdFilter<a class="headerlink" href="#ft_lcdfilter" title="Permanent link">¶</a></h2>
1365 <p>Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h).</p>
1366 <div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">enum</span> FT_LcdFilter_
1368 <a href="ft2-lcd_rendering.html#ft_lcd_filter_none">FT_LCD_FILTER_NONE</a> = 0,
1369 <a href="ft2-lcd_rendering.html#ft_lcd_filter_default">FT_LCD_FILTER_DEFAULT</a> = 1,
1370 <a href="ft2-lcd_rendering.html#ft_lcd_filter_light">FT_LCD_FILTER_LIGHT</a> = 2,
1371 <a href="ft2-lcd_rendering.html#ft_lcd_filter_legacy1">FT_LCD_FILTER_LEGACY1</a> = 3,
1372 <a href="ft2-lcd_rendering.html#ft_lcd_filter_legacy">FT_LCD_FILTER_LEGACY</a> = 16,
1374 FT_LCD_FILTER_MAX /* do not remove */
1376 } <b>FT_LcdFilter</b>;
1379 <p>A list of values to identify various types of LCD filters.</p>
1381 <table class="fields">
1382 <tr><td class="val" id="ft_lcd_filter_none">FT_LCD_FILTER_NONE</td><td class="desc">
1383 <p>Do not perform filtering. When used with subpixel rendering, this results in sometimes severe color fringes.</p>
1385 <tr><td class="val" id="ft_lcd_filter_default">FT_LCD_FILTER_DEFAULT</td><td class="desc">
1386 <p>This is a beveled, normalized, and color-balanced five-tap filter with weights of [0x08 0x4D 0x56 0x4D 0x08] in 1/256 units.</p>
1388 <tr><td class="val" id="ft_lcd_filter_light">FT_LCD_FILTER_LIGHT</td><td class="desc">
1389 <p>this is a boxy, normalized, and color-balanced three-tap filter with weights of [0x00 0x55 0x56 0x55 0x00] in 1/256 units.</p>
1391 <tr><td class="val" id="ft_lcd_filter_legacy">FT_LCD_FILTER_LEGACY</td><td class="desc">
1394 <tr><td class="val" id="ft_lcd_filter_legacy1">FT_LCD_FILTER_LEGACY1</td><td class="desc">
1395 <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>
1401 <p>2.3.0 (<code>FT_LCD_FILTER_LEGACY1</code> since 2.6.2)</p>
1404 <h2 id="ft_library_setlcdfilter">FT_Library_SetLcdFilter<a class="headerlink" href="#ft_library_setlcdfilter" title="Permanent link">¶</a></h2>
1405 <p>Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h).</p>
1406 <div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1407 <b>FT_Library_SetLcdFilter</b>( <a href="ft2-library_setup.html#ft_library">FT_Library</a> library,
1408 <a href="ft2-lcd_rendering.html#ft_lcdfilter">FT_LcdFilter</a> filter );
1411 <p>This function is used to change filter applied to LCD decimated bitmaps, like the ones used when calling <code><a href="ft2-glyph_retrieval.html#ft_render_glyph">FT_Render_Glyph</a></code> with <code><a href="ft2-glyph_retrieval.html#ft_render_mode">FT_RENDER_MODE_LCD</a></code> or <code><a href="ft2-glyph_retrieval.html#ft_render_mode">FT_RENDER_MODE_LCD_V</a></code>.</p>
1413 <table class="fields">
1414 <tr><td class="val" id="library">library</td><td class="desc">
1415 <p>A handle to the target library instance.</p>
1417 <tr><td class="val" id="filter">filter</td><td class="desc">
1418 <p>The filter type.</p>
1419 <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>
1425 <p>FreeType error code. 0 means success.</p>
1428 <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>
1429 <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>
1435 <h2 id="ft_library_setlcdfilterweights">FT_Library_SetLcdFilterWeights<a class="headerlink" href="#ft_library_setlcdfilterweights" title="Permanent link">¶</a></h2>
1436 <p>Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h).</p>
1437 <div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1438 <b>FT_Library_SetLcdFilterWeights</b>( <a href="ft2-library_setup.html#ft_library">FT_Library</a> library,
1439 <span class="keyword">unsigned</span> <span class="keyword">char</span> *weights );
1442 <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>
1444 <table class="fields">
1445 <tr><td class="val" id="library">library</td><td class="desc">
1446 <p>A handle to the target library instance.</p>
1448 <tr><td class="val" id="weights">weights</td><td class="desc">
1449 <p>A pointer to an array; the function copies the first five bytes and uses them to specify the filter weights in 1/256 units.</p>
1455 <p>FreeType error code. 0 means success.</p>
1458 <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>
1459 <p>LCD filter weights can also be set per face using <code><a href="ft2-face_creation.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>
1465 <h2 id="ft_lcdfivetapfilter">FT_LcdFiveTapFilter<a class="headerlink" href="#ft_lcdfivetapfilter" title="Permanent link">¶</a></h2>
1466 <p>Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h).</p>
1467 <div class = "codehilite"><pre><code>#<span class="keyword">define</span> FT_LCD_FILTER_FIVE_TAPS 5
1469 <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];
1472 <p>A typedef for passing the five LCD filter weights to <code><a href="ft2-face_creation.html#ft_face_properties">FT_Face_Properties</a></code> within an <code><a href="ft2-face_creation.html#ft_parameter">FT_Parameter</a></code> structure.</p>
1478 <h2 id="ft_library_setlcdgeometry">FT_Library_SetLcdGeometry<a class="headerlink" href="#ft_library_setlcdgeometry" title="Permanent link">¶</a></h2>
1479 <p>Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h).</p>
1480 <div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1481 <b>FT_Library_SetLcdGeometry</b>( <a href="ft2-library_setup.html#ft_library">FT_Library</a> library,
1482 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a> sub[3] );
1485 <p>This function can be used to modify default positions of color subpixels, which controls Harmony LCD rendering.</p>
1487 <table class="fields">
1488 <tr><td class="val" id="library">library</td><td class="desc">
1489 <p>A handle to the target library instance.</p>
1491 <tr><td class="val" id="sub">sub</td><td class="desc">
1492 <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>
1498 <p>FreeType error code. 0 means success.</p>
1501 <p>Subpixel geometry examples:</p>
1504 <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>
1507 <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>
1510 <p>{{0, 21}, {0, 0}, {0, -21}} is the vertical RGB, but the bitmap stays RGB888 as a result.</p>
1513 <p>{{-11, 16}, {-11, -16}, {22, 0}} is a certain PenTile arrangement.</p>
1516 <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>
1535 <footer class="md-footer">
1537 <nav class="md-footer__inner md-grid" aria-label="Footer">
1540 <a href="ft2-parameter_tags.html" class="md-footer__link md-footer__link--prev" aria-label="Previous: Parameter Tags" rel="prev">
1541 <div class="md-footer__button md-icon">
1542 <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>
1544 <div class="md-footer__title">
1545 <div class="md-ellipsis">
1546 <span class="md-footer__direction">
1556 <a href="ft2-cache_subsystem.html" class="md-footer__link md-footer__link--next" aria-label="Next: Cache Sub-System" rel="next">
1557 <div class="md-footer__title">
1558 <div class="md-ellipsis">
1559 <span class="md-footer__direction">
1565 <div class="md-footer__button md-icon">
1566 <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>
1572 <div class="md-footer-meta md-typeset">
1573 <div class="md-footer-meta__inner md-grid">
1574 <div class="md-footer-copyright">
1576 <div class="md-footer-copyright__highlight">
1577 Copyright 2023 <a href = "https://www.freetype.org/license.html">The FreeType Project</a>.
1581 <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
1592 <div class="md-dialog" data-md-component="dialog">
1593 <div class="md-dialog__inner md-typeset"></div>
1595 <script id="__config" type="application/json">{"base": ".", "features": [], "search": "assets/javascripts/workers/search.477d984a.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "version": null}</script>
1598 <script src="assets/javascripts/bundle.82b56eb2.min.js"></script>
1600 <script src="javascripts/extra.js"></script>