~ubuntu-branches/ubuntu/hardy/cairo/hardy-updates

« back to all changes in this revision

Viewing changes to doc/public/xml/cairo-text.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-01-17 13:00:59 UTC
  • Revision ID: james.westby@ubuntu.com-20080117130059-3gbudaudr2w8bl4w
Tags: upstream-1.5.6
ImportĀ upstreamĀ versionĀ 1.5.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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">
 
5
]>
 
6
<refentry id="cairo-Text">
 
7
<refmeta>
 
8
<refentrytitle role="top_of_page">Text</refentrytitle>
 
9
<manvolnum>3</manvolnum>
 
10
<refmiscinfo>CAIRO Library</refmiscinfo>
 
11
</refmeta>
 
12
 
 
13
<refnamediv>
 
14
<refname>Text</refname>
 
15
<refpurpose>Rendering text and sets of glyphs</refpurpose>
 
16
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
 
17
</refnamediv>
 
18
 
 
19
<refsynopsisdiv role="synopsis">
 
20
<title role="synopsis.title">Synopsis</title>
 
21
 
 
22
<synopsis>
 
23
 
 
24
 
 
25
 
 
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);
 
63
</synopsis>
 
64
</refsynopsisdiv>
 
65
 
 
66
 
 
67
 
 
68
 
 
69
 
 
70
 
 
71
 
 
72
 
 
73
 
 
74
<refsect1 role="desc">
 
75
<title role="desc.title">Description</title>
 
76
<para>
 
77
 
 
78
</para>
 
79
</refsect1>
 
80
 
 
81
<refsect1 role="details">
 
82
<title role="details.title">Details</title>
 
83
<refsect2>
 
84
<title><anchor id="cairo-glyph-t" role="struct"/>cairo_glyph_t</title>
 
85
<indexterm><primary>cairo_glyph_t</primary></indexterm><programlisting>typedef struct {
 
86
  unsigned long        index;
 
87
  double               x;
 
88
  double               y;
 
89
} cairo_glyph_t;
 
90
</programlisting>
 
91
<para>
 
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.
 
102
</para>
 
103
<para>
 
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>
 
107
<para>
 
108
 
 
109
</para><variablelist role="struct">
 
110
<varlistentry>
 
111
<term><link linkend="double">double</link>&nbsp;<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>
 
115
</varlistentry>
 
116
<varlistentry>
 
117
<term><link linkend="double">double</link>&nbsp;<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>
 
121
</varlistentry>
 
122
</variablelist></refsect2>
 
123
<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;
 
130
</programlisting>
 
131
<para>
 
132
Specifies variants of a font face based on their slant.</para>
 
133
<para>
 
134
 
 
135
</para><variablelist role="enum">
 
136
<varlistentry>
 
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>
 
140
</varlistentry>
 
141
<varlistentry>
 
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>
 
145
</varlistentry>
 
146
<varlistentry>
 
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>
 
150
</varlistentry>
 
151
</variablelist></refsect2>
 
152
<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;
 
158
</programlisting>
 
159
<para>
 
160
Specifies variants of a font face based on their weight.</para>
 
161
<para>
 
162
 
 
163
</para><variablelist role="enum">
 
164
<varlistentry>
 
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>
 
168
</varlistentry>
 
169
<varlistentry>
 
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>
 
173
</varlistentry>
 
174
</variablelist></refsect2>
 
175
<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>
 
181
<para>
 
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
 
188
cairo.</para>
 
189
<para>
 
190
 
 
191
</para><variablelist role="params">
 
192
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
193
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
194
</simpara></listitem></varlistentry>
 
195
<varlistentry><term><parameter>family</parameter>&nbsp;:</term>
 
196
<listitem><simpara> a font family name, encoded in UTF-8
 
197
</simpara></listitem></varlistentry>
 
198
<varlistentry><term><parameter>slant</parameter>&nbsp;:</term>
 
199
<listitem><simpara> the slant for the font
 
200
</simpara></listitem></varlistentry>
 
201
<varlistentry><term><parameter>weight</parameter>&nbsp;:</term>
 
202
<listitem><simpara> the weight for the font
 
203
</simpara></listitem></varlistentry>
 
204
</variablelist></refsect2>
 
205
<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>
 
209
<para>
 
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>
 
215
<para>
 
216
 
 
217
</para><variablelist role="params">
 
218
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
219
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
220
</simpara></listitem></varlistentry>
 
221
<varlistentry><term><parameter>size</parameter>&nbsp;:</term>
 
222
<listitem><simpara> the new font size, in user space units
 
223
</simpara></listitem></varlistentry>
 
224
</variablelist></refsect2>
 
225
<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>
 
229
<para>
 
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>
 
236
<para>
 
237
 
 
238
</para><variablelist role="params">
 
239
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
240
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
241
</simpara></listitem></varlistentry>
 
242
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
 
243
<listitem><simpara> a <link linkend="cairo-matrix-t"><type>cairo_matrix_t</type></link> describing a transform to be applied to
 
244
the current font.
 
245
</simpara></listitem></varlistentry>
 
246
</variablelist></refsect2>
 
247
<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>
 
251
<para>
 
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>
 
254
<para>
 
255
 
 
256
</para><variablelist role="params">
 
257
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
258
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
259
</simpara></listitem></varlistentry>
 
260
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
 
261
<listitem><simpara> return value for the matrix
 
262
</simpara></listitem></varlistentry>
 
263
</variablelist></refsect2>
 
264
<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>
 
268
<para>
 
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>
 
274
<para>
 
275
 
 
276
</para><variablelist role="params">
 
277
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
278
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
279
</simpara></listitem></varlistentry>
 
280
<varlistentry><term><parameter>options</parameter>&nbsp;:</term>
 
281
<listitem><simpara> font options to use
 
282
</simpara></listitem></varlistentry>
 
283
</variablelist></refsect2>
 
284
<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>
 
288
<para>
 
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>
 
293
<para>
 
294
 
 
295
</para><variablelist role="params">
 
296
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
297
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
298
</simpara></listitem></varlistentry>
 
299
<varlistentry><term><parameter>options</parameter>&nbsp;:</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>
 
304
<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>
 
308
<para>
 
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>
 
312
<para>
 
313
 
 
314
</para><variablelist role="params">
 
315
<varlistentry><term><parameter>cr</parameter>&nbsp;:</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>&nbsp;:</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>
 
322
<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>
 
325
<para>
 
326
Gets the current font face for a <link linkend="cairo-t"><type>cairo_t</type></link>.</para>
 
327
<para>
 
328
 
 
329
</para><variablelist role="params">
 
330
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
331
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
332
</simpara></listitem></varlistentry>
 
333
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</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.
 
336
 
 
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>
 
346
<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>
 
350
<para>
 
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>
 
356
<para>
 
357
 
 
358
</para><variablelist role="params">
 
359
<varlistentry><term><parameter>cr</parameter>&nbsp;:</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>&nbsp;:</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
 
366
</para></refsect2>
 
367
<refsect2>
 
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>
 
370
<para>
 
371
Gets the current scaled font for a <link linkend="cairo-t"><type>cairo_t</type></link>.</para>
 
372
<para>
 
373
 
 
374
</para><variablelist role="params">
 
375
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
376
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
377
</simpara></listitem></varlistentry>
 
378
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</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>.
 
381
 
 
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).
 
389
 
 
390
</simpara></listitem></varlistentry>
 
391
</variablelist><para role="since">Since  1.4
 
392
</para></refsect2>
 
393
<refsect2>
 
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>
 
397
<para>
 
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.
 
401
</para>
 
402
<para>
 
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
 
407
glyph.
 
408
</para>
 
409
<para>
 
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>.
 
415
</para>
 
416
<para>
 
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>
 
422
<para>
 
423
 
 
424
</para><variablelist role="params">
 
425
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
426
<listitem><simpara> a cairo context
 
427
</simpara></listitem></varlistentry>
 
428
<varlistentry><term><parameter>utf8</parameter>&nbsp;:</term>
 
429
<listitem><simpara> a string of text encoded in UTF-8
 
430
</simpara></listitem></varlistentry>
 
431
</variablelist></refsect2>
 
432
<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>
 
437
<para>
 
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>
 
441
<para>
 
442
 
 
443
</para><variablelist role="params">
 
444
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
445
<listitem><simpara> a cairo context
 
446
</simpara></listitem></varlistentry>
 
447
<varlistentry><term><parameter>glyphs</parameter>&nbsp;:</term>
 
448
<listitem><simpara> array of glyphs to show
 
449
</simpara></listitem></varlistentry>
 
450
<varlistentry><term><parameter>num_glyphs</parameter>&nbsp;:</term>
 
451
<listitem><simpara> number of glyphs to show
 
452
</simpara></listitem></varlistentry>
 
453
</variablelist></refsect2>
 
454
<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>
 
458
<para>
 
459
Gets the font extents for the currently selected font.</para>
 
460
<para>
 
461
 
 
462
</para><variablelist role="params">
 
463
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
464
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
465
</simpara></listitem></varlistentry>
 
466
<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
 
467
<listitem><simpara> a <link linkend="cairo-font-extents-t"><type>cairo_font_extents_t</type></link> object into which the results
 
468
will be stored.
 
469
</simpara></listitem></varlistentry>
 
470
</variablelist></refsect2>
 
471
<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>
 
476
<para>
 
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>.
 
482
</para>
 
483
<para>
 
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>
 
490
<para>
 
491
 
 
492
</para><variablelist role="params">
 
493
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
494
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
495
</simpara></listitem></varlistentry>
 
496
<varlistentry><term><parameter>utf8</parameter>&nbsp;:</term>
 
497
<listitem><simpara> a string of text, encoded in UTF-8
 
498
</simpara></listitem></varlistentry>
 
499
<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
 
500
<listitem><simpara> a <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> object into which the results
 
501
will be stored
 
502
</simpara></listitem></varlistentry>
 
503
</variablelist></refsect2>
 
504
<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>
 
510
<para>
 
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
 
516
cairo_show_glyphs.
 
517
</para>
 
518
<para>
 
519
Note that whitespace glyphs do not contribute to the size of the
 
520
rectangle (extents.width and extents.height).</para>
 
521
<para>
 
522
 
 
523
</para><variablelist role="params">
 
524
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
 
525
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
 
526
</simpara></listitem></varlistentry>
 
527
<varlistentry><term><parameter>glyphs</parameter>&nbsp;:</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>&nbsp;:</term>
 
531
<listitem><simpara> the number of elements in <parameter>glyphs</parameter>
 
532
</simpara></listitem></varlistentry>
 
533
<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
 
534
<listitem><simpara> a <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> object into which the results
 
535
will be stored
 
536
</simpara></listitem></varlistentry>
 
537
</variablelist></refsect2>
 
538
 
 
539
</refsect1>
 
540
 
 
541
 
 
542
 
 
543
 
 
544
 
 
545
<refsect1><refsect2 /><refsect2 /></refsect1>
 
546
</refentry>