Imported Upstream version 2.9.1
[platform/upstream/freetype2.git] / docs / reference / ft2-glyph_variants.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "https://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>FreeType-2.9.1 API Reference</title>
7 <style type="text/css">
8   a:link { color: #0000EF; }
9   a:visited { color: #51188E; }
10   a:hover { color: #FF0000; }
11
12   body { font-family: Verdana, Geneva, Arial, Helvetica, serif;
13          color: #000000;
14          background: #FFFFFF;
15          width: 87%;
16          margin: auto; }
17
18   div.section { width: 75%;
19                 margin: auto; }
20   div.section hr { margin: 4ex 0 1ex 0; }
21   div.section h4 { background-color: #EEEEFF;
22                    font-size: medium;
23                    font-style: oblique;
24                    font-weight: bold;
25                    margin: 3ex 0 1.5ex 9%;
26                    padding: 0.3ex 0 0.3ex 1%; }
27   div.section p { margin: 1.5ex 0 1.5ex 10%; }
28   div.section pre { margin: 3ex 0 3ex 9%;
29                     background-color: #D6E8FF;
30                     padding: 2ex 0 2ex 1%; }
31   div.section table.fields { width: 90%;
32                              margin: 1.5ex 0 1.5ex 10%; }
33   div.section table.toc { width: 95%;
34                           margin: 1.5ex 0 1.5ex 5%; }
35   div.timestamp { text-align: center;
36                   font-size: 69%;
37                   margin: 1.5ex 0 1.5ex 0; }
38
39   h1 { text-align: center; }
40   h3 { font-size: medium;
41        margin: 4ex 0 1.5ex 0; }
42
43   p { text-align: justify; }
44
45   pre.colored { color: blue; }
46
47   span.keyword { font-family: monospace;
48                  text-align: left;
49                  white-space: pre;
50                  color: darkblue; }
51
52   table.fields td.val { font-weight: bold;
53                         text-align: right;
54                         width: 30%;
55                         vertical-align: baseline;
56                         padding: 1ex 1em 1ex 0; }
57   table.fields td.desc { vertical-align: baseline;
58                          padding: 1ex 0 1ex 1em; }
59   table.fields td.desc p:first-child { margin: 0; }
60   table.fields td.desc p { margin: 1.5ex 0 0 0; }
61   table.index { margin: 6ex auto 6ex auto;
62                 border: 0;
63                 border-collapse: separate;
64                 border-spacing: 1em 0.3ex; }
65   table.index tr { padding: 0; }
66   table.index td { padding: 0; }
67   table.index-toc-link { width: 100%;
68                          border: 0;
69                          border-spacing: 0;
70                          margin: 1ex 0 1ex 0; }
71   table.index-toc-link td.left { padding: 0 0.5em 0 0.5em;
72                                  font-size: 83%;
73                                  text-align: left; }
74   table.index-toc-link td.middle { padding: 0 0.5em 0 0.5em;
75                                    font-size: 83%;
76                                    text-align: center; }
77   table.index-toc-link td.right { padding: 0 0.5em 0 0.5em;
78                                   font-size: 83%;
79                                   text-align: right; }
80   table.synopsis { margin: 6ex auto 6ex auto;
81                    border: 0;
82                    border-collapse: separate;
83                    border-spacing: 2em 0.6ex; }
84   table.synopsis tr { padding: 0; }
85   table.synopsis td { padding: 0; }
86   table.toc td.link { width: 30%;
87                       text-align: right;
88                       vertical-align: baseline;
89                       padding: 1ex 1em 1ex 0; }
90   table.toc td.desc { vertical-align: baseline;
91                       padding: 1ex 0 1ex 1em;
92                       text-align: left; }
93   table.toc td.desc p:first-child { margin: 0;
94                                     text-align: left; }
95   table.toc td.desc p { margin: 1.5ex 0 0 0;
96                         text-align: left; }
97
98 </style>
99 </head>
100 <body>
101
102 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table>
103 <h1>FreeType-2.9.1 API Reference</h1>
104
105 <h1 id="glyph_variants">Unicode Variation Sequences</h1>
106 <h2>Synopsis</h2>
107 <table class="synopsis">
108 <tr><td><a href="#FT_Face_GetCharVariantIndex">FT_Face_GetCharVariantIndex</a></td><td><a href="#FT_Face_GetVariantsOfChar">FT_Face_GetVariantsOfChar</a></td></tr>
109 <tr><td><a href="#FT_Face_GetCharVariantIsDefault">FT_Face_GetCharVariantIsDefault</a></td><td><a href="#FT_Face_GetCharsOfVariant">FT_Face_GetCharsOfVariant</a></td></tr>
110 <tr><td><a href="#FT_Face_GetVariantSelectors">FT_Face_GetVariantSelectors</a></td><td></td></tr>
111 </table>
112
113
114 <p>Many characters, especially for CJK scripts, have variant forms. They are a sort of grey area somewhere between being totally irrelevant and semantically distinct; for this reason, the Unicode consortium decided to introduce Variation Sequences (VS), consisting of a Unicode base character and a variation selector instead of further extending the already huge number of characters.</p>
115 <p>Unicode maintains two different sets, namely &lsquo;Standardized Variation Sequences&rsquo; and registered &lsquo;Ideographic Variation Sequences&rsquo; (IVS), collected in the &lsquo;Ideographic Variation Database&rsquo; (IVD).</p>
116 <p><a href="https://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt">https://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt</a> <a href="https://unicode.org/reports/tr37/">https://unicode.org/reports/tr37/</a> <a href="https://unicode.org/ivd/">https://unicode.org/ivd/</a></p>
117 <p>To date (January 2017), the character with the most ideographic variations is U+9089, having 32 such IVS.</p>
118 <p>Three Mongolian Variation Selectors have the values U+180B-U+180D; 256 generic Variation Selectors are encoded in the ranges U+FE00-U+FE0F and U+E0100-U+E01EF. IVS currently use Variation Selectors from the range U+E0100-U+E01EF only.</p>
119 <p>A VS consists of the base character value followed by a single Variation Selector. For example, to get the first variation of U+9089, you have to write the character sequence &lsquo;U+9089 U+E0100&rsquo;.</p>
120 <p>Adobe and MS decided to support both standardized and ideographic VS with a new cmap subtable (format&nbsp;14). It is an odd subtable because it is not a mapping of input code points to glyphs, but contains lists of all variations supported by the font.</p>
121 <p>A variation may be either &lsquo;default&rsquo; or &lsquo;non-default&rsquo; for a given font. A default variation is the one you will get for that code point if you look it up in the standard Unicode cmap. A non-default variation is a different glyph.</p>
122
123 <div class="section">
124 <h3 id="FT_Face_GetCharVariantIndex">FT_Face_GetCharVariantIndex</h3>
125 <p>Defined in FT_FREETYPE_H (freetype/freetype.h).</p>
126 <pre>
127   FT_EXPORT( <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a> )
128   <b>FT_Face_GetCharVariantIndex</b>( <a href="ft2-base_interface.html#FT_Face">FT_Face</a>   face,
129                                <a href="ft2-basic_types.html#FT_ULong">FT_ULong</a>  charcode,
130                                <a href="ft2-basic_types.html#FT_ULong">FT_ULong</a>  variantSelector );
131 </pre>
132
133 <p>Return the glyph index of a given character code as modified by the variation selector.</p>
134
135 <h4>input</h4>
136 <table class="fields">
137 <tr><td class="val" id="face">face</td><td class="desc">
138 <p>A handle to the source face object.</p>
139 </td></tr>
140 <tr><td class="val" id="charcode">charcode</td><td class="desc">
141 <p>The character code point in Unicode.</p>
142 </td></tr>
143 <tr><td class="val" id="variantSelector">variantSelector</td><td class="desc">
144 <p>The Unicode code point of the variation selector.</p>
145 </td></tr>
146 </table>
147
148 <h4>return</h4>
149 <p>The glyph index. 0&nbsp;means either &lsquo;undefined character code&rsquo;, or &lsquo;undefined selector code&rsquo;, or &lsquo;no variation selector cmap subtable&rsquo;, or &lsquo;current CharMap is not Unicode&rsquo;.</p>
150
151 <h4>note</h4>
152 <p>If you use FreeType to manipulate the contents of font files directly, be aware that the glyph index returned by this function doesn't always correspond to the internal indices used within the file. This is done to ensure that value&nbsp;0 always corresponds to the &lsquo;missing glyph&rsquo;.</p>
153 <p>This function is only meaningful if a) the font has a variation selector cmap sub table, and b) the current charmap has a Unicode encoding.</p>
154
155 <h4>since</h4>
156 <p>2.3.6</p>
157
158 <hr>
159 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
160
161 <div class="section">
162 <h3 id="FT_Face_GetCharVariantIsDefault">FT_Face_GetCharVariantIsDefault</h3>
163 <p>Defined in FT_FREETYPE_H (freetype/freetype.h).</p>
164 <pre>
165   FT_EXPORT( <a href="ft2-basic_types.html#FT_Int">FT_Int</a> )
166   <b>FT_Face_GetCharVariantIsDefault</b>( <a href="ft2-base_interface.html#FT_Face">FT_Face</a>   face,
167                                    <a href="ft2-basic_types.html#FT_ULong">FT_ULong</a>  charcode,
168                                    <a href="ft2-basic_types.html#FT_ULong">FT_ULong</a>  variantSelector );
169 </pre>
170
171 <p>Check whether this variation of this Unicode character is the one to be found in the &lsquo;cmap&rsquo;.</p>
172
173 <h4>input</h4>
174 <table class="fields">
175 <tr><td class="val" id="face">face</td><td class="desc">
176 <p>A handle to the source face object.</p>
177 </td></tr>
178 <tr><td class="val" id="charcode">charcode</td><td class="desc">
179 <p>The character codepoint in Unicode.</p>
180 </td></tr>
181 <tr><td class="val" id="variantSelector">variantSelector</td><td class="desc">
182 <p>The Unicode codepoint of the variation selector.</p>
183 </td></tr>
184 </table>
185
186 <h4>return</h4>
187 <p>1&nbsp;if found in the standard (Unicode) cmap, 0&nbsp;if found in the variation selector cmap, or -1 if it is not a variation.</p>
188
189 <h4>note</h4>
190 <p>This function is only meaningful if the font has a variation selector cmap subtable.</p>
191
192 <h4>since</h4>
193 <p>2.3.6</p>
194
195 <hr>
196 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
197
198 <div class="section">
199 <h3 id="FT_Face_GetVariantSelectors">FT_Face_GetVariantSelectors</h3>
200 <p>Defined in FT_FREETYPE_H (freetype/freetype.h).</p>
201 <pre>
202   FT_EXPORT( <a href="ft2-basic_types.html#FT_UInt32">FT_UInt32</a>* )
203   <b>FT_Face_GetVariantSelectors</b>( <a href="ft2-base_interface.html#FT_Face">FT_Face</a>  face );
204 </pre>
205
206 <p>Return a zero-terminated list of Unicode variation selectors found in the font.</p>
207
208 <h4>input</h4>
209 <table class="fields">
210 <tr><td class="val" id="face">face</td><td class="desc">
211 <p>A handle to the source face object.</p>
212 </td></tr>
213 </table>
214
215 <h4>return</h4>
216 <p>A pointer to an array of selector code points, or NULL if there is no valid variation selector cmap subtable.</p>
217
218 <h4>note</h4>
219 <p>The last item in the array is&nbsp;0; the array is owned by the <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object but can be overwritten or released on the next call to a FreeType function.</p>
220
221 <h4>since</h4>
222 <p>2.3.6</p>
223
224 <hr>
225 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
226
227 <div class="section">
228 <h3 id="FT_Face_GetVariantsOfChar">FT_Face_GetVariantsOfChar</h3>
229 <p>Defined in FT_FREETYPE_H (freetype/freetype.h).</p>
230 <pre>
231   FT_EXPORT( <a href="ft2-basic_types.html#FT_UInt32">FT_UInt32</a>* )
232   <b>FT_Face_GetVariantsOfChar</b>( <a href="ft2-base_interface.html#FT_Face">FT_Face</a>   face,
233                              <a href="ft2-basic_types.html#FT_ULong">FT_ULong</a>  charcode );
234 </pre>
235
236 <p>Return a zero-terminated list of Unicode variation selectors found for the specified character code.</p>
237
238 <h4>input</h4>
239 <table class="fields">
240 <tr><td class="val" id="face">face</td><td class="desc">
241 <p>A handle to the source face object.</p>
242 </td></tr>
243 <tr><td class="val" id="charcode">charcode</td><td class="desc">
244 <p>The character codepoint in Unicode.</p>
245 </td></tr>
246 </table>
247
248 <h4>return</h4>
249 <p>A pointer to an array of variation selector code points that are active for the given character, or NULL if the corresponding list is empty.</p>
250
251 <h4>note</h4>
252 <p>The last item in the array is&nbsp;0; the array is owned by the <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object but can be overwritten or released on the next call to a FreeType function.</p>
253
254 <h4>since</h4>
255 <p>2.3.6</p>
256
257 <hr>
258 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
259
260 <div class="section">
261 <h3 id="FT_Face_GetCharsOfVariant">FT_Face_GetCharsOfVariant</h3>
262 <p>Defined in FT_FREETYPE_H (freetype/freetype.h).</p>
263 <pre>
264   FT_EXPORT( <a href="ft2-basic_types.html#FT_UInt32">FT_UInt32</a>* )
265   <b>FT_Face_GetCharsOfVariant</b>( <a href="ft2-base_interface.html#FT_Face">FT_Face</a>   face,
266                              <a href="ft2-basic_types.html#FT_ULong">FT_ULong</a>  variantSelector );
267 </pre>
268
269 <p>Return a zero-terminated list of Unicode character codes found for the specified variation selector.</p>
270
271 <h4>input</h4>
272 <table class="fields">
273 <tr><td class="val" id="face">face</td><td class="desc">
274 <p>A handle to the source face object.</p>
275 </td></tr>
276 <tr><td class="val" id="variantSelector">variantSelector</td><td class="desc">
277 <p>The variation selector code point in Unicode.</p>
278 </td></tr>
279 </table>
280
281 <h4>return</h4>
282 <p>A list of all the code points that are specified by this selector (both default and non-default codes are returned) or NULL if there is no valid cmap or the variation selector is invalid.</p>
283
284 <h4>note</h4>
285 <p>The last item in the array is&nbsp;0; the array is owned by the <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object but can be overwritten or released on the next call to a FreeType function.</p>
286
287 <h4>since</h4>
288 <p>2.3.6</p>
289
290 <hr>
291 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
292
293 </body>
294 </html>