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.1">
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.0.4, mkdocs-material-4.0.2">
43 <title>Glyph Management - FreeType-2.10.1 API Reference</title>
47 <link rel="stylesheet" href="assets/stylesheets/application.982221ab.css">
49 <link rel="stylesheet" href="assets/stylesheets/application-palette.224b79ff.css">
54 <meta name="theme-color" content="#4caf50">
58 <script src="assets/javascripts/modernizr.1f0bcf2b.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|Roboto+Mono">
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="1" 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="index.html" title="FreeType-2.10.1 API Reference" class="md-header-nav__button md-logo">
103 <img 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.1 API Reference
116 <span class="md-header-nav__topic">
122 <div class="md-flex__cell md-flex__cell--shrink">
124 <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
126 <div class="md-search" data-md-component="search" role="dialog">
127 <label class="md-search__overlay" for="__search"></label>
128 <div class="md-search__inner" role="search">
129 <form class="md-search__form" name="search">
130 <input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
131 <label class="md-icon md-search__icon" for="__search"></label>
132 <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
136 <div class="md-search__output">
137 <div class="md-search__scrollwrap" data-md-scrollfix>
138 <div class="md-search-result" data-md-component="result">
139 <div class="md-search-result__meta">
140 Type to start searching
142 <ol class="md-search-result__list"></ol>
155 <div class="md-container">
160 <main class="md-main">
161 <div class="md-main__inner md-grid" data-md-component="container">
164 <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
165 <div class="md-sidebar__scrollwrap">
166 <div class="md-sidebar__inner">
167 <nav class="md-nav md-nav--primary" data-md-level="0">
168 <label class="md-nav__title md-nav__title--site" for="__drawer">
169 <a href="index.html" title="FreeType-2.10.1 API Reference" class="md-nav__button md-logo">
171 <img src="images/favico.ico" width="48" height="48">
174 FreeType-2.10.1 API Reference
177 <ul class="md-nav__list" data-md-scrollfix>
184 <li class="md-nav__item">
185 <a href="index.html" title="TOC" class="md-nav__link">
196 <li class="md-nav__item">
197 <a href="ft2-index.html" title="Index" class="md-nav__link">
208 <li class="md-nav__item md-nav__item--nested">
210 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3">
212 <label class="md-nav__link" for="nav-3">
215 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
216 <label class="md-nav__title" for="nav-3">
219 <ul class="md-nav__list" data-md-scrollfix>
227 <li class="md-nav__item">
228 <a href="ft2-header_inclusion.html" title="FreeType's header inclusion scheme" class="md-nav__link">
229 FreeType's header inclusion scheme
239 <li class="md-nav__item">
240 <a href="ft2-user_allocation.html" title="User allocation" class="md-nav__link">
258 <li class="md-nav__item md-nav__item--active md-nav__item--nested">
260 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4" checked>
262 <label class="md-nav__link" for="nav-4">
265 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
266 <label class="md-nav__title" for="nav-4">
269 <ul class="md-nav__list" data-md-scrollfix>
277 <li class="md-nav__item">
278 <a href="ft2-version.html" title="FreeType Version" class="md-nav__link">
289 <li class="md-nav__item">
290 <a href="ft2-basic_types.html" title="Basic Data Types" class="md-nav__link">
301 <li class="md-nav__item">
302 <a href="ft2-base_interface.html" title="Base Interface" class="md-nav__link">
313 <li class="md-nav__item">
314 <a href="ft2-glyph_variants.html" title="Unicode Variation Sequences" class="md-nav__link">
315 Unicode Variation Sequences
325 <li class="md-nav__item">
326 <a href="ft2-color_management.html" title="Glyph Color Management" class="md-nav__link">
327 Glyph Color Management
337 <li class="md-nav__item">
338 <a href="ft2-layer_management.html" title="Glyph Layer Management" class="md-nav__link">
339 Glyph Layer Management
351 <li class="md-nav__item md-nav__item--active">
353 <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
358 <label class="md-nav__link md-nav__link--active" for="__toc">
362 <a href="ft2-glyph_management.html" title="Glyph Management" class="md-nav__link md-nav__link--active">
367 <nav class="md-nav md-nav--secondary">
373 <label class="md-nav__title" for="__toc">Table of contents</label>
374 <ul class="md-nav__list" data-md-scrollfix>
376 <li class="md-nav__item">
377 <a href="#synopsis" title="Synopsis" class="md-nav__link">
383 <li class="md-nav__item">
384 <a href="#ft_glyph" title="FT_Glyph" class="md-nav__link">
390 <li class="md-nav__item">
391 <a href="#ft_glyphrec" title="FT_GlyphRec" class="md-nav__link">
397 <li class="md-nav__item">
398 <a href="#ft_bitmapglyph" title="FT_BitmapGlyph" class="md-nav__link">
404 <li class="md-nav__item">
405 <a href="#ft_bitmapglyphrec" title="FT_BitmapGlyphRec" class="md-nav__link">
411 <li class="md-nav__item">
412 <a href="#ft_outlineglyph" title="FT_OutlineGlyph" class="md-nav__link">
418 <li class="md-nav__item">
419 <a href="#ft_outlineglyphrec" title="FT_OutlineGlyphRec" class="md-nav__link">
425 <li class="md-nav__item">
426 <a href="#ft_new_glyph" title="FT_New_Glyph" class="md-nav__link">
432 <li class="md-nav__item">
433 <a href="#ft_get_glyph" title="FT_Get_Glyph" class="md-nav__link">
439 <li class="md-nav__item">
440 <a href="#ft_glyph_copy" title="FT_Glyph_Copy" class="md-nav__link">
446 <li class="md-nav__item">
447 <a href="#ft_glyph_transform" title="FT_Glyph_Transform" class="md-nav__link">
453 <li class="md-nav__item">
454 <a href="#ft_glyph_bbox_mode" title="FT_Glyph_BBox_Mode" class="md-nav__link">
460 <li class="md-nav__item">
461 <a href="#ft_glyph_get_cbox" title="FT_Glyph_Get_CBox" class="md-nav__link">
467 <li class="md-nav__item">
468 <a href="#ft_glyph_to_bitmap" title="FT_Glyph_To_Bitmap" class="md-nav__link">
474 <li class="md-nav__item">
475 <a href="#ft_done_glyph" title="FT_Done_Glyph" class="md-nav__link">
497 <li class="md-nav__item">
498 <a href="ft2-mac_specific.html" title="Mac Specific Interface" class="md-nav__link">
499 Mac Specific Interface
509 <li class="md-nav__item">
510 <a href="ft2-sizes_management.html" title="Size Management" class="md-nav__link">
521 <li class="md-nav__item">
522 <a href="ft2-header_file_macros.html" title="Header File Macros" class="md-nav__link">
538 <li class="md-nav__item md-nav__item--nested">
540 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
542 <label class="md-nav__link" for="nav-5">
545 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
546 <label class="md-nav__title" for="nav-5">
549 <ul class="md-nav__list" data-md-scrollfix>
557 <li class="md-nav__item">
558 <a href="ft2-multiple_masters.html" title="Multiple Masters" class="md-nav__link">
569 <li class="md-nav__item">
570 <a href="ft2-truetype_tables.html" title="TrueType Tables" class="md-nav__link">
581 <li class="md-nav__item">
582 <a href="ft2-type1_tables.html" title="Type 1 Tables" class="md-nav__link">
593 <li class="md-nav__item">
594 <a href="ft2-sfnt_names.html" title="SFNT Names" class="md-nav__link">
605 <li class="md-nav__item">
606 <a href="ft2-bdf_fonts.html" title="BDF and PCF Files" class="md-nav__link">
617 <li class="md-nav__item">
618 <a href="ft2-cid_fonts.html" title="CID Fonts" class="md-nav__link">
629 <li class="md-nav__item">
630 <a href="ft2-pfr_fonts.html" title="PFR Fonts" class="md-nav__link">
641 <li class="md-nav__item">
642 <a href="ft2-winfnt_fonts.html" title="Window FNT Files" class="md-nav__link">
653 <li class="md-nav__item">
654 <a href="ft2-font_formats.html" title="Font Formats" class="md-nav__link">
665 <li class="md-nav__item">
666 <a href="ft2-gasp_table.html" title="Gasp Table" class="md-nav__link">
682 <li class="md-nav__item md-nav__item--nested">
684 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-6" type="checkbox" id="nav-6">
686 <label class="md-nav__link" for="nav-6">
687 Controlling FreeType Modules
689 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
690 <label class="md-nav__title" for="nav-6">
691 Controlling FreeType Modules
693 <ul class="md-nav__list" data-md-scrollfix>
701 <li class="md-nav__item">
702 <a href="ft2-auto_hinter.html" title="The auto-hinter" class="md-nav__link">
713 <li class="md-nav__item">
714 <a href="ft2-cff_driver.html" title="The CFF driver" class="md-nav__link">
725 <li class="md-nav__item">
726 <a href="ft2-t1_cid_driver.html" title="The Type 1 and CID drivers" class="md-nav__link">
727 The Type 1 and CID drivers
737 <li class="md-nav__item">
738 <a href="ft2-tt_driver.html" title="The TrueType driver" class="md-nav__link">
749 <li class="md-nav__item">
750 <a href="ft2-pcf_driver.html" title="The PCF driver" class="md-nav__link">
761 <li class="md-nav__item">
762 <a href="ft2-properties.html" title="Driver properties" class="md-nav__link">
773 <li class="md-nav__item">
774 <a href="ft2-parameter_tags.html" title="Parameter Tags" class="md-nav__link">
785 <li class="md-nav__item">
786 <a href="ft2-lcd_rendering.html" title="Subpixel Rendering" class="md-nav__link">
802 <li class="md-nav__item md-nav__item--nested">
804 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-7" type="checkbox" id="nav-7">
806 <label class="md-nav__link" for="nav-7">
809 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
810 <label class="md-nav__title" for="nav-7">
813 <ul class="md-nav__list" data-md-scrollfix>
821 <li class="md-nav__item">
822 <a href="ft2-cache_subsystem.html" title="Cache Sub-System" class="md-nav__link">
838 <li class="md-nav__item md-nav__item--nested">
840 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-8" type="checkbox" id="nav-8">
842 <label class="md-nav__link" for="nav-8">
845 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
846 <label class="md-nav__title" for="nav-8">
849 <ul class="md-nav__list" data-md-scrollfix>
857 <li class="md-nav__item">
858 <a href="ft2-computations.html" title="Computations" class="md-nav__link">
869 <li class="md-nav__item">
870 <a href="ft2-list_processing.html" title="List Processing" class="md-nav__link">
881 <li class="md-nav__item">
882 <a href="ft2-outline_processing.html" title="Outline Processing" class="md-nav__link">
893 <li class="md-nav__item">
894 <a href="ft2-quick_advance.html" title="Quick retrieval of advance values" class="md-nav__link">
895 Quick retrieval of advance values
905 <li class="md-nav__item">
906 <a href="ft2-bitmap_handling.html" title="Bitmap Handling" class="md-nav__link">
917 <li class="md-nav__item">
918 <a href="ft2-raster.html" title="Scanline Converter" class="md-nav__link">
929 <li class="md-nav__item">
930 <a href="ft2-glyph_stroker.html" title="Glyph Stroker" class="md-nav__link">
941 <li class="md-nav__item">
942 <a href="ft2-system_interface.html" title="System Interface" class="md-nav__link">
953 <li class="md-nav__item">
954 <a href="ft2-module_management.html" title="Module Management" class="md-nav__link">
965 <li class="md-nav__item">
966 <a href="ft2-gzip.html" title="GZIP Streams" class="md-nav__link">
977 <li class="md-nav__item">
978 <a href="ft2-lzw.html" title="LZW Streams" class="md-nav__link">
989 <li class="md-nav__item">
990 <a href="ft2-bzip2.html" title="BZIP2 Streams" class="md-nav__link">
1006 <li class="md-nav__item md-nav__item--nested">
1008 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-9" type="checkbox" id="nav-9">
1010 <label class="md-nav__link" for="nav-9">
1013 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
1014 <label class="md-nav__title" for="nav-9">
1017 <ul class="md-nav__list" data-md-scrollfix>
1025 <li class="md-nav__item">
1026 <a href="ft2-error_enumerations.html" title="Error Enumerations" class="md-nav__link">
1037 <li class="md-nav__item">
1038 <a href="ft2-error_code_values.html" title="Error Code Values" class="md-nav__link">
1054 <li class="md-nav__item md-nav__item--nested">
1056 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-10" type="checkbox" id="nav-10">
1058 <label class="md-nav__link" for="nav-10">
1061 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
1062 <label class="md-nav__title" for="nav-10">
1065 <ul class="md-nav__list" data-md-scrollfix>
1073 <li class="md-nav__item">
1074 <a href="ft2-ot_validation.html" title="OpenType Validation" class="md-nav__link">
1085 <li class="md-nav__item">
1086 <a href="ft2-incremental.html" title="Incremental Loading" class="md-nav__link">
1097 <li class="md-nav__item">
1098 <a href="ft2-truetype_engine.html" title="The TrueType Engine" class="md-nav__link">
1109 <li class="md-nav__item">
1110 <a href="ft2-gx_validation.html" title="TrueTypeGX/AAT Validation" class="md-nav__link">
1111 TrueTypeGX/AAT Validation
1128 <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
1129 <div class="md-sidebar__scrollwrap">
1130 <div class="md-sidebar__inner">
1132 <nav class="md-nav md-nav--secondary">
1138 <label class="md-nav__title" for="__toc">Table of contents</label>
1139 <ul class="md-nav__list" data-md-scrollfix>
1141 <li class="md-nav__item">
1142 <a href="#synopsis" title="Synopsis" class="md-nav__link">
1148 <li class="md-nav__item">
1149 <a href="#ft_glyph" title="FT_Glyph" class="md-nav__link">
1155 <li class="md-nav__item">
1156 <a href="#ft_glyphrec" title="FT_GlyphRec" class="md-nav__link">
1162 <li class="md-nav__item">
1163 <a href="#ft_bitmapglyph" title="FT_BitmapGlyph" class="md-nav__link">
1169 <li class="md-nav__item">
1170 <a href="#ft_bitmapglyphrec" title="FT_BitmapGlyphRec" class="md-nav__link">
1176 <li class="md-nav__item">
1177 <a href="#ft_outlineglyph" title="FT_OutlineGlyph" class="md-nav__link">
1183 <li class="md-nav__item">
1184 <a href="#ft_outlineglyphrec" title="FT_OutlineGlyphRec" class="md-nav__link">
1190 <li class="md-nav__item">
1191 <a href="#ft_new_glyph" title="FT_New_Glyph" class="md-nav__link">
1197 <li class="md-nav__item">
1198 <a href="#ft_get_glyph" title="FT_Get_Glyph" class="md-nav__link">
1204 <li class="md-nav__item">
1205 <a href="#ft_glyph_copy" title="FT_Glyph_Copy" class="md-nav__link">
1211 <li class="md-nav__item">
1212 <a href="#ft_glyph_transform" title="FT_Glyph_Transform" class="md-nav__link">
1218 <li class="md-nav__item">
1219 <a href="#ft_glyph_bbox_mode" title="FT_Glyph_BBox_Mode" class="md-nav__link">
1225 <li class="md-nav__item">
1226 <a href="#ft_glyph_get_cbox" title="FT_Glyph_Get_CBox" class="md-nav__link">
1232 <li class="md-nav__item">
1233 <a href="#ft_glyph_to_bitmap" title="FT_Glyph_To_Bitmap" class="md-nav__link">
1239 <li class="md-nav__item">
1240 <a href="#ft_done_glyph" title="FT_Done_Glyph" class="md-nav__link">
1258 <div class="md-content">
1259 <article class="md-content__inner md-typeset">
1263 <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>
1265 <h1 id="glyph-management">Glyph Management<a class="headerlink" href="#glyph-management" title="Permanent link">¶</a></h1>
1266 <h2 id="synopsis">Synopsis<a class="headerlink" href="#synopsis" title="Permanent link">¶</a></h2>
1267 <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>
1268 <h2 id="ft_glyph">FT_Glyph<a class="headerlink" href="#ft_glyph" title="Permanent link">¶</a></h2>
1269 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1270 <div class = "codehilite">
1272 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_GlyphRec_* <b>FT_Glyph</b>;
1276 <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>
1279 <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>
1282 <h2 id="ft_glyphrec">FT_GlyphRec<a class="headerlink" href="#ft_glyphrec" title="Permanent link">¶</a></h2>
1283 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1284 <div class = "codehilite">
1286 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_GlyphRec_
1288 <a href="ft2-base_interface.html#ft_library">FT_Library</a> library;
1289 <span class="keyword">const</span> FT_Glyph_Class* clazz;
1290 <a href="ft2-basic_types.html#ft_glyph_format">FT_Glyph_Format</a> format;
1291 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a> advance;
1293 } <b>FT_GlyphRec</b>;
1297 <p>The root glyph structure contains a given glyph image plus its advance width in 16.16 fixed-point format.</p>
1300 <table class="fields">
1301 <tr><td class="val" id="library">library</td><td class="desc">
1302 <p>A handle to the FreeType library object.</p>
1304 <tr><td class="val" id="clazz">clazz</td><td class="desc">
1305 <p>A pointer to the glyph's class. Private.</p>
1307 <tr><td class="val" id="format">format</td><td class="desc">
1308 <p>The format of the glyph's image.</p>
1310 <tr><td class="val" id="advance">advance</td><td class="desc">
1311 <p>A 16.16 vector that gives the glyph's advance width.</p>
1317 <h2 id="ft_bitmapglyph">FT_BitmapGlyph<a class="headerlink" href="#ft_bitmapglyph" title="Permanent link">¶</a></h2>
1318 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1319 <div class = "codehilite">
1321 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_BitmapGlyphRec_* <b>FT_BitmapGlyph</b>;
1325 <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>
1328 <h2 id="ft_bitmapglyphrec">FT_BitmapGlyphRec<a class="headerlink" href="#ft_bitmapglyphrec" title="Permanent link">¶</a></h2>
1329 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1330 <div class = "codehilite">
1332 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_BitmapGlyphRec_
1334 <a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a> root;
1335 <a href="ft2-basic_types.html#ft_int">FT_Int</a> left;
1336 <a href="ft2-basic_types.html#ft_int">FT_Int</a> top;
1337 <a href="ft2-basic_types.html#ft_bitmap">FT_Bitmap</a> bitmap;
1339 } <b>FT_BitmapGlyphRec</b>;
1343 <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>
1346 <table class="fields">
1347 <tr><td class="val" id="root">root</td><td class="desc">
1348 <p>The root <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> fields.</p>
1350 <tr><td class="val" id="left">left</td><td class="desc">
1351 <p>The left-side bearing, i.e., the horizontal distance from the current pen position to the left border of the glyph bitmap.</p>
1353 <tr><td class="val" id="top">top</td><td class="desc">
1354 <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>
1356 <tr><td class="val" id="bitmap">bitmap</td><td class="desc">
1357 <p>A descriptor for the bitmap.</p>
1363 <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>
1364 <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>
1367 <h2 id="ft_outlineglyph">FT_OutlineGlyph<a class="headerlink" href="#ft_outlineglyph" title="Permanent link">¶</a></h2>
1368 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1369 <div class = "codehilite">
1371 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_OutlineGlyphRec_* <b>FT_OutlineGlyph</b>;
1375 <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>
1378 <h2 id="ft_outlineglyphrec">FT_OutlineGlyphRec<a class="headerlink" href="#ft_outlineglyphrec" title="Permanent link">¶</a></h2>
1379 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1380 <div class = "codehilite">
1382 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_OutlineGlyphRec_
1384 <a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a> root;
1385 <a href="ft2-outline_processing.html#ft_outline">FT_Outline</a> outline;
1387 } <b>FT_OutlineGlyphRec</b>;
1391 <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>
1394 <table class="fields">
1395 <tr><td class="val" id="root">root</td><td class="desc">
1396 <p>The root <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> fields.</p>
1398 <tr><td class="val" id="outline">outline</td><td class="desc">
1399 <p>A descriptor for the outline.</p>
1405 <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>
1406 <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>
1407 <p>The outline's tables are always owned by the object and are destroyed with it.</p>
1410 <h2 id="ft_new_glyph">FT_New_Glyph<a class="headerlink" href="#ft_new_glyph" title="Permanent link">¶</a></h2>
1411 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1412 <div class = "codehilite">
1414 FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1415 <b>FT_New_Glyph</b>( <a href="ft2-base_interface.html#ft_library">FT_Library</a> library,
1416 <a href="ft2-basic_types.html#ft_glyph_format">FT_Glyph_Format</a> format,
1417 <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> *aglyph );
1421 <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>
1424 <table class="fields">
1425 <tr><td class="val" id="library">library</td><td class="desc">
1426 <p>A handle to the FreeType library object.</p>
1428 <tr><td class="val" id="format">format</td><td class="desc">
1429 <p>The format of the glyph's image.</p>
1435 <table class="fields">
1436 <tr><td class="val" id="aglyph">aglyph</td><td class="desc">
1437 <p>A handle to the glyph object.</p>
1443 <p>FreeType error code. 0 means success.</p>
1449 <h2 id="ft_get_glyph">FT_Get_Glyph<a class="headerlink" href="#ft_get_glyph" title="Permanent link">¶</a></h2>
1450 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1451 <div class = "codehilite">
1453 FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1454 <b>FT_Get_Glyph</b>( <a href="ft2-base_interface.html#ft_glyphslot">FT_GlyphSlot</a> slot,
1455 <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> *aglyph );
1459 <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>
1462 <table class="fields">
1463 <tr><td class="val" id="slot">slot</td><td class="desc">
1464 <p>A handle to the source glyph slot.</p>
1470 <table class="fields">
1471 <tr><td class="val" id="aglyph">aglyph</td><td class="desc">
1472 <p>A handle to the glyph object.</p>
1478 <p>FreeType error code. 0 means success.</p>
1481 <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>
1484 <h2 id="ft_glyph_copy">FT_Glyph_Copy<a class="headerlink" href="#ft_glyph_copy" title="Permanent link">¶</a></h2>
1485 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1486 <div class = "codehilite">
1488 FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1489 <b>FT_Glyph_Copy</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> source,
1490 <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> *target );
1494 <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>
1497 <table class="fields">
1498 <tr><td class="val" id="source">source</td><td class="desc">
1499 <p>A handle to the source glyph object.</p>
1505 <table class="fields">
1506 <tr><td class="val" id="target">target</td><td class="desc">
1507 <p>A handle to the target glyph object. 0 in case of error.</p>
1513 <p>FreeType error code. 0 means success.</p>
1516 <h2 id="ft_glyph_transform">FT_Glyph_Transform<a class="headerlink" href="#ft_glyph_transform" title="Permanent link">¶</a></h2>
1517 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1518 <div class = "codehilite">
1520 FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1521 <b>FT_Glyph_Transform</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> glyph,
1522 <a href="ft2-basic_types.html#ft_matrix">FT_Matrix</a>* matrix,
1523 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a>* delta );
1527 <p>Transform a glyph image if its format is scalable.</p>
1530 <table class="fields">
1531 <tr><td class="val" id="glyph">glyph</td><td class="desc">
1532 <p>A handle to the target glyph object.</p>
1538 <table class="fields">
1539 <tr><td class="val" id="matrix">matrix</td><td class="desc">
1540 <p>A pointer to a 2x2 matrix to apply.</p>
1542 <tr><td class="val" id="delta">delta</td><td class="desc">
1543 <p>A pointer to a 2d vector to apply. Coordinates are expressed in 1/64th of a pixel.</p>
1549 <p>FreeType error code (if not 0, the glyph format is not scalable).</p>
1552 <p>The 2x2 transformation matrix is also applied to the glyph's advance vector.</p>
1555 <h2 id="ft_glyph_bbox_mode">FT_Glyph_BBox_Mode<a class="headerlink" href="#ft_glyph_bbox_mode" title="Permanent link">¶</a></h2>
1556 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1557 <div class = "codehilite">
1559 <span class="keyword">typedef</span> <span class="keyword">enum</span> FT_Glyph_BBox_Mode_
1561 <a href="ft2-glyph_management.html#ft_glyph_bbox_unscaled">FT_GLYPH_BBOX_UNSCALED</a> = 0,
1562 <a href="ft2-glyph_management.html#ft_glyph_bbox_subpixels">FT_GLYPH_BBOX_SUBPIXELS</a> = 0,
1563 <a href="ft2-glyph_management.html#ft_glyph_bbox_gridfit">FT_GLYPH_BBOX_GRIDFIT</a> = 1,
1564 <a href="ft2-glyph_management.html#ft_glyph_bbox_truncate">FT_GLYPH_BBOX_TRUNCATE</a> = 2,
1565 <a href="ft2-glyph_management.html#ft_glyph_bbox_pixels">FT_GLYPH_BBOX_PIXELS</a> = 3
1567 } <b>FT_Glyph_BBox_Mode</b>;
1570 /* these constants are deprecated; use the corresponding */
1571 /* `<b>FT_Glyph_BBox_Mode</b>` values instead */
1572 #<span class="keyword">define</span> ft_glyph_bbox_unscaled <a href="ft2-glyph_management.html#ft_glyph_bbox_unscaled">FT_GLYPH_BBOX_UNSCALED</a>
1573 #<span class="keyword">define</span> ft_glyph_bbox_subpixels <a href="ft2-glyph_management.html#ft_glyph_bbox_subpixels">FT_GLYPH_BBOX_SUBPIXELS</a>
1574 #<span class="keyword">define</span> ft_glyph_bbox_gridfit <a href="ft2-glyph_management.html#ft_glyph_bbox_gridfit">FT_GLYPH_BBOX_GRIDFIT</a>
1575 #<span class="keyword">define</span> ft_glyph_bbox_truncate <a href="ft2-glyph_management.html#ft_glyph_bbox_truncate">FT_GLYPH_BBOX_TRUNCATE</a>
1576 #<span class="keyword">define</span> ft_glyph_bbox_pixels <a href="ft2-glyph_management.html#ft_glyph_bbox_pixels">FT_GLYPH_BBOX_PIXELS</a>
1580 <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>
1583 <table class="fields">
1584 <tr><td class="val" id="ft_glyph_bbox_unscaled">FT_GLYPH_BBOX_UNSCALED</td><td class="desc">
1585 <p>Return unscaled font units.</p>
1587 <tr><td class="val" id="ft_glyph_bbox_subpixels">FT_GLYPH_BBOX_SUBPIXELS</td><td class="desc">
1588 <p>Return unfitted 26.6 coordinates.</p>
1590 <tr><td class="val" id="ft_glyph_bbox_gridfit">FT_GLYPH_BBOX_GRIDFIT</td><td class="desc">
1591 <p>Return grid-fitted 26.6 coordinates.</p>
1593 <tr><td class="val" id="ft_glyph_bbox_truncate">FT_GLYPH_BBOX_TRUNCATE</td><td class="desc">
1594 <p>Return coordinates in integer pixels.</p>
1596 <tr><td class="val" id="ft_glyph_bbox_pixels">FT_GLYPH_BBOX_PIXELS</td><td class="desc">
1597 <p>Return grid-fitted pixel coordinates.</p>
1603 <h2 id="ft_glyph_get_cbox">FT_Glyph_Get_CBox<a class="headerlink" href="#ft_glyph_get_cbox" title="Permanent link">¶</a></h2>
1604 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1605 <div class = "codehilite">
1607 FT_EXPORT( <span class="keyword">void</span> )
1608 <b>FT_Glyph_Get_CBox</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> glyph,
1609 <a href="ft2-basic_types.html#ft_uint">FT_UInt</a> bbox_mode,
1610 <a href="ft2-basic_types.html#ft_bbox">FT_BBox</a> *acbox );
1614 <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>
1615 <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>
1618 <table class="fields">
1619 <tr><td class="val" id="glyph">glyph</td><td class="desc">
1620 <p>A handle to the source glyph object.</p>
1622 <tr><td class="val" id="mode">mode</td><td class="desc">
1623 <p>The mode that indicates how to interpret the returned bounding box values.</p>
1629 <table class="fields">
1630 <tr><td class="val" id="acbox">acbox</td><td class="desc">
1631 <p>The glyph coordinate bounding box. Coordinates are expressed in 1/64th of pixels if it is grid-fitted.</p>
1637 <p>Coordinates are relative to the glyph origin, using the y upwards convention.</p>
1638 <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>
1639 <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>
1640 <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:
1641 <div class="codehilite"><pre><span></span> width = bbox.xMax - bbox.xMin;
1642 height = bbox.yMax - bbox.yMin;
1644 <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:
1645 <div class="codehilite"><pre><span></span> bbox.xMin = FLOOR(bbox.xMin);
1646 bbox.yMin = FLOOR(bbox.yMin);
1647 bbox.xMax = CEILING(bbox.xMax);
1648 bbox.yMax = CEILING(bbox.yMax);
1650 <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>
1651 <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>
1654 <h2 id="ft_glyph_to_bitmap">FT_Glyph_To_Bitmap<a class="headerlink" href="#ft_glyph_to_bitmap" title="Permanent link">¶</a></h2>
1655 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1656 <div class = "codehilite">
1658 FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> )
1659 <b>FT_Glyph_To_Bitmap</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a>* the_glyph,
1660 <a href="ft2-base_interface.html#ft_render_mode">FT_Render_Mode</a> render_mode,
1661 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a>* origin,
1662 <a href="ft2-basic_types.html#ft_bool">FT_Bool</a> destroy );
1666 <p>Convert a given glyph object to a bitmap glyph object.</p>
1669 <table class="fields">
1670 <tr><td class="val" id="the_glyph">the_glyph</td><td class="desc">
1671 <p>A pointer to a handle to the target glyph.</p>
1677 <table class="fields">
1678 <tr><td class="val" id="render_mode">render_mode</td><td class="desc">
1679 <p>An enumeration that describes how the data is rendered.</p>
1681 <tr><td class="val" id="origin">origin</td><td class="desc">
1682 <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>
1684 <tr><td class="val" id="destroy">destroy</td><td class="desc">
1685 <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>
1691 <p>FreeType error code. 0 means success.</p>
1694 <p>This function does nothing if the glyph format isn't scalable.</p>
1695 <p>The glyph image is translated with the <code>origin</code> vector before rendering.</p>
1696 <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):
1697 <div class="codehilite"><pre><span></span> FT_Glyph glyph;
1698 FT_BitmapGlyph glyph_bitmap;
1702 error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAULT );
1704 // extract glyph image
1705 error = FT_Get_Glyph( face->glyph, &glyph );
1707 // convert to a bitmap (default render mode + destroying old)
1708 if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )
1710 error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,
1712 if ( error ) // `glyph' unchanged
1716 // access bitmap content by typecasting
1717 glyph_bitmap = (FT_BitmapGlyph)glyph;
1719 // do funny stuff with it, like blitting/drawing
1722 // discard glyph image (bitmap or not)
1723 FT_Done_Glyph( glyph );
1725 <p>Here is another example, again without error handling:
1726 <div class="codehilite"><pre><span></span> FT_Glyph glyphs[MAX_GLYPHS]
1731 for ( idx = 0; i < MAX_GLYPHS; i++ )
1732 error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||
1733 FT_Get_Glyph ( face->glyph, &glyphs[idx] );
1737 for ( idx = 0; i < MAX_GLYPHS; i++ )
1739 FT_Glyph bitmap = glyphs[idx];
1744 // after this call, `bitmap' no longer points into
1745 // the `glyphs' array (and the old value isn't destroyed)
1746 FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 );
1750 FT_Done_Glyph( bitmap );
1755 for ( idx = 0; i < MAX_GLYPHS; i++ )
1756 FT_Done_Glyph( glyphs[idx] );
1760 <h2 id="ft_done_glyph">FT_Done_Glyph<a class="headerlink" href="#ft_done_glyph" title="Permanent link">¶</a></h2>
1761 <p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p>
1762 <div class = "codehilite">
1764 FT_EXPORT( <span class="keyword">void</span> )
1765 <b>FT_Done_Glyph</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> glyph );
1769 <p>Destroy a given glyph.</p>
1772 <table class="fields">
1773 <tr><td class="val" id="glyph">glyph</td><td class="desc">
1774 <p>A handle to the target glyph object.</p>
1794 <footer class="md-footer">
1796 <div class="md-footer-nav">
1797 <nav class="md-footer-nav__inner md-grid">
1799 <a href="ft2-layer_management.html" title="Glyph Layer Management" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
1800 <div class="md-flex__cell md-flex__cell--shrink">
1801 <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
1803 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
1804 <span class="md-flex__ellipsis">
1805 <span class="md-footer-nav__direction">
1808 Glyph Layer Management
1814 <a href="ft2-mac_specific.html" title="Mac Specific Interface" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
1815 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
1816 <span class="md-flex__ellipsis">
1817 <span class="md-footer-nav__direction">
1820 Mac Specific Interface
1823 <div class="md-flex__cell md-flex__cell--shrink">
1824 <i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
1831 <div class="md-footer-meta md-typeset">
1832 <div class="md-footer-meta__inner md-grid">
1833 <div class="md-footer-copyright">
1835 <div class="md-footer-copyright__highlight">
1836 Copyright 2019 <a href = "https://www.freetype.org/license.html">The FreeType Project</a>.
1840 <a href="https://www.mkdocs.org">MkDocs</a>
1842 <a href="https://squidfunk.github.io/mkdocs-material/">
1843 Material for MkDocs</a>
1852 <script src="assets/javascripts/application.d9aa80ab.js"></script>
1854 <script>app.initialize({version:"1.0.4",url:{base:"."}})</script>
1856 <script src="javascripts/extra.js"></script>