1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Text</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link rel="start" href="index.html" title="Cairo: A Vector Graphics Library">
<link rel="up" href="Drawing.html" title="Drawing">
<link rel="prev" href="cairo-Transformations.html" title="Transformations">
<link rel="next" href="Fonts.html" title="Fonts">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="part" href="pt01.html" title="Part I. Tutorial">
<link rel="part" href="pt02.html" title="Part II. Reference">
<link rel="chapter" href="Drawing.html" title="Drawing">
<link rel="chapter" href="Fonts.html" title="Fonts">
<link rel="chapter" href="Surfaces.html" title="Surfaces">
<link rel="chapter" href="Support.html" title="Utilities">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of new symbols in 1.2">
<link rel="appendix" href="language-bindings.html" title="Appendix A. Creating a language binding for cairo">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="cairo-Transformations.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="Drawing.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
<td><a accesskey="n" href="Fonts.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2565687" class="shortcut">Top</a>
 | 
<a href="#id2544267" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="cairo-Text"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2565687"></a><span class="refentrytitle">Text</span>
</h2>
<p>Text — Rendering text and sets of glyphs</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
<a href="cairo-Text.html#cairo-glyph-t">cairo_glyph_t</a>;
enum <a href="cairo-Text.html#cairo-font-slant-t">cairo_font_slant_t</a>;
enum <a href="cairo-Text.html#cairo-font-weight-t">cairo_font_weight_t</a>;
void <a href="cairo-Text.html#cairo-select-font-face">cairo_select_font_face</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const char *family,
<a href="cairo-Text.html#cairo-font-slant-t">cairo_font_slant_t</a> slant,
<a href="cairo-Text.html#cairo-font-weight-t">cairo_font_weight_t</a> weight);
void <a href="cairo-Text.html#cairo-set-font-size">cairo_set_font_size</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double size);
void <a href="cairo-Text.html#cairo-set-font-matrix">cairo_set_font_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
void <a href="cairo-Text.html#cairo-get-font-matrix">cairo_get_font_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
void <a href="cairo-Text.html#cairo-set-font-options">cairo_set_font_options</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const <a href="cairo-Font-Options.html#cairo-font-options-t">cairo_font_options_t</a> *options);
void <a href="cairo-Text.html#cairo-get-font-options">cairo_get_font_options</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-Font-Options.html#cairo-font-options-t">cairo_font_options_t</a> *options);
void <a href="cairo-Text.html#cairo-show-text">cairo_show_text</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const char *utf8);
void <a href="cairo-Text.html#cairo-show-glyphs">cairo_show_glyphs</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-Text.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
int num_glyphs);
<a href="cairo-cairo-font-face-t.html#cairo-font-face-t">cairo_font_face_t</a>* <a href="cairo-Text.html#cairo-get-font-face">cairo_get_font_face</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
void <a href="cairo-Text.html#cairo-font-extents">cairo_font_extents</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-Scaled-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);
void <a href="cairo-Text.html#cairo-set-font-face">cairo_set_font_face</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-font-face-t.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);
void <a href="cairo-Text.html#cairo-set-scaled-font">cairo_set_scaled_font</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const <a href="cairo-Scaled-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);
void <a href="cairo-Text.html#cairo-text-extents">cairo_text_extents</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const char *utf8,
<a href="cairo-Scaled-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);
void <a href="cairo-Text.html#cairo-glyph-extents">cairo_glyph_extents</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-Text.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
int num_glyphs,
<a href="cairo-Scaled-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2544267"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2544283"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2544294"></a><h3>
<a name="cairo-glyph-t"></a>cairo_glyph_t</h3>
<a class="indexterm" name="id2544306"></a><pre class="programlisting">typedef struct {
unsigned long index;
double x;
double y;
} cairo_glyph_t;
</pre>
<p>
The <a href="cairo-Text.html#cairo-glyph-t"><span class="type">cairo_glyph_t</span></a> structure holds information about a single glyph
when drawing or measuring text. A font is (in simple terms) a
collection of shapes used to draw text. A glyph is one of these
shapes. There can be multiple glyphs for a single character
(alternates to be used in different contexts, for example), or a
glyph can be a <em class="firstterm">ligature</em> of multiple
characters. Cairo doesn't expose any way of converting input text
into glyphs, so in order to use the Cairo interfaces that take
arrays of glyphs, you must directly access the appropriate
underlying font system.
</p>
<p>
Note that the offsets given by <em class="parameter"><code>x</code></em> and <em class="parameter"><code>y</code></em> are not cumulative. When
drawing or measuring text, each glyph is individually positioned
with respect to the overall origin</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term">double <em class="structfield"><code>x</code></em>;</span></td>
<td> the offset in the X direction between the origin used for
drawing or measuring the string and the origin of this glyph.
</td>
</tr>
<tr>
<td>
<span class="term">double <em class="structfield"><code>y</code></em>;</span></td>
<td> the offset in the Y direction between the origin used for
drawing or measuring the string and the origin of this glyph.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2544415"></a><h3>
<a name="cairo-font-slant-t"></a>enum cairo_font_slant_t</h3>
<a class="indexterm" name="id2544427"></a><pre class="programlisting">typedef enum _cairo_font_slant {
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_SLANT_ITALIC,
CAIRO_FONT_SLANT_OBLIQUE
} cairo_font_slant_t;
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2544445"></a><h3>
<a name="cairo-font-weight-t"></a>enum cairo_font_weight_t</h3>
<a class="indexterm" name="id2527141"></a><pre class="programlisting">typedef enum _cairo_font_weight {
CAIRO_FONT_WEIGHT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD
} cairo_font_weight_t;
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2527158"></a><h3>
<a name="cairo-select-font-face"></a>cairo_select_font_face ()</h3>
<a class="indexterm" name="id2527169"></a><pre class="programlisting">void cairo_select_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const char *family,
<a href="cairo-Text.html#cairo-font-slant-t">cairo_font_slant_t</a> slant,
<a href="cairo-Text.html#cairo-font-weight-t">cairo_font_weight_t</a> weight);</pre>
<p>
Selects a family and style of font from a simplified description as
a family name, slant and weight. This function is meant to be used
only for applications with simple font needs: Cairo doesn't provide
for operations such as listing all available fonts on the system,
and it is expected that most applications will need to use a more
comprehensive font handling and text layout library in addition to
cairo.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>family</code></em> :</span></td>
<td> a font family name, encoded in UTF-8
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>slant</code></em> :</span></td>
<td> the slant for the font
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>weight</code></em> :</span></td>
<td> the weight for the font
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2527294"></a><h3>
<a name="cairo-set-font-size"></a>cairo_set_font_size ()</h3>
<a class="indexterm" name="id2527307"></a><pre class="programlisting">void cairo_set_font_size (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double size);</pre>
<p>
Sets the current font matrix to a scale by a factor of <em class="parameter"><code>size</code></em>, replacing
any font matrix previously set with <a href="cairo-Text.html#cairo-set-font-size"><code class="function">cairo_set_font_size()</code></a> or
<a href="cairo-Text.html#cairo-set-font-matrix"><code class="function">cairo_set_font_matrix()</code></a>. This results in a font size of <em class="parameter"><code>size</code></em> user space
units. (More precisely, this matrix will result in the font's
em-square being a <em class="parameter"><code>size</code></em> by <em class="parameter"><code>size</code></em> square in user space.)</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>size</code></em> :</span></td>
<td> the new font size, in user space units
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2589226"></a><h3>
<a name="cairo-set-font-matrix"></a>cairo_set_font_matrix ()</h3>
<a class="indexterm" name="id2589236"></a><pre class="programlisting">void cairo_set_font_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
<p>
Sets the current font matrix to <em class="parameter"><code>matrix</code></em>. The font matrix gives a
transformation from the design space of the font (in this space,
the em-square is 1 unit by 1 unit) to user space. Normally, a
simple scale is used (see <a href="cairo-Text.html#cairo-set-font-size"><code class="function">cairo_set_font_size()</code></a>), but a more
complex font matrix can be used to shear the font
or stretch it unequally along the two axes</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>matrix</code></em> :</span></td>
<td> a <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a> describing a transform to be applied to
the current font.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2589330"></a><h3>
<a name="cairo-get-font-matrix"></a>cairo_get_font_matrix ()</h3>
<a class="indexterm" name="id2589340"></a><pre class="programlisting">void cairo_get_font_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
<p>
Stores the current font matrix into <em class="parameter"><code>matrix</code></em>. See
<a href="cairo-Text.html#cairo-set-font-matrix"><code class="function">cairo_set_font_matrix()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>matrix</code></em> :</span></td>
<td> return value for the matrix
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2589428"></a><h3>
<a name="cairo-set-font-options"></a>cairo_set_font_options ()</h3>
<a class="indexterm" name="id2589440"></a><pre class="programlisting">void cairo_set_font_options (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const <a href="cairo-Font-Options.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre>
<p>
Sets a set of custom font rendering options for the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>.
Rendering options are derived by merging these options with the
options derived from underlying surface; if the value in <em class="parameter"><code>options</code></em>
has a default value (like <a href="cairo-cairo-t.html#CAIRO-ANTIALIAS-DEFAULT:CAPS"><code class="literal">CAIRO_ANTIALIAS_DEFAULT</code></a>), then the value
from the surface is used.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>options</code></em> :</span></td>
<td> font options to use
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2589541"></a><h3>
<a name="cairo-get-font-options"></a>cairo_get_font_options ()</h3>
<a class="indexterm" name="id2589552"></a><pre class="programlisting">void cairo_get_font_options (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-Font-Options.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre>
<p>
Retrieves font rendering options set via <a href="cairo-Text.html#cairo-set-font-options"><span class="type">cairo_set_font_options</span></a>.
Note that the returned options do not include any options derived
from the underlying surface; they are literally the options
passed to <a href="cairo-Text.html#cairo-set-font-options"><code class="function">cairo_set_font_options()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>options</code></em> :</span></td>
<td> a <a href="cairo-Font-Options.html#cairo-font-options-t"><span class="type">cairo_font_options_t</span></a> object into which to store
the retrieved options. All existing values are overwritten
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2589628"></a><h3>
<a name="cairo-show-text"></a>cairo_show_text ()</h3>
<a class="indexterm" name="id2589639"></a><pre class="programlisting">void cairo_show_text (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const char *utf8);</pre>
<p>
A drawing operator that generates the shape from a string of UTF-8
characters, rendered according to the current font_face, font_size
(font_matrix), and font_options.
</p>
<p>
This function first computes a set of glyphs for the string of
text. The first glyph is placed so that its origin is at the
current point. The origin of each subsequent glyph is offset from
that of the previous glyph by the advance values of the previous
glyph.
</p>
<p>
After this call the current point is moved to the origin of where
the next glyph would be placed in this same progression. That is,
the current point will be at the origin of the final glyph offset
by its advance values. This allows for easy display of a single
logical string with multiple calls to <a href="cairo-Text.html#cairo-show-text"><code class="function">cairo_show_text()</code></a>.
</p>
<p>
NOTE: The <a href="cairo-Text.html#cairo-show-text"><code class="function">cairo_show_text()</code></a> function call is part of what the cairo
designers call the "toy" text API. It is convenient for short demos
and simple programs, but it is not expected to be adequate for the
most serious of text-using applications. See <a href="cairo-Text.html#cairo-show-glyphs"><code class="function">cairo_show_glyphs()</code></a>
for the "real" text display API in cairo.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a cairo context
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>utf8</code></em> :</span></td>
<td> a string of text encoded in UTF-8
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2589754"></a><h3>
<a name="cairo-show-glyphs"></a>cairo_show_glyphs ()</h3>
<a class="indexterm" name="id2589764"></a><pre class="programlisting">void cairo_show_glyphs (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-Text.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
int num_glyphs);</pre>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>glyphs</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>num_glyphs</code></em> :</span></td>
<td>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2589843"></a><h3>
<a name="cairo-get-font-face"></a>cairo_get_font_face ()</h3>
<a class="indexterm" name="id2589853"></a><pre class="programlisting"><a href="cairo-cairo-font-face-t.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_get_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
<p>
Gets the current font face for a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the current font object. Can return <code class="literal">NULL</code>
on out-of-memory or if the context is already in
an error state. This object is owned by cairo. To keep
a reference to it, you must call <a href="cairo-cairo-font-face-t.html#cairo-font-face-reference"><code class="function">cairo_font_face_reference()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2589939"></a><h3>
<a name="cairo-font-extents"></a>cairo_font_extents ()</h3>
<a class="indexterm" name="id2589950"></a><pre class="programlisting">void cairo_font_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-Scaled-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);</pre>
<p>
Gets the font extents for the currently selected font.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>extents</code></em> :</span></td>
<td> a <a href="cairo-Scaled-Fonts.html#cairo-font-extents-t"><span class="type">cairo_font_extents_t</span></a> object into which the results
will be stored.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2590027"></a><h3>
<a name="cairo-set-font-face"></a>cairo_set_font_face ()</h3>
<a class="indexterm" name="id2590037"></a><pre class="programlisting">void cairo_set_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-font-face-t.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);</pre>
<p>
Replaces the current <a href="cairo-cairo-font-face-t.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a> object in the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with
<em class="parameter"><code>font_face</code></em>. The replaced font face in the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> will be
destroyed if there are no other references to it.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>font_face</code></em> :</span></td>
<td> a <a href="cairo-cairo-font-face-t.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>, or <code class="literal">NULL</code> to restore to the default font
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2590147"></a><h3>
<a name="cairo-set-scaled-font"></a>cairo_set_scaled_font ()</h3>
<a class="indexterm" name="id2590159"></a><pre class="programlisting">void cairo_set_scaled_font (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const <a href="cairo-Scaled-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre>
<p>
Replaces the current font face, font matrix, and font options in
the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with those of the <a href="cairo-Scaled-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>. Except for
some translation, the current CTM of the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> should be the
same as that of the <a href="cairo-Scaled-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>, which can be accessed
using <a href="cairo-Scaled-Fonts.html#cairo-scaled-font-get-ctm"><code class="function">cairo_scaled_font_get_ctm()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>scaled_font</code></em> :</span></td>
<td> a <a href="cairo-Scaled-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2590276"></a><h3>
<a name="cairo-text-extents"></a>cairo_text_extents ()</h3>
<a class="indexterm" name="id2590286"></a><pre class="programlisting">void cairo_text_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const char *utf8,
<a href="cairo-Scaled-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre>
<p>
Gets the extents for a string of text. The extents describe a
user-space rectangle that encloses the "inked" portion of the text,
(as it would be drawn by <a href="cairo-Text.html#cairo-show-text"><code class="function">cairo_show_text()</code></a>). Additionally, the
x_advance and y_advance values indicate the amount by which the
current point would be advanced by <a href="cairo-Text.html#cairo-show-text"><code class="function">cairo_show_text()</code></a>.
</p>
<p>
Note that whitespace characters do not directly contribute to the
size of the rectangle (extents.width and extents.height). They do
contribute indirectly by changing the position of non-whitespace
characters. In particular, trailing whitespace characters are
likely to not affect the size of the rectangle, though they will
affect the x_advance and y_advance values.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>utf8</code></em> :</span></td>
<td> a string of text, encoded in UTF-8
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>extents</code></em> :</span></td>
<td> a <a href="cairo-Scaled-Fonts.html#cairo-text-extents-t"><span class="type">cairo_text_extents_t</span></a> object into which the results
will be stored
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2590413"></a><h3>
<a name="cairo-glyph-extents"></a>cairo_glyph_extents ()</h3>
<a class="indexterm" name="id2590423"></a><pre class="programlisting">void cairo_glyph_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-Text.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
int num_glyphs,
<a href="cairo-Scaled-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre>
<p>
Gets the extents for an array of glyphs. The extents describe a
user-space rectangle that encloses the "inked" portion of the
glyphs, (as they would be drawn by <a href="cairo-Text.html#cairo-show-glyphs"><code class="function">cairo_show_glyphs()</code></a>).
Additionally, the x_advance and y_advance values indicate the
amount by which the current point would be advanced by
cairo_show_glyphs.
</p>
<p>
Note that whitespace glyphs do not contribute to the size of the
rectangle (extents.width and extents.height).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>glyphs</code></em> :</span></td>
<td> an array of <a href="cairo-Text.html#cairo-glyph-t"><span class="type">cairo_glyph_t</span></a> objects
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>num_glyphs</code></em> :</span></td>
<td> the number of elements in <em class="parameter"><code>glyphs</code></em>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>extents</code></em> :</span></td>
<td> a <a href="cairo-Scaled-Fonts.html#cairo-text-extents-t"><span class="type">cairo_text_extents_t</span></a> object into which the results
will be stored
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>
|