1
<?xml version='1.0' encoding='UTF-8'?>
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4
<!ENTITY version SYSTEM "version.xml">
6
<refentry id="cairo-Text">
8
<refentrytitle role="top_of_page">Text</refentrytitle>
9
<manvolnum>3</manvolnum>
10
<refmiscinfo>CAIRO Library</refmiscinfo>
14
<refname>Text</refname>
15
<refpurpose>Rendering text and sets of glyphs</refpurpose>
16
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
19
<refsynopsisdiv role="synopsis">
20
<title role="synopsis.title">Synopsis</title>
26
<link linkend="cairo-glyph-t">cairo_glyph_t</link>;
27
enum <link linkend="cairo-font-slant-t">cairo_font_slant_t</link>;
28
enum <link linkend="cairo-font-weight-t">cairo_font_weight_t</link>;
29
<link linkend="void">void</link> <link linkend="cairo-select-font-face">cairo_select_font_face</link> (<link linkend="cairo-t">cairo_t</link> *cr,
30
const <link linkend="char">char</link> *family,
31
<link linkend="cairo-font-slant-t">cairo_font_slant_t</link> slant,
32
<link linkend="cairo-font-weight-t">cairo_font_weight_t</link> weight);
33
<link linkend="void">void</link> <link linkend="cairo-set-font-size">cairo_set_font_size</link> (<link linkend="cairo-t">cairo_t</link> *cr,
34
<link linkend="double">double</link> size);
35
<link linkend="void">void</link> <link linkend="cairo-set-font-matrix">cairo_set_font_matrix</link> (<link linkend="cairo-t">cairo_t</link> *cr,
36
const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
37
<link linkend="void">void</link> <link linkend="cairo-get-font-matrix">cairo_get_font_matrix</link> (<link linkend="cairo-t">cairo_t</link> *cr,
38
<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
39
<link linkend="void">void</link> <link linkend="cairo-set-font-options">cairo_set_font_options</link> (<link linkend="cairo-t">cairo_t</link> *cr,
40
const <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options);
41
<link linkend="void">void</link> <link linkend="cairo-get-font-options">cairo_get_font_options</link> (<link linkend="cairo-t">cairo_t</link> *cr,
42
<link linkend="cairo-font-options-t">cairo_font_options_t</link> *options);
43
<link linkend="void">void</link> <link linkend="cairo-set-font-face">cairo_set_font_face</link> (<link linkend="cairo-t">cairo_t</link> *cr,
44
<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);
45
<link linkend="cairo-font-face-t">cairo_font_face_t</link>* <link linkend="cairo-get-font-face">cairo_get_font_face</link> (<link linkend="cairo-t">cairo_t</link> *cr);
46
<link linkend="void">void</link> <link linkend="cairo-set-scaled-font">cairo_set_scaled_font</link> (<link linkend="cairo-t">cairo_t</link> *cr,
47
const <link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);
48
<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link>* <link linkend="cairo-get-scaled-font">cairo_get_scaled_font</link> (<link linkend="cairo-t">cairo_t</link> *cr);
49
<link linkend="void">void</link> <link linkend="cairo-show-text">cairo_show_text</link> (<link linkend="cairo-t">cairo_t</link> *cr,
50
const <link linkend="char">char</link> *utf8);
51
<link linkend="void">void</link> <link linkend="cairo-show-glyphs">cairo_show_glyphs</link> (<link linkend="cairo-t">cairo_t</link> *cr,
52
const <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
53
<link linkend="int">int</link> num_glyphs);
54
<link linkend="void">void</link> <link linkend="cairo-font-extents">cairo_font_extents</link> (<link linkend="cairo-t">cairo_t</link> *cr,
55
<link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents);
56
<link linkend="void">void</link> <link linkend="cairo-text-extents">cairo_text_extents</link> (<link linkend="cairo-t">cairo_t</link> *cr,
57
const <link linkend="char">char</link> *utf8,
58
<link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);
59
<link linkend="void">void</link> <link linkend="cairo-glyph-extents">cairo_glyph_extents</link> (<link linkend="cairo-t">cairo_t</link> *cr,
60
const <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
61
<link linkend="int">int</link> num_glyphs,
62
<link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);
74
<refsect1 role="desc">
75
<title role="desc.title">Description</title>
81
<refsect1 role="details">
82
<title role="details.title">Details</title>
84
<title><anchor id="cairo-glyph-t" role="struct"/>cairo_glyph_t</title>
85
<indexterm><primary>cairo_glyph_t</primary></indexterm><programlisting>typedef struct {
92
The <link linkend="cairo-glyph-t"><type>cairo_glyph_t</type></link> structure holds information about a single glyph
93
when drawing or measuring text. A font is (in simple terms) a
94
collection of shapes used to draw text. A glyph is one of these
95
shapes. There can be multiple glyphs for a single character
96
(alternates to be used in different contexts, for example), or a
97
glyph can be a <firstterm>ligature</firstterm> of multiple
98
characters. Cairo doesn't expose any way of converting input text
99
into glyphs, so in order to use the Cairo interfaces that take
100
arrays of glyphs, you must directly access the appropriate
101
underlying font system.
104
Note that the offsets given by <parameter>x</parameter> and <parameter>y</parameter> are not cumulative. When
105
drawing or measuring text, each glyph is individually positioned
106
with respect to the overall origin</para>
109
</para><variablelist role="struct">
111
<term><link linkend="double">double</link> <structfield>x</structfield>;</term>
112
<listitem><simpara> the offset in the X direction between the origin used for
113
drawing or measuring the string and the origin of this glyph.
114
</simpara></listitem>
117
<term><link linkend="double">double</link> <structfield>y</structfield>;</term>
118
<listitem><simpara> the offset in the Y direction between the origin used for
119
drawing or measuring the string and the origin of this glyph.
120
</simpara></listitem>
122
</variablelist></refsect2>
124
<title><anchor id="cairo-font-slant-t" role="enum"/>enum cairo_font_slant_t</title>
125
<indexterm><primary>cairo_font_slant_t</primary></indexterm><programlisting>typedef enum _cairo_font_slant {
126
CAIRO_FONT_SLANT_NORMAL,
127
CAIRO_FONT_SLANT_ITALIC,
128
CAIRO_FONT_SLANT_OBLIQUE
129
} cairo_font_slant_t;
132
Specifies variants of a font face based on their slant.</para>
135
</para><variablelist role="enum">
137
<term><anchor id="CAIRO-FONT-SLANT-NORMAL:CAPS" role="constant"/><literal>CAIRO_FONT_SLANT_NORMAL</literal></term>
138
<listitem><simpara> Upright font style
139
</simpara></listitem>
142
<term><anchor id="CAIRO-FONT-SLANT-ITALIC:CAPS" role="constant"/><literal>CAIRO_FONT_SLANT_ITALIC</literal></term>
143
<listitem><simpara> Italic font style
144
</simpara></listitem>
147
<term><anchor id="CAIRO-FONT-SLANT-OBLIQUE:CAPS" role="constant"/><literal>CAIRO_FONT_SLANT_OBLIQUE</literal></term>
148
<listitem><simpara> Oblique font style
149
</simpara></listitem>
151
</variablelist></refsect2>
153
<title><anchor id="cairo-font-weight-t" role="enum"/>enum cairo_font_weight_t</title>
154
<indexterm><primary>cairo_font_weight_t</primary></indexterm><programlisting>typedef enum _cairo_font_weight {
155
CAIRO_FONT_WEIGHT_NORMAL,
156
CAIRO_FONT_WEIGHT_BOLD
157
} cairo_font_weight_t;
160
Specifies variants of a font face based on their weight.</para>
163
</para><variablelist role="enum">
165
<term><anchor id="CAIRO-FONT-WEIGHT-NORMAL:CAPS" role="constant"/><literal>CAIRO_FONT_WEIGHT_NORMAL</literal></term>
166
<listitem><simpara> Normal font weight
167
</simpara></listitem>
170
<term><anchor id="CAIRO-FONT-WEIGHT-BOLD:CAPS" role="constant"/><literal>CAIRO_FONT_WEIGHT_BOLD</literal></term>
171
<listitem><simpara> Bold font weight
172
</simpara></listitem>
174
</variablelist></refsect2>
176
<title><anchor id="cairo-select-font-face" role="function"/>cairo_select_font_face ()</title>
177
<indexterm><primary>cairo_select_font_face</primary></indexterm><programlisting><link linkend="void">void</link> cairo_select_font_face (<link linkend="cairo-t">cairo_t</link> *cr,
178
const <link linkend="char">char</link> *family,
179
<link linkend="cairo-font-slant-t">cairo_font_slant_t</link> slant,
180
<link linkend="cairo-font-weight-t">cairo_font_weight_t</link> weight);</programlisting>
182
Selects a family and style of font from a simplified description as
183
a family name, slant and weight. This function is meant to be used
184
only for applications with simple font needs: Cairo doesn't provide
185
for operations such as listing all available fonts on the system,
186
and it is expected that most applications will need to use a more
187
comprehensive font handling and text layout library in addition to
191
</para><variablelist role="params">
192
<varlistentry><term><parameter>cr</parameter> :</term>
193
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
194
</simpara></listitem></varlistentry>
195
<varlistentry><term><parameter>family</parameter> :</term>
196
<listitem><simpara> a font family name, encoded in UTF-8
197
</simpara></listitem></varlistentry>
198
<varlistentry><term><parameter>slant</parameter> :</term>
199
<listitem><simpara> the slant for the font
200
</simpara></listitem></varlistentry>
201
<varlistentry><term><parameter>weight</parameter> :</term>
202
<listitem><simpara> the weight for the font
203
</simpara></listitem></varlistentry>
204
</variablelist></refsect2>
206
<title><anchor id="cairo-set-font-size" role="function"/>cairo_set_font_size ()</title>
207
<indexterm><primary>cairo_set_font_size</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_font_size (<link linkend="cairo-t">cairo_t</link> *cr,
208
<link linkend="double">double</link> size);</programlisting>
210
Sets the current font matrix to a scale by a factor of <parameter>size</parameter>, replacing
211
any font matrix previously set with <link linkend="cairo-set-font-size"><function>cairo_set_font_size()</function></link> or
212
<link linkend="cairo-set-font-matrix"><function>cairo_set_font_matrix()</function></link>. This results in a font size of <parameter>size</parameter> user space
213
units. (More precisely, this matrix will result in the font's
214
em-square being a <parameter>size</parameter> by <parameter>size</parameter> square in user space.)</para>
217
</para><variablelist role="params">
218
<varlistentry><term><parameter>cr</parameter> :</term>
219
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
220
</simpara></listitem></varlistentry>
221
<varlistentry><term><parameter>size</parameter> :</term>
222
<listitem><simpara> the new font size, in user space units
223
</simpara></listitem></varlistentry>
224
</variablelist></refsect2>
226
<title><anchor id="cairo-set-font-matrix" role="function"/>cairo_set_font_matrix ()</title>
227
<indexterm><primary>cairo_set_font_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_font_matrix (<link linkend="cairo-t">cairo_t</link> *cr,
228
const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
230
Sets the current font matrix to <parameter>matrix</parameter>. The font matrix gives a
231
transformation from the design space of the font (in this space,
232
the em-square is 1 unit by 1 unit) to user space. Normally, a
233
simple scale is used (see <link linkend="cairo-set-font-size"><function>cairo_set_font_size()</function></link>), but a more
234
complex font matrix can be used to shear the font
235
or stretch it unequally along the two axes</para>
238
</para><variablelist role="params">
239
<varlistentry><term><parameter>cr</parameter> :</term>
240
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
241
</simpara></listitem></varlistentry>
242
<varlistentry><term><parameter>matrix</parameter> :</term>
243
<listitem><simpara> a <link linkend="cairo-matrix-t"><type>cairo_matrix_t</type></link> describing a transform to be applied to
245
</simpara></listitem></varlistentry>
246
</variablelist></refsect2>
248
<title><anchor id="cairo-get-font-matrix" role="function"/>cairo_get_font_matrix ()</title>
249
<indexterm><primary>cairo_get_font_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_get_font_matrix (<link linkend="cairo-t">cairo_t</link> *cr,
250
<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
252
Stores the current font matrix into <parameter>matrix</parameter>. See
253
<link linkend="cairo-set-font-matrix"><function>cairo_set_font_matrix()</function></link>.</para>
256
</para><variablelist role="params">
257
<varlistentry><term><parameter>cr</parameter> :</term>
258
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
259
</simpara></listitem></varlistentry>
260
<varlistentry><term><parameter>matrix</parameter> :</term>
261
<listitem><simpara> return value for the matrix
262
</simpara></listitem></varlistentry>
263
</variablelist></refsect2>
265
<title><anchor id="cairo-set-font-options" role="function"/>cairo_set_font_options ()</title>
266
<indexterm><primary>cairo_set_font_options</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_font_options (<link linkend="cairo-t">cairo_t</link> *cr,
267
const <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options);</programlisting>
269
Sets a set of custom font rendering options for the <link linkend="cairo-t"><type>cairo_t</type></link>.
270
Rendering options are derived by merging these options with the
271
options derived from underlying surface; if the value in <parameter>options</parameter>
272
has a default value (like <link linkend="CAIRO-ANTIALIAS-DEFAULT:CAPS"><literal>CAIRO_ANTIALIAS_DEFAULT</literal></link>), then the value
273
from the surface is used.</para>
276
</para><variablelist role="params">
277
<varlistentry><term><parameter>cr</parameter> :</term>
278
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
279
</simpara></listitem></varlistentry>
280
<varlistentry><term><parameter>options</parameter> :</term>
281
<listitem><simpara> font options to use
282
</simpara></listitem></varlistentry>
283
</variablelist></refsect2>
285
<title><anchor id="cairo-get-font-options" role="function"/>cairo_get_font_options ()</title>
286
<indexterm><primary>cairo_get_font_options</primary></indexterm><programlisting><link linkend="void">void</link> cairo_get_font_options (<link linkend="cairo-t">cairo_t</link> *cr,
287
<link linkend="cairo-font-options-t">cairo_font_options_t</link> *options);</programlisting>
289
Retrieves font rendering options set via <link linkend="cairo-set-font-options"><type>cairo_set_font_options</type></link>.
290
Note that the returned options do not include any options derived
291
from the underlying surface; they are literally the options
292
passed to <link linkend="cairo-set-font-options"><function>cairo_set_font_options()</function></link>.</para>
295
</para><variablelist role="params">
296
<varlistentry><term><parameter>cr</parameter> :</term>
297
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
298
</simpara></listitem></varlistentry>
299
<varlistentry><term><parameter>options</parameter> :</term>
300
<listitem><simpara> a <link linkend="cairo-font-options-t"><type>cairo_font_options_t</type></link> object into which to store
301
the retrieved options. All existing values are overwritten
302
</simpara></listitem></varlistentry>
303
</variablelist></refsect2>
305
<title><anchor id="cairo-set-font-face" role="function"/>cairo_set_font_face ()</title>
306
<indexterm><primary>cairo_set_font_face</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_font_face (<link linkend="cairo-t">cairo_t</link> *cr,
307
<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);</programlisting>
309
Replaces the current <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link> object in the <link linkend="cairo-t"><type>cairo_t</type></link> with
310
<parameter>font_face</parameter>. The replaced font face in the <link linkend="cairo-t"><type>cairo_t</type></link> will be
311
destroyed if there are no other references to it.</para>
314
</para><variablelist role="params">
315
<varlistentry><term><parameter>cr</parameter> :</term>
316
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
317
</simpara></listitem></varlistentry>
318
<varlistentry><term><parameter>font_face</parameter> :</term>
319
<listitem><simpara> a <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to restore to the default font
320
</simpara></listitem></varlistentry>
321
</variablelist></refsect2>
323
<title><anchor id="cairo-get-font-face" role="function"/>cairo_get_font_face ()</title>
324
<indexterm><primary>cairo_get_font_face</primary></indexterm><programlisting><link linkend="cairo-font-face-t">cairo_font_face_t</link>* cairo_get_font_face (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
326
Gets the current font face for a <link linkend="cairo-t"><type>cairo_t</type></link>.</para>
329
</para><variablelist role="params">
330
<varlistentry><term><parameter>cr</parameter> :</term>
331
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
332
</simpara></listitem></varlistentry>
333
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the current font face. This object is owned by
334
cairo. To keep a reference to it, you must call
335
cairo_font_face_reference.
337
This function never returns <link linkend="NULL:CAPS"><literal>NULL</literal></link>. If memory cannot be allocated, a
338
special "nil" <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link> object will be returned on which
339
<link linkend="cairo-font-face-status"><function>cairo_font_face_status()</function></link> returns <link linkend="CAIRO-STATUS-NO-MEMORY:CAPS"><literal>CAIRO_STATUS_NO_MEMORY</literal></link>. Using
340
this nil object will cause its error state to propagate to other
341
objects it is passed to, (for example, calling
342
<link linkend="cairo-set-font-face"><function>cairo_set_font_face()</function></link> with a nil font will trigger an error that
343
will shutdown the cairo_t object).
344
</simpara></listitem></varlistentry>
345
</variablelist></refsect2>
347
<title><anchor id="cairo-set-scaled-font" role="function" condition="since:1.2"/>cairo_set_scaled_font ()</title>
348
<indexterm role="1.2"><primary>cairo_set_scaled_font</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_scaled_font (<link linkend="cairo-t">cairo_t</link> *cr,
349
const <link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting>
351
Replaces the current font face, font matrix, and font options in
352
the <link linkend="cairo-t"><type>cairo_t</type></link> with those of the <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>. Except for
353
some translation, the current CTM of the <link linkend="cairo-t"><type>cairo_t</type></link> should be the
354
same as that of the <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>, which can be accessed
355
using <link linkend="cairo-scaled-font-get-ctm"><function>cairo_scaled_font_get_ctm()</function></link>.</para>
358
</para><variablelist role="params">
359
<varlistentry><term><parameter>cr</parameter> :</term>
360
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
361
</simpara></listitem></varlistentry>
362
<varlistentry><term><parameter>scaled_font</parameter> :</term>
363
<listitem><simpara> a <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>
364
</simpara></listitem></varlistentry>
365
</variablelist><para role="since">Since 1.2
368
<title><anchor id="cairo-get-scaled-font" role="function" condition="since:1.4"/>cairo_get_scaled_font ()</title>
369
<indexterm role="1.4"><primary>cairo_get_scaled_font</primary></indexterm><programlisting><link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link>* cairo_get_scaled_font (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
371
Gets the current scaled font for a <link linkend="cairo-t"><type>cairo_t</type></link>.</para>
374
</para><variablelist role="params">
375
<varlistentry><term><parameter>cr</parameter> :</term>
376
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
377
</simpara></listitem></varlistentry>
378
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the current scaled font. This object is owned by
379
cairo. To keep a reference to it, you must call
380
<link linkend="cairo-scaled-font-reference"><function>cairo_scaled_font_reference()</function></link>.
382
This function never returns <link linkend="NULL:CAPS"><literal>NULL</literal></link>. If memory cannot be allocated, a
383
special "nil" <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> object will be returned on which
384
<link linkend="cairo-scaled-font-status"><function>cairo_scaled_font_status()</function></link> returns <link linkend="CAIRO-STATUS-NO-MEMORY:CAPS"><literal>CAIRO_STATUS_NO_MEMORY</literal></link>. Using
385
this nil object will cause its error state to propagate to other
386
objects it is passed to, (for example, calling
387
<link linkend="cairo-set-scaled-font"><function>cairo_set_scaled_font()</function></link> with a nil font will trigger an error that
388
will shutdown the cairo_t object).
390
</simpara></listitem></varlistentry>
391
</variablelist><para role="since">Since 1.4
394
<title><anchor id="cairo-show-text" role="function"/>cairo_show_text ()</title>
395
<indexterm><primary>cairo_show_text</primary></indexterm><programlisting><link linkend="void">void</link> cairo_show_text (<link linkend="cairo-t">cairo_t</link> *cr,
396
const <link linkend="char">char</link> *utf8);</programlisting>
398
A drawing operator that generates the shape from a string of UTF-8
399
characters, rendered according to the current font_face, font_size
400
(font_matrix), and font_options.
403
This function first computes a set of glyphs for the string of
404
text. The first glyph is placed so that its origin is at the
405
current point. The origin of each subsequent glyph is offset from
406
that of the previous glyph by the advance values of the previous
410
After this call the current point is moved to the origin of where
411
the next glyph would be placed in this same progression. That is,
412
the current point will be at the origin of the final glyph offset
413
by its advance values. This allows for easy display of a single
414
logical string with multiple calls to <link linkend="cairo-show-text"><function>cairo_show_text()</function></link>.
417
NOTE: The <link linkend="cairo-show-text"><function>cairo_show_text()</function></link> function call is part of what the cairo
418
designers call the "toy" text API. It is convenient for short demos
419
and simple programs, but it is not expected to be adequate for
420
serious text-using applications. See <link linkend="cairo-show-glyphs"><function>cairo_show_glyphs()</function></link> for the
421
"real" text display API in cairo.</para>
424
</para><variablelist role="params">
425
<varlistentry><term><parameter>cr</parameter> :</term>
426
<listitem><simpara> a cairo context
427
</simpara></listitem></varlistentry>
428
<varlistentry><term><parameter>utf8</parameter> :</term>
429
<listitem><simpara> a string of text encoded in UTF-8
430
</simpara></listitem></varlistentry>
431
</variablelist></refsect2>
433
<title><anchor id="cairo-show-glyphs" role="function"/>cairo_show_glyphs ()</title>
434
<indexterm><primary>cairo_show_glyphs</primary></indexterm><programlisting><link linkend="void">void</link> cairo_show_glyphs (<link linkend="cairo-t">cairo_t</link> *cr,
435
const <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
436
<link linkend="int">int</link> num_glyphs);</programlisting>
438
A drawing operator that generates the shape from an array of glyphs,
439
rendered according to the current font_face, font_size
440
(font_matrix), and font_options.</para>
443
</para><variablelist role="params">
444
<varlistentry><term><parameter>cr</parameter> :</term>
445
<listitem><simpara> a cairo context
446
</simpara></listitem></varlistentry>
447
<varlistentry><term><parameter>glyphs</parameter> :</term>
448
<listitem><simpara> array of glyphs to show
449
</simpara></listitem></varlistentry>
450
<varlistentry><term><parameter>num_glyphs</parameter> :</term>
451
<listitem><simpara> number of glyphs to show
452
</simpara></listitem></varlistentry>
453
</variablelist></refsect2>
455
<title><anchor id="cairo-font-extents" role="function"/>cairo_font_extents ()</title>
456
<indexterm><primary>cairo_font_extents</primary></indexterm><programlisting><link linkend="void">void</link> cairo_font_extents (<link linkend="cairo-t">cairo_t</link> *cr,
457
<link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents);</programlisting>
459
Gets the font extents for the currently selected font.</para>
462
</para><variablelist role="params">
463
<varlistentry><term><parameter>cr</parameter> :</term>
464
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
465
</simpara></listitem></varlistentry>
466
<varlistentry><term><parameter>extents</parameter> :</term>
467
<listitem><simpara> a <link linkend="cairo-font-extents-t"><type>cairo_font_extents_t</type></link> object into which the results
469
</simpara></listitem></varlistentry>
470
</variablelist></refsect2>
472
<title><anchor id="cairo-text-extents" role="function"/>cairo_text_extents ()</title>
473
<indexterm><primary>cairo_text_extents</primary></indexterm><programlisting><link linkend="void">void</link> cairo_text_extents (<link linkend="cairo-t">cairo_t</link> *cr,
474
const <link linkend="char">char</link> *utf8,
475
<link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);</programlisting>
477
Gets the extents for a string of text. The extents describe a
478
user-space rectangle that encloses the "inked" portion of the text,
479
(as it would be drawn by <link linkend="cairo-show-text"><function>cairo_show_text()</function></link>). Additionally, the
480
x_advance and y_advance values indicate the amount by which the
481
current point would be advanced by <link linkend="cairo-show-text"><function>cairo_show_text()</function></link>.
484
Note that whitespace characters do not directly contribute to the
485
size of the rectangle (extents.width and extents.height). They do
486
contribute indirectly by changing the position of non-whitespace
487
characters. In particular, trailing whitespace characters are
488
likely to not affect the size of the rectangle, though they will
489
affect the x_advance and y_advance values.</para>
492
</para><variablelist role="params">
493
<varlistentry><term><parameter>cr</parameter> :</term>
494
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
495
</simpara></listitem></varlistentry>
496
<varlistentry><term><parameter>utf8</parameter> :</term>
497
<listitem><simpara> a string of text, encoded in UTF-8
498
</simpara></listitem></varlistentry>
499
<varlistentry><term><parameter>extents</parameter> :</term>
500
<listitem><simpara> a <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> object into which the results
502
</simpara></listitem></varlistentry>
503
</variablelist></refsect2>
505
<title><anchor id="cairo-glyph-extents" role="function"/>cairo_glyph_extents ()</title>
506
<indexterm><primary>cairo_glyph_extents</primary></indexterm><programlisting><link linkend="void">void</link> cairo_glyph_extents (<link linkend="cairo-t">cairo_t</link> *cr,
507
const <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
508
<link linkend="int">int</link> num_glyphs,
509
<link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);</programlisting>
511
Gets the extents for an array of glyphs. The extents describe a
512
user-space rectangle that encloses the "inked" portion of the
513
glyphs, (as they would be drawn by <link linkend="cairo-show-glyphs"><function>cairo_show_glyphs()</function></link>).
514
Additionally, the x_advance and y_advance values indicate the
515
amount by which the current point would be advanced by
519
Note that whitespace glyphs do not contribute to the size of the
520
rectangle (extents.width and extents.height).</para>
523
</para><variablelist role="params">
524
<varlistentry><term><parameter>cr</parameter> :</term>
525
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
526
</simpara></listitem></varlistentry>
527
<varlistentry><term><parameter>glyphs</parameter> :</term>
528
<listitem><simpara> an array of <link linkend="cairo-glyph-t"><type>cairo_glyph_t</type></link> objects
529
</simpara></listitem></varlistentry>
530
<varlistentry><term><parameter>num_glyphs</parameter> :</term>
531
<listitem><simpara> the number of elements in <parameter>glyphs</parameter>
532
</simpara></listitem></varlistentry>
533
<varlistentry><term><parameter>extents</parameter> :</term>
534
<listitem><simpara> a <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> object into which the results
536
</simpara></listitem></varlistentry>
537
</variablelist></refsect2>
545
<refsect1><refsect2 /><refsect2 /></refsect1>