Imported Upstream version 1.4.6
[platform/upstream/harfbuzz.git] / docs / html / harfbuzz-Shaping.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Shaping: HarfBuzz Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="index.html" title="HarfBuzz Manual">
8 <link rel="up" href="ch08.html" title="Harfbuzz API">
9 <link rel="prev" href="harfbuzz-hb-font.html" title="hb-font">
10 <link rel="next" href="harfbuzz-hb-version.html" title="hb-version">
11 <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18                   <a href="#harfbuzz-Shaping.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
19                   <a href="#harfbuzz-Shaping.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
20 </td>
21 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
22 <td><a accesskey="u" href="ch08.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
23 <td><a accesskey="p" href="harfbuzz-hb-font.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
24 <td><a accesskey="n" href="harfbuzz-hb-version.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
25 </tr></table>
26 <div class="refentry">
27 <a name="harfbuzz-Shaping"></a><div class="titlepage"></div>
28 <div class="refnamediv"><table width="100%"><tr>
29 <td valign="top">
30 <h2><span class="refentrytitle"><a name="harfbuzz-Shaping.top_of_page"></a>Shaping</span></h2>
31 <p>Shaping — Conversion of text strings into positioned glyphs</p>
32 </td>
33 <td class="gallery_image" valign="top" align="right"></td>
34 </tr></table></div>
35 <div class="refsect1">
36 <a name="harfbuzz-Shaping.functions"></a><h2>Functions</h2>
37 <div class="informaltable"><table width="100%" border="0">
38 <colgroup>
39 <col width="150px" class="functions_return">
40 <col class="functions_name">
41 </colgroup>
42 <tbody>
43 <tr>
44 <td class="function_type">
45 <a class="link" href="harfbuzz-hb-common.html#hb-bool-t" title="hb_bool_t"><span class="returnvalue">hb_bool_t</span></a>
46 </td>
47 <td class="function_name">
48 <a class="link" href="harfbuzz-Shaping.html#hb-feature-from-string" title="hb_feature_from_string ()">hb_feature_from_string</a> <span class="c_punctuation">()</span>
49 </td>
50 </tr>
51 <tr>
52 <td class="function_type">
53 <span class="returnvalue">void</span>
54 </td>
55 <td class="function_name">
56 <a class="link" href="harfbuzz-Shaping.html#hb-feature-to-string" title="hb_feature_to_string ()">hb_feature_to_string</a> <span class="c_punctuation">()</span>
57 </td>
58 </tr>
59 <tr>
60 <td class="function_type">
61 <span class="returnvalue">void</span>
62 </td>
63 <td class="function_name">
64 <a class="link" href="harfbuzz-Shaping.html#hb-shape" title="hb_shape ()">hb_shape</a> <span class="c_punctuation">()</span>
65 </td>
66 </tr>
67 <tr>
68 <td class="function_type">
69 <a class="link" href="harfbuzz-hb-common.html#hb-bool-t" title="hb_bool_t"><span class="returnvalue">hb_bool_t</span></a>
70 </td>
71 <td class="function_name">
72 <a class="link" href="harfbuzz-Shaping.html#hb-shape-full" title="hb_shape_full ()">hb_shape_full</a> <span class="c_punctuation">()</span>
73 </td>
74 </tr>
75 <tr>
76 <td class="function_type">const <span class="returnvalue">char</span> **
77 </td>
78 <td class="function_name">
79 <a class="link" href="harfbuzz-Shaping.html#hb-shape-list-shapers" title="hb_shape_list_shapers ()">hb_shape_list_shapers</a> <span class="c_punctuation">()</span>
80 </td>
81 </tr>
82 </tbody>
83 </table></div>
84 </div>
85 <a name="hb-feature-t"></a><div class="refsect1">
86 <a name="harfbuzz-Shaping.other"></a><h2>Types and Values</h2>
87 <div class="informaltable"><table width="100%" border="0">
88 <colgroup>
89 <col width="150px" class="name">
90 <col class="description">
91 </colgroup>
92 <tbody><tr>
93 <td class="datatype_keyword"> </td>
94 <td class="function_name"><a class="link" href="harfbuzz-Shaping.html#hb-feature-t-struct" title="hb_feature_t">hb_feature_t</a></td>
95 </tr></tbody>
96 </table></div>
97 </div>
98 <div class="refsect1">
99 <a name="harfbuzz-Shaping.object-hierarchy"></a><h2>Object Hierarchy</h2>
100 <pre class="screen">    <a href="/home/behdad/.local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html">GBoxed</a>
101     <span class="lineart">╰──</span> hb_feature_t
102 </pre>
103 </div>
104 <div class="refsect1">
105 <a name="harfbuzz-Shaping.includes"></a><h2>Includes</h2>
106 <pre class="synopsis">#include &lt;hb.h&gt;
107 </pre>
108 </div>
109 <div class="refsect1">
110 <a name="harfbuzz-Shaping.description"></a><h2>Description</h2>
111 <p>Shaping is the central operation of HarfBuzz. Shaping operates on buffers,
112 which are sequences of Unicode characters that use the same font and have
113 the same text direction, script and language. After shaping the buffer
114 contains the output glyphs and their positions.</p>
115 </div>
116 <div class="refsect1">
117 <a name="harfbuzz-Shaping.functions_details"></a><h2>Functions</h2>
118 <div class="refsect2">
119 <a name="hb-feature-from-string"></a><h3>hb_feature_from_string ()</h3>
120 <pre class="programlisting"><a class="link" href="harfbuzz-hb-common.html#hb-bool-t" title="hb_bool_t"><span class="returnvalue">hb_bool_t</span></a>
121 hb_feature_from_string (<em class="parameter"><code>const <span class="type">char</span> *str</code></em>,
122                         <em class="parameter"><code><span class="type">int</span> len</code></em>,
123                         <em class="parameter"><code><a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> *feature</code></em>);</pre>
124 <p>Parses a string into a <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a>.</p>
125 <p>TODO: document the syntax here.</p>
126 <div class="refsect3">
127 <a name="hb-feature-from-string.parameters"></a><h4>Parameters</h4>
128 <div class="informaltable"><table width="100%" border="0">
129 <colgroup>
130 <col width="150px" class="parameters_name">
131 <col class="parameters_description">
132 <col width="200px" class="parameters_annotations">
133 </colgroup>
134 <tbody>
135 <tr>
136 <td class="parameter_name"><p>str</p></td>
137 <td class="parameter_description"><p> a string to parse. </p></td>
138 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=len][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> uint8_t]</span></td>
139 </tr>
140 <tr>
141 <td class="parameter_name"><p>len</p></td>
142 <td class="parameter_description"><p>length of <em class="parameter"><code>str</code></em>
143 , or -1 if string is <code class="literal">NULL</code> terminated</p></td>
144 <td class="parameter_annotations"> </td>
145 </tr>
146 <tr>
147 <td class="parameter_name"><p>feature</p></td>
148 <td class="parameter_description"><p> the <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> to initialize with the parsed values. </p></td>
149 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
150 </tr>
151 </tbody>
152 </table></div>
153 </div>
154 <div class="refsect3">
155 <a name="hb-feature-from-string.returns"></a><h4>Returns</h4>
156 <p><code class="literal">true</code> if <em class="parameter"><code>str</code></em>
157 is successfully parsed, <code class="literal">false</code> otherwise.</p>
158 </div>
159 <p class="since">Since: <a class="link" href="api-index-0-9-5.html#api-index-0.9.5">0.9.5</a></p>
160 </div>
161 <hr>
162 <div class="refsect2">
163 <a name="hb-feature-to-string"></a><h3>hb_feature_to_string ()</h3>
164 <pre class="programlisting"><span class="returnvalue">void</span>
165 hb_feature_to_string (<em class="parameter"><code><a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> *feature</code></em>,
166                       <em class="parameter"><code><span class="type">char</span> *buf</code></em>,
167                       <em class="parameter"><code>unsigned <span class="type">int</span> size</code></em>);</pre>
168 <p>Converts a <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> into a <code class="literal">NULL</code>-terminated string in the format
169 understood by <a class="link" href="harfbuzz-Shaping.html#hb-feature-from-string" title="hb_feature_from_string ()"><code class="function">hb_feature_from_string()</code></a>. The client in responsible for
170 allocating big enough size for <em class="parameter"><code>buf</code></em>
171 , 128 bytes is more than enough.</p>
172 <div class="refsect3">
173 <a name="hb-feature-to-string.parameters"></a><h4>Parameters</h4>
174 <div class="informaltable"><table width="100%" border="0">
175 <colgroup>
176 <col width="150px" class="parameters_name">
177 <col class="parameters_description">
178 <col width="200px" class="parameters_annotations">
179 </colgroup>
180 <tbody>
181 <tr>
182 <td class="parameter_name"><p>feature</p></td>
183 <td class="parameter_description"><p>an <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> to convert</p></td>
184 <td class="parameter_annotations"> </td>
185 </tr>
186 <tr>
187 <td class="parameter_name"><p>buf</p></td>
188 <td class="parameter_description"><p> output string. </p></td>
189 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
190 </tr>
191 <tr>
192 <td class="parameter_name"><p>size</p></td>
193 <td class="parameter_description"><p>the allocated size of <em class="parameter"><code>buf</code></em>
194 </p></td>
195 <td class="parameter_annotations"> </td>
196 </tr>
197 </tbody>
198 </table></div>
199 </div>
200 <p class="since">Since: <a class="link" href="api-index-0-9-5.html#api-index-0.9.5">0.9.5</a></p>
201 </div>
202 <hr>
203 <div class="refsect2">
204 <a name="hb-shape"></a><h3>hb_shape ()</h3>
205 <pre class="programlisting"><span class="returnvalue">void</span>
206 hb_shape (<em class="parameter"><code><a class="link" href="harfbuzz-hb-font.html#hb-font-t"><span class="type">hb_font_t</span></a> *font</code></em>,
207           <em class="parameter"><code><a class="link" href="harfbuzz-Buffers.html#hb-buffer-t"><span class="type">hb_buffer_t</span></a> *buffer</code></em>,
208           <em class="parameter"><code>const <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> *features</code></em>,
209           <em class="parameter"><code>unsigned <span class="type">int</span> num_features</code></em>);</pre>
210 <p>Shapes <em class="parameter"><code>buffer</code></em>
211  using <em class="parameter"><code>font</code></em>
212  turning its Unicode characters content to
213 positioned glyphs. If <em class="parameter"><code>features</code></em>
214  is not <code class="literal">NULL</code>, it will be used to control the
215 features applied during shaping.</p>
216 <div class="refsect3">
217 <a name="hb-shape.parameters"></a><h4>Parameters</h4>
218 <div class="informaltable"><table width="100%" border="0">
219 <colgroup>
220 <col width="150px" class="parameters_name">
221 <col class="parameters_description">
222 <col width="200px" class="parameters_annotations">
223 </colgroup>
224 <tbody>
225 <tr>
226 <td class="parameter_name"><p>font</p></td>
227 <td class="parameter_description"><p>an <a class="link" href="harfbuzz-hb-font.html#hb-font-t"><span class="type">hb_font_t</span></a> to use for shaping</p></td>
228 <td class="parameter_annotations"> </td>
229 </tr>
230 <tr>
231 <td class="parameter_name"><p>buffer</p></td>
232 <td class="parameter_description"><p>an <a class="link" href="harfbuzz-Buffers.html#hb-buffer-t"><span class="type">hb_buffer_t</span></a> to shape</p></td>
233 <td class="parameter_annotations"> </td>
234 </tr>
235 <tr>
236 <td class="parameter_name"><p>features</p></td>
237 <td class="parameter_description"><p> an array of user
238 specified <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> or <code class="literal">NULL</code>. </p></td>
239 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=num_features][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
240 </tr>
241 <tr>
242 <td class="parameter_name"><p>num_features</p></td>
243 <td class="parameter_description"><p>the length of <em class="parameter"><code>features</code></em>
244 array</p></td>
245 <td class="parameter_annotations"> </td>
246 </tr>
247 </tbody>
248 </table></div>
249 </div>
250 <p class="since">Since: <a class="link" href="api-index-0-9-2.html#api-index-0.9.2">0.9.2</a></p>
251 </div>
252 <hr>
253 <div class="refsect2">
254 <a name="hb-shape-full"></a><h3>hb_shape_full ()</h3>
255 <pre class="programlisting"><a class="link" href="harfbuzz-hb-common.html#hb-bool-t" title="hb_bool_t"><span class="returnvalue">hb_bool_t</span></a>
256 hb_shape_full (<em class="parameter"><code><a class="link" href="harfbuzz-hb-font.html#hb-font-t"><span class="type">hb_font_t</span></a> *font</code></em>,
257                <em class="parameter"><code><a class="link" href="harfbuzz-Buffers.html#hb-buffer-t"><span class="type">hb_buffer_t</span></a> *buffer</code></em>,
258                <em class="parameter"><code>const <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> *features</code></em>,
259                <em class="parameter"><code>unsigned <span class="type">int</span> num_features</code></em>,
260                <em class="parameter"><code>const <span class="type">char</span> * const *shaper_list</code></em>);</pre>
261 <p>See <a class="link" href="harfbuzz-Shaping.html#hb-shape" title="hb_shape ()"><code class="function">hb_shape()</code></a> for details. If <em class="parameter"><code>shaper_list</code></em>
262  is not <code class="literal">NULL</code>, the specified
263 shapers will be used in the given order, otherwise the default shapers list
264 will be used.</p>
265 <div class="refsect3">
266 <a name="hb-shape-full.parameters"></a><h4>Parameters</h4>
267 <div class="informaltable"><table width="100%" border="0">
268 <colgroup>
269 <col width="150px" class="parameters_name">
270 <col class="parameters_description">
271 <col width="200px" class="parameters_annotations">
272 </colgroup>
273 <tbody>
274 <tr>
275 <td class="parameter_name"><p>font</p></td>
276 <td class="parameter_description"><p>an <a class="link" href="harfbuzz-hb-font.html#hb-font-t"><span class="type">hb_font_t</span></a> to use for shaping</p></td>
277 <td class="parameter_annotations"> </td>
278 </tr>
279 <tr>
280 <td class="parameter_name"><p>buffer</p></td>
281 <td class="parameter_description"><p>an <a class="link" href="harfbuzz-Buffers.html#hb-buffer-t"><span class="type">hb_buffer_t</span></a> to shape</p></td>
282 <td class="parameter_annotations"> </td>
283 </tr>
284 <tr>
285 <td class="parameter_name"><p>features</p></td>
286 <td class="parameter_description"><p> an array of user
287 specified <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> or <code class="literal">NULL</code>. </p></td>
288 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=num_features][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
289 </tr>
290 <tr>
291 <td class="parameter_name"><p>num_features</p></td>
292 <td class="parameter_description"><p>the length of <em class="parameter"><code>features</code></em>
293 array</p></td>
294 <td class="parameter_annotations"> </td>
295 </tr>
296 <tr>
297 <td class="parameter_name"><p>shaper_list</p></td>
298 <td class="parameter_description"><p> a <code class="literal">NULL</code>-terminated
299 array of shapers to use or <code class="literal">NULL</code>. </p></td>
300 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
301 </tr>
302 </tbody>
303 </table></div>
304 </div>
305 <div class="refsect3">
306 <a name="hb-shape-full.returns"></a><h4>Returns</h4>
307 <p> false if all shapers failed, true otherwise</p>
308 </div>
309 <p class="since">Since: <a class="link" href="api-index-0-9-2.html#api-index-0.9.2">0.9.2</a></p>
310 </div>
311 <hr>
312 <div class="refsect2">
313 <a name="hb-shape-list-shapers"></a><h3>hb_shape_list_shapers ()</h3>
314 <pre class="programlisting">const <span class="returnvalue">char</span> **
315 hb_shape_list_shapers (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
316 <p>Retrieves the list of shapers supported by HarfBuzz.</p>
317 <div class="refsect3">
318 <a name="hb-shape-list-shapers.returns"></a><h4>Returns</h4>
319 <p> an array of
320 constant strings. </p>
321 <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1]</span></p>
322 </div>
323 <p class="since">Since: <a class="link" href="api-index-0-9-2.html#api-index-0.9.2">0.9.2</a></p>
324 </div>
325 </div>
326 <div class="refsect1">
327 <a name="harfbuzz-Shaping.other_details"></a><h2>Types and Values</h2>
328 <div class="refsect2">
329 <a name="hb-feature-t-struct"></a><h3>hb_feature_t</h3>
330 <pre class="programlisting">typedef struct {
331   hb_tag_t      tag;
332   uint32_t      value;
333   unsigned int  start;
334   unsigned int  end;
335 } hb_feature_t;
336 </pre>
337 </div>
338 </div>
339 </div>
340 <div class="footer">
341 <hr>Generated by GTK-Doc V1.25.1</div>
342 </body>
343 </html>