6 <html lang="en" class="no-js">
10 <meta name="viewport" content="width=device-width,initial-scale=1">
11 <meta http-equiv="x-ua-compatible" content="ie=edge">
13 <meta name="description" content="API Reference Documentation for FreeType-2.10.4">
17 <meta name="author" content="FreeType Contributors">
20 <meta name="lang:clipboard.copy" content="Copy to clipboard">
22 <meta name="lang:clipboard.copied" content="Copied to clipboard">
24 <meta name="lang:search.language" content="en">
26 <meta name="lang:search.pipeline.stopwords" content="True">
28 <meta name="lang:search.pipeline.trimmer" content="True">
30 <meta name="lang:search.result.none" content="No matching documents">
32 <meta name="lang:search.result.one" content="1 matching document">
34 <meta name="lang:search.result.other" content="# matching documents">
36 <meta name="lang:search.tokenizer" content="[\s\-]+">
38 <link rel="shortcut icon" href="images/favico.ico">
39 <meta name="generator" content="mkdocs-1.1, mkdocs-material-4.6.3">
43 <title>Glyph Management - FreeType-2.10.4 API Reference</title>
47 <link rel="stylesheet" href="assets/stylesheets/application.adb8469c.css">
49 <link rel="stylesheet" href="assets/stylesheets/application-palette.a8b3c06d.css">
54 <meta name="theme-color" content="#4caf50">
58 <script src="assets/javascripts/modernizr.86422ebf.js"></script>
62 <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
63 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noto+Serif:300,400,400i,700%7CRoboto+Mono&display=fallback">
64 <style>body,input{font-family:"Noto Serif","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
67 <link rel="stylesheet" href="assets/fonts/material-icons.css">
70 <link rel="stylesheet" href="stylesheets/extra.css">
80 <body dir="ltr" data-md-color-primary="green" data-md-color-accent="green">
88 <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
89 <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
90 <label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
92 <a href="#glyph-management" tabindex="0" class="md-skip">
97 <header class="md-header" data-md-component="header">
98 <nav class="md-header-nav md-grid">
100 <div class="md-flex__cell md-flex__cell--shrink">
101 <a href="." title="FreeType-2.10.4 API Reference" aria-label="FreeType-2.10.4 API Reference" class="md-header-nav__button md-logo">
103 <img alt="logo" src="images/favico.ico" width="24" height="24">
107 <div class="md-flex__cell md-flex__cell--shrink">
108 <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
110 <div class="md-flex__cell md-flex__cell--stretch">
111 <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
113 <span class="md-header-nav__topic">
114 FreeType-2.10.4 API Reference
116 <span class="md-header-nav__topic">
124 <div class="md-flex__cell md-flex__cell--shrink">
126 <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
128 <div class="md-search" data-md-component="search" role="dialog">
129 <label class="md-search__overlay" for="__search"></label>
130 <div class="md-search__inner" role="search">
131 <form class="md-search__form" name="search">
132 <input type="text" class="md-search__input" aria-label="search" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
133 <label class="md-icon md-search__icon" for="__search"></label>
134 <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
138 <div class="md-search__output">
139 <div class="md-search__scrollwrap" data-md-scrollfix>
140 <div class="md-search-result" data-md-component="result">
141 <div class="md-search-result__meta">
142 Type to start searching
144 <ol class="md-search-result__list"></ol>
157 <div class="md-container">
162 <main class="md-main" role="main">
163 <div class="md-main__inner md-grid" data-md-component="container">
166 <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
167 <div class="md-sidebar__scrollwrap">
168 <div class="md-sidebar__inner">
169 <nav class="md-nav md-nav--primary" data-md-level="0">
170 <label class="md-nav__title md-nav__title--site" for="__drawer">
171 <a href="." title="FreeType-2.10.4 API Reference" class="md-nav__button md-logo">
173 <img alt="logo" src="images/favico.ico" width="48" height="48">
176 FreeType-2.10.4 API Reference
179 <ul class="md-nav__list" data-md-scrollfix>
186 <li class="md-nav__item">
187 <a href="index.html" title="TOC" class="md-nav__link">
198 <li class="md-nav__item">
199 <a href="ft2-index.html" title="Index" class="md-nav__link">
210 <li class="md-nav__item md-nav__item--nested">
212 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3">
214 <label class="md-nav__link" for="nav-3">
217 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
218 <label class="md-nav__title" for="nav-3">
221 <ul class="md-nav__list" data-md-scrollfix>
229 <li class="md-nav__item">
230 <a href="ft2-header_inclusion.html" title="FreeType's header inclusion scheme" class="md-nav__link">
231 FreeType's header inclusion scheme
241 <li class="md-nav__item">
242 <a href="ft2-user_allocation.html" title="User allocation" class="md-nav__link">
260 <li class="md-nav__item md-nav__item--active md-nav__item--nested">
262 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4" checked>
264 <label class="md-nav__link" for="nav-4">
267 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
268 <label class="md-nav__title" for="nav-4">
271 <ul class="md-nav__list" data-md-scrollfix>
279 <li class="md-nav__item">
280 <a href="ft2-version.html" title="FreeType Version" class="md-nav__link">
291 <li class="md-nav__item">
292 <a href="ft2-basic_types.html" title="Basic Data Types" class="md-nav__link">
303 <li class="md-nav__item">
304 <a href="ft2-base_interface.html" title="Base Interface" class="md-nav__link">
315 <li class="md-nav__item">
316 <a href="ft2-glyph_variants.html" title="Unicode Variation Sequences" class="md-nav__link">
317 Unicode Variation Sequences
327 <li class="md-nav__item">
328 <a href="ft2-color_management.html" title="Glyph Color Management" class="md-nav__link">
329 Glyph Color Management
339 <li class="md-nav__item">
340 <a href="ft2-layer_management.html" title="Glyph Layer Management" class="md-nav__link">
341 Glyph Layer Management
353 <li class="md-nav__item md-nav__item--active">
355 <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
360 <label class="md-nav__link md-nav__link--active" for="__toc">
364 <a href="ft2-glyph_management.html" title="Glyph Management" class="md-nav__link md-nav__link--active">
369 <nav class="md-nav md-nav--secondary">
375 <label class="md-nav__title" for="__toc">Table of contents</label>
376 <ul class="md-nav__list" data-md-scrollfix>
378 <li class="md-nav__item">
379 <a href="#synopsis" class="md-nav__link">
385 <li class="md-nav__item">
386 <a href="#ft_glyph" class="md-nav__link">
392 <li class="md-nav__item">
393 <a href="#ft_glyphrec" class="md-nav__link">
399 <li class="md-nav__item">
400 <a href="#ft_bitmapglyph" class="md-nav__link">
406 <li class="md-nav__item">
407 <a href="#ft_bitmapglyphrec" class="md-nav__link">
413 <li class="md-nav__item">
414 <a href="#ft_outlineglyph" class="md-nav__link">
420 <li class="md-nav__item">
421 <a href="#ft_outlineglyphrec" class="md-nav__link">
427 <li class="md-nav__item">
428 <a href="#ft_new_glyph" class="md-nav__link">
434 <li class="md-nav__item">
435 <a href="#ft_get_glyph" class="md-nav__link">
441 <li class="md-nav__item">
442 <a href="#ft_glyph_copy" class="md-nav__link">
448 <li class="md-nav__item">
449 <a href="#ft_glyph_transform" class="md-nav__link">
455 <li class="md-nav__item">
456 <a href="#ft_glyph_bbox_mode" class="md-nav__link">
462 <li class="md-nav__item">
463 <a href="#ft_glyph_get_cbox" class="md-nav__link">
469 <li class="md-nav__item">
470 <a href="#ft_glyph_to_bitmap" class="md-nav__link">
476 <li class="md-nav__item">
477 <a href="#ft_done_glyph" class="md-nav__link">
499 <li class="md-nav__item">
500 <a href="ft2-mac_specific.html" title="Mac Specific Interface" class="md-nav__link">
501 Mac Specific Interface
511 <li class="md-nav__item">
512 <a href="ft2-sizes_management.html" title="Size Management" class="md-nav__link">
523 <li class="md-nav__item">
524 <a href="ft2-header_file_macros.html" title="Header File Macros" class="md-nav__link">
540 <li class="md-nav__item md-nav__item--nested">
542 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
544 <label class="md-nav__link" for="nav-5">
547 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
548 <label class="md-nav__title" for="nav-5">
551 <ul class="md-nav__list" data-md-scrollfix>
559 <li class="md-nav__item">
560 <a href="ft2-multiple_masters.html" title="Multiple Masters" class="md-nav__link">
571 <li class="md-nav__item">
572 <a href="ft2-truetype_tables.html" title="TrueType Tables" class="md-nav__link">
583 <li class="md-nav__item">
584 <a href="ft2-type1_tables.html" title="Type 1 Tables" class="md-nav__link">
595 <li class="md-nav__item">
596 <a href="ft2-sfnt_names.html" title="SFNT Names" class="md-nav__link">
607 <li class="md-nav__item">
608 <a href="ft2-bdf_fonts.html" title="BDF and PCF Files" class="md-nav__link">
619 <li class="md-nav__item">
620 <a href="ft2-cid_fonts.html" title="CID Fonts" class="md-nav__link">
631 <li class="md-nav__item">
632 <a href="ft2-pfr_fonts.html" title="PFR Fonts" class="md-nav__link">
643 <li class="md-nav__item">
644 <a href="ft2-winfnt_fonts.html" title="Window FNT Files" class="md-nav__link">
655 <li class="md-nav__item">
656 <a href="ft2-font_formats.html" title="Font Formats" class="md-nav__link">
667 <li class="md-nav__item">
668 <a href="ft2-gasp_table.html" title="Gasp Table" class="md-nav__link">
684 <li class="md-nav__item md-nav__item--nested">
686 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-6" type="checkbox" id="nav-6">
688 <label class="md-nav__link" for="nav-6">
689 Controlling FreeType Modules
691 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
692 <label class="md-nav__title" for="nav-6">
693 Controlling FreeType Modules
695 <ul class="md-nav__list" data-md-scrollfix>
703 <li class="md-nav__item">
704 <a href="ft2-auto_hinter.html" title="The auto-hinter" class="md-nav__link">
715 <li class="md-nav__item">
716 <a href="ft2-cff_driver.html" title="The CFF driver" class="md-nav__link">
727 <li class="md-nav__item">
728 <a href="ft2-t1_cid_driver.html" title="The Type 1 and CID drivers" class="md-nav__link">
729 The Type 1 and CID drivers
739 <li class="md-nav__item">
740 <a href="ft2-tt_driver.html" title="The TrueType driver" class="md-nav__link">
751 <li class="md-nav__item">
752 <a href="ft2-pcf_driver.html" title="The PCF driver" class="md-nav__link">
763 <li class="md-nav__item">
764 <a href="ft2-properties.html" title="Driver properties" class="md-nav__link">
775 <li class="md-nav__item">
776 <a href="ft2-parameter_tags.html" title="Parameter Tags" class="md-nav__link">
787 <li class="md-nav__item">
788 <a href="ft2-lcd_rendering.html" title="Subpixel Rendering" class="md-nav__link">
804 <li class="md-nav__item md-nav__item--nested">
806 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-7" type="checkbox" id="nav-7">
808 <label class="md-nav__link" for="nav-7">
811 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
812 <label class="md-nav__title" for="nav-7">
815 <ul class="md-nav__list" data-md-scrollfix>
823 <li class="md-nav__item">
824 <a href="ft2-cache_subsystem.html" title="Cache Sub-System" class="md-nav__link">
840 <li class="md-nav__item md-nav__item--nested">
842 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-8" type="checkbox" id="nav-8">
844 <label class="md-nav__link" for="nav-8">
847 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
848 <label class="md-nav__title" for="nav-8">
851 <ul class="md-nav__list" data-md-scrollfix>
859 <li class="md-nav__item">
860 <a href="ft2-computations.html" title="Computations" class="md-nav__link">
871 <li class="md-nav__item">
872 <a href="ft2-list_processing.html" title="List Processing" class="md-nav__link">
883 <li class="md-nav__item">
884 <a href="ft2-outline_processing.html" title="Outline Processing" class="md-nav__link">
895 <li class="md-nav__item">
896 <a href="ft2-quick_advance.html" title="Quick retrieval of advance values" class="md-nav__link">
897 Quick retrieval of advance values
907 <li class="md-nav__item">
908 <a href="ft2-bitmap_handling.html" title="Bitmap Handling" class="md-nav__link">
919 <li class="md-nav__item">
920 <a href="ft2-raster.html" title="Scanline Converter" class="md-nav__link">
931 <li class="md-nav__item">
932 <a href="ft2-glyph_stroker.html" title="Glyph Stroker" class="md-nav__link">
943 <li class="md-nav__item">
944 <a href="ft2-system_interface.html" title="System Interface" class="md-nav__link">
955 <li class="md-nav__item">
956 <a href="ft2-module_management.html" title="Module Management" class="md-nav__link">
967 <li class="md-nav__item">
968 <a href="ft2-gzip.html" title="GZIP Streams" class="md-nav__link">
979 <li class="md-nav__item">
980 <a href="ft2-lzw.html" title="LZW Streams" class="md-nav__link">
991 <li class="md-nav__item">
992 <a href="ft2-bzip2.html" title="BZIP2 Streams" class="md-nav__link">
1008 <li class="md-nav__item md-nav__item--nested">
1010 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-9" type="checkbox" id="nav-9">
1012 <label class="md-nav__link" for="nav-9">
1015 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
1016 <label class="md-nav__title" for="nav-9">
1019 <ul class="md-nav__list" data-md-scrollfix>
1027 <li class="md-nav__item">
1028 <a href="ft2-error_enumerations.html" title="Error Enumerations" class="md-nav__link">
1039 <li class="md-nav__item">
1040 <a href="ft2-error_code_values.html" title="Error Code Values" class="md-nav__link">
1056 <li class="md-nav__item md-nav__item--nested">
1058 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-10" type="checkbox" id="nav-10">
1060 <label class="md-nav__link" for="nav-10">
1063 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
1064 <label class="md-nav__title" for="nav-10">
1067 <ul class="md-nav__list" data-md-scrollfix>
1075 <li class="md-nav__item">
1076 <a href="ft2-gx_validation.html" title="TrueTypeGX/AAT Validation" class="md-nav__link">
1077 TrueTypeGX/AAT Validation
1087 <li class="md-nav__item">
1088 <a href="ft2-incremental.html" title="Incremental Loading" class="md-nav__link">
1099 <li class="md-nav__item">
1100 <a href="ft2-truetype_engine.html" title="The TrueType Engine" class="md-nav__link">
1111 <li class="md-nav__item">
1112 <a href="ft2-ot_validation.html" title="OpenType Validation" class="md-nav__link">
1130 <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
1131 <div class="md-sidebar__scrollwrap">
1132 <div class="md-sidebar__inner">
1134 <nav class="md-nav md-nav--secondary">
1140 <label class="md-nav__title" for="__toc">Table of contents</label>
1141 <ul class="md-nav__list" data-md-scrollfix>
1143 <li class="md-nav__item">
1144 <a href="#synopsis" class="md-nav__link">
1150 <li class="md-nav__item">
1151 <a href="#ft_glyph" class="md-nav__link">
1157 <li class="md-nav__item">
1158 <a href="#ft_glyphrec" class="md-nav__link">
1164 <li class="md-nav__item">
1165 <a href="#ft_bitmapglyph" class="md-nav__link">
1171 <li class="md-nav__item">
1172 <a href="#ft_bitmapglyphrec" class="md-nav__link">
1178 <li class="md-nav__item">
1179 <a href="#ft_outlineglyph" class="md-nav__link">
1185 <li class="md-nav__item">
1186 <a href="#ft_outlineglyphrec" class="md-nav__link">
1192 <li class="md-nav__item">
1193 <a href="#ft_new_glyph" class="md-nav__link">
1199 <li class="md-nav__item">
1200 <a href="#ft_get_glyph" class="md-nav__link">
1206 <li class="md-nav__item">
1207 <a href="#ft_glyph_copy" class="md-nav__link">
1213 <li class="md-nav__item">
1214 <a href="#ft_glyph_transform" class="md-nav__link">
1220 <li class="md-nav__item">
1221 <a href="#ft_glyph_bbox_mode" class="md-nav__link">
1227 <li class="md-nav__item">
1228 <a href="#ft_glyph_get_cbox" class="md-nav__link">
1234 <li class="md-nav__item">
1235 <a href="#ft_glyph_to_bitmap" class="md-nav__link">
1241 <li class="md-nav__item">
1242 <a href="#ft_done_glyph" class="md-nav__link">
1260 <div class="md-content">
1261 <article class="md-content__inner md-typeset">
1265 <p><a href="https://www.freetype.org">FreeType</a> » <a href="../">Docs</a> » <a href="index.html#core-api">Core API</a> » Glyph Management</p>
1267 <h1 id="glyph-management">Glyph Management<a class="headerlink" href="#glyph-management" title="Permanent link">¶</a></h1>
1268 <h2 id="synopsis">Synopsis<a class="headerlink" href="#synopsis" title="Permanent link">¶</a></h2>
1269 <p>This section contains definitions used to manage glyph data through generic <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> objects. Each of them can contain a bitmap, a vector outline, or even images in other formats. These objects are detached from <code><a href="ft2-base_interface.html#ft_face">FT_Face</a></code>, contrary to <code><a href="ft2-base_interface.html#ft_glyphslot">FT_GlyphSlot</a></code>.</p>
1270 <h2 id="ft_glyph">FT_Glyph<a class="headerlink" href="#ft_glyph" title="Permanent link">¶</a></h2>
1271 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1272 <div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_GlyphRec_* <b>FT_Glyph</b>;
1275 <p>Handle to an object used to model generic glyph images. It is a pointer to the <code><a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a></code> structure and can contain a glyph bitmap or pointer.</p>
1278 <p>Glyph objects are not owned by the library. You must thus release them manually (through <code><a href="ft2-glyph_management.html#ft_done_glyph">FT_Done_Glyph</a></code>) <em>before</em> calling <code><a href="ft2-base_interface.html#ft_done_freetype">FT_Done_FreeType</a></code>.</p>
1281 <h2 id="ft_glyphrec">FT_GlyphRec<a class="headerlink" href="#ft_glyphrec" title="Permanent link">¶</a></h2>
1282 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1283 <div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_GlyphRec_
1285 <a href="ft2-base_interface.html#ft_library">FT_Library</a> library;
1286 <span class="keyword">const</span> FT_Glyph_Class* clazz;
1287 <a href="ft2-basic_types.html#ft_glyph_format">FT_Glyph_Format</a> format;
1288 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a> advance;
1290 } <b>FT_GlyphRec</b>;
1293 <p>The root glyph structure contains a given glyph image plus its advance width in 16.16 fixed-point format.</p>
1296 <table class="fields">
1297 <tr><td class="val" id="library">library</td><td class="desc">
1298 <p>A handle to the FreeType library object.</p>
1300 <tr><td class="val" id="clazz">clazz</td><td class="desc">
1301 <p>A pointer to the glyph's class. Private.</p>
1303 <tr><td class="val" id="format">format</td><td class="desc">
1304 <p>The format of the glyph's image.</p>
1306 <tr><td class="val" id="advance">advance</td><td class="desc">
1307 <p>A 16.16 vector that gives the glyph's advance width.</p>
1313 <h2 id="ft_bitmapglyph">FT_BitmapGlyph<a class="headerlink" href="#ft_bitmapglyph" title="Permanent link">¶</a></h2>
1314 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1315 <div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_BitmapGlyphRec_* <b>FT_BitmapGlyph</b>;
1318 <p>A handle to an object used to model a bitmap glyph image. This is a sub-class of <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code>, and a pointer to <code><a href="ft2-glyph_management.html#ft_bitmapglyphrec">FT_BitmapGlyphRec</a></code>.</p>
1321 <h2 id="ft_bitmapglyphrec">FT_BitmapGlyphRec<a class="headerlink" href="#ft_bitmapglyphrec" title="Permanent link">¶</a></h2>
1322 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1323 <div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_BitmapGlyphRec_
1325 <a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a> root;
1326 <a href="ft2-basic_types.html#ft_int">FT_Int</a> left;
1327 <a href="ft2-basic_types.html#ft_int">FT_Int</a> top;
1328 <a href="ft2-basic_types.html#ft_bitmap">FT_Bitmap</a> bitmap;
1330 } <b>FT_BitmapGlyphRec</b>;
1333 <p>A structure used for bitmap glyph images. This really is a ‘sub-class’ of <code><a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a></code>.</p>
1336 <table class="fields">
1337 <tr><td class="val" id="root">root</td><td class="desc">
1338 <p>The root <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> fields.</p>
1340 <tr><td class="val" id="left">left</td><td class="desc">
1341 <p>The left-side bearing, i.e., the horizontal distance from the current pen position to the left border of the glyph bitmap.</p>
1343 <tr><td class="val" id="top">top</td><td class="desc">
1344 <p>The top-side bearing, i.e., the vertical distance from the current pen position to the top border of the glyph bitmap. This distance is positive for upwards y!</p>
1346 <tr><td class="val" id="bitmap">bitmap</td><td class="desc">
1347 <p>A descriptor for the bitmap.</p>
1353 <p>You can typecast an <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> to <code><a href="ft2-glyph_management.html#ft_bitmapglyph">FT_BitmapGlyph</a></code> if you have <code>glyph->format == FT_GLYPH_FORMAT_BITMAP</code>. This lets you access the bitmap's contents easily.</p>
1354 <p>The corresponding pixel buffer is always owned by <code><a href="ft2-glyph_management.html#ft_bitmapglyph">FT_BitmapGlyph</a></code> and is thus created and destroyed with it.</p>
1357 <h2 id="ft_outlineglyph">FT_OutlineGlyph<a class="headerlink" href="#ft_outlineglyph" title="Permanent link">¶</a></h2>
1358 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1359 <div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_OutlineGlyphRec_* <b>FT_OutlineGlyph</b>;
1362 <p>A handle to an object used to model an outline glyph image. This is a sub-class of <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code>, and a pointer to <code><a href="ft2-glyph_management.html#ft_outlineglyphrec">FT_OutlineGlyphRec</a></code>.</p>
1365 <h2 id="ft_outlineglyphrec">FT_OutlineGlyphRec<a class="headerlink" href="#ft_outlineglyphrec" title="Permanent link">¶</a></h2>
1366 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1367 <div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_OutlineGlyphRec_
1369 <a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a> root;
1370 <a href="ft2-outline_processing.html#ft_outline">FT_Outline</a> outline;
1372 } <b>FT_OutlineGlyphRec</b>;
1375 <p>A structure used for outline (vectorial) glyph images. This really is a ‘sub-class’ of <code><a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a></code>.</p>
1378 <table class="fields">
1379 <tr><td class="val" id="root">root</td><td class="desc">
1380 <p>The root <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> fields.</p>
1382 <tr><td class="val" id="outline">outline</td><td class="desc">
1383 <p>A descriptor for the outline.</p>
1389 <p>You can typecast an <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> to <code><a href="ft2-glyph_management.html#ft_outlineglyph">FT_OutlineGlyph</a></code> if you have <code>glyph->format == FT_GLYPH_FORMAT_OUTLINE</code>. This lets you access the outline's content easily.</p>
1390 <p>As the outline is extracted from a glyph slot, its coordinates are expressed normally in 26.6 pixels, unless the flag <code><a href="ft2-base_interface.html#ft_load_xxx">FT_LOAD_NO_SCALE</a></code> was used in <code><a href="ft2-base_interface.html#ft_load_glyph">FT_Load_Glyph</a></code> or <code><a href="ft2-base_interface.html#ft_load_char">FT_Load_Char</a></code>.</p>
1391 <p>The outline's tables are always owned by the object and are destroyed with it.</p>
1394 <h2 id="ft_new_glyph">FT_New_Glyph<a class="headerlink" href="#ft_new_glyph" title="Permanent link">¶</a></h2>
1395 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1396 <div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1397 <b>FT_New_Glyph</b>( <a href="ft2-base_interface.html#ft_library">FT_Library</a> library,
1398 <a href="ft2-basic_types.html#ft_glyph_format">FT_Glyph_Format</a> format,
1399 <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> *aglyph );
1402 <p>A function used to create a new empty glyph image. Note that the created <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> object must be released with <code><a href="ft2-glyph_management.html#ft_done_glyph">FT_Done_Glyph</a></code>.</p>
1405 <table class="fields">
1406 <tr><td class="val" id="library">library</td><td class="desc">
1407 <p>A handle to the FreeType library object.</p>
1409 <tr><td class="val" id="format">format</td><td class="desc">
1410 <p>The format of the glyph's image.</p>
1416 <table class="fields">
1417 <tr><td class="val" id="aglyph">aglyph</td><td class="desc">
1418 <p>A handle to the glyph object.</p>
1424 <p>FreeType error code. 0 means success.</p>
1430 <h2 id="ft_get_glyph">FT_Get_Glyph<a class="headerlink" href="#ft_get_glyph" title="Permanent link">¶</a></h2>
1431 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1432 <div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1433 <b>FT_Get_Glyph</b>( <a href="ft2-base_interface.html#ft_glyphslot">FT_GlyphSlot</a> slot,
1434 <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> *aglyph );
1437 <p>A function used to extract a glyph image from a slot. Note that the created <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> object must be released with <code><a href="ft2-glyph_management.html#ft_done_glyph">FT_Done_Glyph</a></code>.</p>
1440 <table class="fields">
1441 <tr><td class="val" id="slot">slot</td><td class="desc">
1442 <p>A handle to the source glyph slot.</p>
1448 <table class="fields">
1449 <tr><td class="val" id="aglyph">aglyph</td><td class="desc">
1450 <p>A handle to the glyph object.</p>
1456 <p>FreeType error code. 0 means success.</p>
1459 <p>Because <code>*aglyph->advance.x</code> and <code>*aglyph->advance.y</code> are 16.16 fixed-point numbers, <code>slot->advance.x</code> and <code>slot->advance.y</code> (which are in 26.6 fixed-point format) must be in the range ]-32768;32768[.</p>
1462 <h2 id="ft_glyph_copy">FT_Glyph_Copy<a class="headerlink" href="#ft_glyph_copy" title="Permanent link">¶</a></h2>
1463 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1464 <div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1465 <b>FT_Glyph_Copy</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> source,
1466 <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> *target );
1469 <p>A function used to copy a glyph image. Note that the created <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> object must be released with <code><a href="ft2-glyph_management.html#ft_done_glyph">FT_Done_Glyph</a></code>.</p>
1472 <table class="fields">
1473 <tr><td class="val" id="source">source</td><td class="desc">
1474 <p>A handle to the source glyph object.</p>
1480 <table class="fields">
1481 <tr><td class="val" id="target">target</td><td class="desc">
1482 <p>A handle to the target glyph object. 0 in case of error.</p>
1488 <p>FreeType error code. 0 means success.</p>
1491 <h2 id="ft_glyph_transform">FT_Glyph_Transform<a class="headerlink" href="#ft_glyph_transform" title="Permanent link">¶</a></h2>
1492 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1493 <div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1494 <b>FT_Glyph_Transform</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> glyph,
1495 <a href="ft2-basic_types.html#ft_matrix">FT_Matrix</a>* matrix,
1496 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a>* delta );
1499 <p>Transform a glyph image if its format is scalable.</p>
1502 <table class="fields">
1503 <tr><td class="val" id="glyph">glyph</td><td class="desc">
1504 <p>A handle to the target glyph object.</p>
1510 <table class="fields">
1511 <tr><td class="val" id="matrix">matrix</td><td class="desc">
1512 <p>A pointer to a 2x2 matrix to apply.</p>
1514 <tr><td class="val" id="delta">delta</td><td class="desc">
1515 <p>A pointer to a 2d vector to apply. Coordinates are expressed in 1/64th of a pixel.</p>
1521 <p>FreeType error code (if not 0, the glyph format is not scalable).</p>
1524 <p>The 2x2 transformation matrix is also applied to the glyph's advance vector.</p>
1527 <h2 id="ft_glyph_bbox_mode">FT_Glyph_BBox_Mode<a class="headerlink" href="#ft_glyph_bbox_mode" title="Permanent link">¶</a></h2>
1528 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1529 <div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">enum</span> FT_Glyph_BBox_Mode_
1531 <a href="ft2-glyph_management.html#ft_glyph_bbox_unscaled">FT_GLYPH_BBOX_UNSCALED</a> = 0,
1532 <a href="ft2-glyph_management.html#ft_glyph_bbox_subpixels">FT_GLYPH_BBOX_SUBPIXELS</a> = 0,
1533 <a href="ft2-glyph_management.html#ft_glyph_bbox_gridfit">FT_GLYPH_BBOX_GRIDFIT</a> = 1,
1534 <a href="ft2-glyph_management.html#ft_glyph_bbox_truncate">FT_GLYPH_BBOX_TRUNCATE</a> = 2,
1535 <a href="ft2-glyph_management.html#ft_glyph_bbox_pixels">FT_GLYPH_BBOX_PIXELS</a> = 3
1537 } <b>FT_Glyph_BBox_Mode</b>;
1540 /* these constants are deprecated; use the corresponding */
1541 /* `<b>FT_Glyph_BBox_Mode</b>` values instead */
1542 #<span class="keyword">define</span> ft_glyph_bbox_unscaled <a href="ft2-glyph_management.html#ft_glyph_bbox_unscaled">FT_GLYPH_BBOX_UNSCALED</a>
1543 #<span class="keyword">define</span> ft_glyph_bbox_subpixels <a href="ft2-glyph_management.html#ft_glyph_bbox_subpixels">FT_GLYPH_BBOX_SUBPIXELS</a>
1544 #<span class="keyword">define</span> ft_glyph_bbox_gridfit <a href="ft2-glyph_management.html#ft_glyph_bbox_gridfit">FT_GLYPH_BBOX_GRIDFIT</a>
1545 #<span class="keyword">define</span> ft_glyph_bbox_truncate <a href="ft2-glyph_management.html#ft_glyph_bbox_truncate">FT_GLYPH_BBOX_TRUNCATE</a>
1546 #<span class="keyword">define</span> ft_glyph_bbox_pixels <a href="ft2-glyph_management.html#ft_glyph_bbox_pixels">FT_GLYPH_BBOX_PIXELS</a>
1549 <p>The mode how the values of <code><a href="ft2-glyph_management.html#ft_glyph_get_cbox">FT_Glyph_Get_CBox</a></code> are returned.</p>
1552 <table class="fields">
1553 <tr><td class="val" id="ft_glyph_bbox_unscaled">FT_GLYPH_BBOX_UNSCALED</td><td class="desc">
1554 <p>Return unscaled font units.</p>
1556 <tr><td class="val" id="ft_glyph_bbox_subpixels">FT_GLYPH_BBOX_SUBPIXELS</td><td class="desc">
1557 <p>Return unfitted 26.6 coordinates.</p>
1559 <tr><td class="val" id="ft_glyph_bbox_gridfit">FT_GLYPH_BBOX_GRIDFIT</td><td class="desc">
1560 <p>Return grid-fitted 26.6 coordinates.</p>
1562 <tr><td class="val" id="ft_glyph_bbox_truncate">FT_GLYPH_BBOX_TRUNCATE</td><td class="desc">
1563 <p>Return coordinates in integer pixels.</p>
1565 <tr><td class="val" id="ft_glyph_bbox_pixels">FT_GLYPH_BBOX_PIXELS</td><td class="desc">
1566 <p>Return grid-fitted pixel coordinates.</p>
1572 <h2 id="ft_glyph_get_cbox">FT_Glyph_Get_CBox<a class="headerlink" href="#ft_glyph_get_cbox" title="Permanent link">¶</a></h2>
1573 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1574 <div class = "codehilite"><pre><code> FT_EXPORT( <span class="keyword">void</span> )
1575 <b>FT_Glyph_Get_CBox</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> glyph,
1576 <a href="ft2-basic_types.html#ft_uint">FT_UInt</a> bbox_mode,
1577 <a href="ft2-basic_types.html#ft_bbox">FT_BBox</a> *acbox );
1580 <p>Return a glyph's ‘control box’. The control box encloses all the outline's points, including Bezier control points. Though it coincides with the exact bounding box for most glyphs, it can be slightly larger in some situations (like when rotating an outline that contains Bezier outside arcs).</p>
1581 <p>Computing the control box is very fast, while getting the bounding box can take much more time as it needs to walk over all segments and arcs in the outline. To get the latter, you can use the ‘ftbbox’ component, which is dedicated to this single task.</p>
1584 <table class="fields">
1585 <tr><td class="val" id="glyph">glyph</td><td class="desc">
1586 <p>A handle to the source glyph object.</p>
1588 <tr><td class="val" id="mode">mode</td><td class="desc">
1589 <p>The mode that indicates how to interpret the returned bounding box values.</p>
1595 <table class="fields">
1596 <tr><td class="val" id="acbox">acbox</td><td class="desc">
1597 <p>The glyph coordinate bounding box. Coordinates are expressed in 1/64th of pixels if it is grid-fitted.</p>
1603 <p>Coordinates are relative to the glyph origin, using the y upwards convention.</p>
1604 <p>If the glyph has been loaded with <code><a href="ft2-base_interface.html#ft_load_xxx">FT_LOAD_NO_SCALE</a></code>, <code>bbox_mode</code> must be set to <code><a href="ft2-glyph_management.html#ft_glyph_bbox_mode">FT_GLYPH_BBOX_UNSCALED</a></code> to get unscaled font units in 26.6 pixel format. The value <code><a href="ft2-glyph_management.html#ft_glyph_bbox_mode">FT_GLYPH_BBOX_SUBPIXELS</a></code> is another name for this constant.</p>
1605 <p>If the font is tricky and the glyph has been loaded with <code><a href="ft2-base_interface.html#ft_load_xxx">FT_LOAD_NO_SCALE</a></code>, the resulting CBox is meaningless. To get reasonable values for the CBox it is necessary to load the glyph at a large ppem value (so that the hinting instructions can properly shift and scale the subglyphs), then extracting the CBox, which can be eventually converted back to font units.</p>
1606 <p>Note that the maximum coordinates are exclusive, which means that one can compute the width and height of the glyph image (be it in integer or 26.6 pixels) as:
1607 <div class="highlight"><pre><span></span><code> width = bbox.xMax - bbox.xMin;
1608 height = bbox.yMax - bbox.yMin;
1609 </code></pre></div></p>
1610 <p>Note also that for 26.6 coordinates, if <code>bbox_mode</code> is set to <code><a href="ft2-glyph_management.html#ft_glyph_bbox_mode">FT_GLYPH_BBOX_GRIDFIT</a></code>, the coordinates will also be grid-fitted, which corresponds to:
1611 <div class="highlight"><pre><span></span><code> bbox.xMin = FLOOR(bbox.xMin);
1612 bbox.yMin = FLOOR(bbox.yMin);
1613 bbox.xMax = CEILING(bbox.xMax);
1614 bbox.yMax = CEILING(bbox.yMax);
1615 </code></pre></div></p>
1616 <p>To get the bbox in pixel coordinates, set <code>bbox_mode</code> to <code><a href="ft2-glyph_management.html#ft_glyph_bbox_mode">FT_GLYPH_BBOX_TRUNCATE</a></code>.</p>
1617 <p>To get the bbox in grid-fitted pixel coordinates, set <code>bbox_mode</code> to <code><a href="ft2-glyph_management.html#ft_glyph_bbox_mode">FT_GLYPH_BBOX_PIXELS</a></code>.</p>
1620 <h2 id="ft_glyph_to_bitmap">FT_Glyph_To_Bitmap<a class="headerlink" href="#ft_glyph_to_bitmap" title="Permanent link">¶</a></h2>
1621 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1622 <div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1623 <b>FT_Glyph_To_Bitmap</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a>* the_glyph,
1624 <a href="ft2-base_interface.html#ft_render_mode">FT_Render_Mode</a> render_mode,
1625 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a>* origin,
1626 <a href="ft2-basic_types.html#ft_bool">FT_Bool</a> destroy );
1629 <p>Convert a given glyph object to a bitmap glyph object.</p>
1632 <table class="fields">
1633 <tr><td class="val" id="the_glyph">the_glyph</td><td class="desc">
1634 <p>A pointer to a handle to the target glyph.</p>
1640 <table class="fields">
1641 <tr><td class="val" id="render_mode">render_mode</td><td class="desc">
1642 <p>An enumeration that describes how the data is rendered.</p>
1644 <tr><td class="val" id="origin">origin</td><td class="desc">
1645 <p>A pointer to a vector used to translate the glyph image before rendering. Can be 0 (if no translation). The origin is expressed in 26.6 pixels.</p>
1647 <tr><td class="val" id="destroy">destroy</td><td class="desc">
1648 <p>A boolean that indicates that the original glyph image should be destroyed by this function. It is never destroyed in case of error.</p>
1654 <p>FreeType error code. 0 means success.</p>
1657 <p>This function does nothing if the glyph format isn't scalable.</p>
1658 <p>The glyph image is translated with the <code>origin</code> vector before rendering.</p>
1659 <p>The first parameter is a pointer to an <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> handle, that will be <em>replaced</em> by this function (with newly allocated data). Typically, you would use (omitting error handling):
1660 <div class="highlight"><pre><span></span><code> FT_Glyph glyph;
1661 FT_BitmapGlyph glyph_bitmap;
1665 error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAULT );
1667 // extract glyph image
1668 error = FT_Get_Glyph( face->glyph, &glyph );
1670 // convert to a bitmap (default render mode + destroying old)
1671 if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )
1673 error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,
1675 if ( error ) // `glyph' unchanged
1679 // access bitmap content by typecasting
1680 glyph_bitmap = (FT_BitmapGlyph)glyph;
1682 // do funny stuff with it, like blitting/drawing
1685 // discard glyph image (bitmap or not)
1686 FT_Done_Glyph( glyph );
1687 </code></pre></div></p>
1688 <p>Here is another example, again without error handling:
1689 <div class="highlight"><pre><span></span><code> FT_Glyph glyphs[MAX_GLYPHS]
1694 for ( idx = 0; i < MAX_GLYPHS; i++ )
1695 error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||
1696 FT_Get_Glyph ( face->glyph, &glyphs[idx] );
1700 for ( idx = 0; i < MAX_GLYPHS; i++ )
1702 FT_Glyph bitmap = glyphs[idx];
1707 // after this call, `bitmap' no longer points into
1708 // the `glyphs' array (and the old value isn't destroyed)
1709 FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 );
1713 FT_Done_Glyph( bitmap );
1718 for ( idx = 0; i < MAX_GLYPHS; i++ )
1719 FT_Done_Glyph( glyphs[idx] );
1720 </code></pre></div></p>
1723 <h2 id="ft_done_glyph">FT_Done_Glyph<a class="headerlink" href="#ft_done_glyph" title="Permanent link">¶</a></h2>
1724 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1725 <div class = "codehilite"><pre><code> FT_EXPORT( <span class="keyword">void</span> )
1726 <b>FT_Done_Glyph</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> glyph );
1729 <p>Destroy a given glyph.</p>
1732 <table class="fields">
1733 <tr><td class="val" id="glyph">glyph</td><td class="desc">
1734 <p>A handle to the target glyph object.</p>
1755 <footer class="md-footer">
1757 <div class="md-footer-nav">
1758 <nav class="md-footer-nav__inner md-grid">
1760 <a href="ft2-layer_management.html" title="Glyph Layer Management" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
1761 <div class="md-flex__cell md-flex__cell--shrink">
1762 <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
1764 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
1765 <span class="md-flex__ellipsis">
1766 <span class="md-footer-nav__direction">
1769 Glyph Layer Management
1775 <a href="ft2-mac_specific.html" title="Mac Specific Interface" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
1776 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
1777 <span class="md-flex__ellipsis">
1778 <span class="md-footer-nav__direction">
1781 Mac Specific Interface
1784 <div class="md-flex__cell md-flex__cell--shrink">
1785 <i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
1792 <div class="md-footer-meta md-typeset">
1793 <div class="md-footer-meta__inner md-grid">
1794 <div class="md-footer-copyright">
1796 <div class="md-footer-copyright__highlight">
1797 Copyright 2020 <a href = "https://www.freetype.org/license.html">The FreeType Project</a>.
1801 <a href="https://www.mkdocs.org" target="_blank" rel="noopener">MkDocs</a>
1803 <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
1804 Material for MkDocs</a>
1813 <script src="assets/javascripts/application.c33a9706.js"></script>
1815 <script>app.initialize({version:"1.1",url:{base:"."}})</script>
1817 <script src="javascripts/extra.js"></script>