<?xml version='1.0' encoding='UTF-8'?> 
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cairo-Text">
<refmeta>
<refentrytitle role="top_of_page">Text</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAIRO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Text</refname>
<refpurpose>Rendering text and glyphs</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>



                    <link linkend="cairo-glyph-t">cairo_glyph_t</link>;
enum                <link linkend="cairo-font-slant-t">cairo_font_slant_t</link>;
enum                <link linkend="cairo-font-weight-t">cairo_font_weight_t</link>;
<link linkend="void">void</link>                <link linkend="cairo-select-font-face">cairo_select_font_face</link>              (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="char">char</link> *family,
                                                         <link linkend="cairo-font-slant-t">cairo_font_slant_t</link> slant,
                                                         <link linkend="cairo-font-weight-t">cairo_font_weight_t</link> weight);
<link linkend="void">void</link>                <link linkend="cairo-set-font-size">cairo_set_font_size</link>                 (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         <link linkend="double">double</link> size);
<link linkend="void">void</link>                <link linkend="cairo-set-font-matrix">cairo_set_font_matrix</link>               (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
<link linkend="void">void</link>                <link linkend="cairo-get-font-matrix">cairo_get_font_matrix</link>               (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
<link linkend="void">void</link>                <link linkend="cairo-set-font-options">cairo_set_font_options</link>              (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options);
<link linkend="void">void</link>                <link linkend="cairo-get-font-options">cairo_get_font_options</link>              (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options);
<link linkend="void">void</link>                <link linkend="cairo-set-font-face">cairo_set_font_face</link>                 (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         <link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);
<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);
<link linkend="void">void</link>                <link linkend="cairo-set-scaled-font">cairo_set_scaled_font</link>               (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);
<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);
<link linkend="void">void</link>                <link linkend="cairo-show-text">cairo_show_text</link>                     (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="char">char</link> *utf8);
<link linkend="void">void</link>                <link linkend="cairo-show-glyphs">cairo_show_glyphs</link>                   (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
                                                         <link linkend="int">int</link> num_glyphs);
<link linkend="void">void</link>                <link linkend="cairo-font-extents">cairo_font_extents</link>                  (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         <link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents);
<link linkend="void">void</link>                <link linkend="cairo-text-extents">cairo_text_extents</link>                  (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="char">char</link> *utf8,
                                                         <link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);
<link linkend="void">void</link>                <link linkend="cairo-glyph-extents">cairo_glyph_extents</link>                 (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
                                                         <link linkend="int">int</link> num_glyphs,
                                                         <link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);
</synopsis>
</refsynopsisdiv>









<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>
Cairo has two sets of text rendering capabilities:
<itemizedlist>
  <listitem>
    The functions with <emphasis>text</emphasis> in their name form cairo's
    <firstterm>toy</firstterm> text API.  The toy API takes UTF-8 encoded
    text and is limited in its functionality to rendering simple
    left-to-right text with no advanced features.  That means for example
    that most complex scripts like Hebrew, Arabic, and Indic scripts are
    out of question.  No kerning or correct positioning of diacritical marks
    either.  The font selection is pretty limited too and doesn't handle the
    case that the selected font does not cover the characters in the text.
    This set of functions are really that, a toy text API, for testing and
    demonstration purposes.  Any serious application should avoid them.
  </listitem>
  <listitem>
    The functions with <emphasis>glyphs</emphasis> in their name form cairo's
    <firstterm>low-level</firstterm> text API.  The low-level API relies on
    the user to convert text to a set of glyph indexes and positions.  This
    is a very hard problem and is best handled by external libraries, like
    the pangocairo that is part of the Pango text layout and rendering library.
    Pango is available from <ulink
    url="http://www.pango.org/">http://www.pango.org/</ulink>.
  </listitem>
</itemizedlist>
</para>
</refsect1>

<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="cairo-glyph-t" role="struct"/>cairo_glyph_t</title>
<indexterm><primary>cairo_glyph_t</primary></indexterm><programlisting>typedef struct {
  unsigned long        index;
  double               x;
  double               y;
} cairo_glyph_t;
</programlisting>
<para>
The <link linkend="cairo-glyph-t"><type>cairo_glyph_t</type></link> 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 <firstterm>ligature</firstterm> 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.
</para>
<para>
Note that the offsets given by <parameter>x</parameter> and <parameter>y</parameter> are not cumulative. When
drawing or measuring text, each glyph is individually positioned
with respect to the overall origin</para>
<para>

</para><variablelist role="struct">
<varlistentry>
<term><link linkend="double">double</link>&nbsp;<structfield>x</structfield>;</term>
<listitem><simpara> the offset in the X direction between the origin used for
    drawing or measuring the string and the origin of this glyph.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="double">double</link>&nbsp;<structfield>y</structfield>;</term>
<listitem><simpara> the offset in the Y direction between the origin used for
    drawing or measuring the string and the origin of this glyph.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-font-slant-t" role="enum"/>enum cairo_font_slant_t</title>
<indexterm><primary>cairo_font_slant_t</primary></indexterm><programlisting>typedef enum _cairo_font_slant {
  CAIRO_FONT_SLANT_NORMAL,
  CAIRO_FONT_SLANT_ITALIC,
  CAIRO_FONT_SLANT_OBLIQUE
} cairo_font_slant_t;
</programlisting>
<para>
Specifies variants of a font face based on their slant.</para>
<para>

</para><variablelist role="enum">
<varlistentry>
<term><anchor id="CAIRO-FONT-SLANT-NORMAL:CAPS" role="constant"/><literal>CAIRO_FONT_SLANT_NORMAL</literal></term>
<listitem><simpara> Upright font style
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-FONT-SLANT-ITALIC:CAPS" role="constant"/><literal>CAIRO_FONT_SLANT_ITALIC</literal></term>
<listitem><simpara> Italic font style
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-FONT-SLANT-OBLIQUE:CAPS" role="constant"/><literal>CAIRO_FONT_SLANT_OBLIQUE</literal></term>
<listitem><simpara> Oblique font style
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-font-weight-t" role="enum"/>enum cairo_font_weight_t</title>
<indexterm><primary>cairo_font_weight_t</primary></indexterm><programlisting>typedef enum _cairo_font_weight {
  CAIRO_FONT_WEIGHT_NORMAL,
  CAIRO_FONT_WEIGHT_BOLD
} cairo_font_weight_t;
</programlisting>
<para>
Specifies variants of a font face based on their weight.</para>
<para>

</para><variablelist role="enum">
<varlistentry>
<term><anchor id="CAIRO-FONT-WEIGHT-NORMAL:CAPS" role="constant"/><literal>CAIRO_FONT_WEIGHT_NORMAL</literal></term>
<listitem><simpara> Normal font weight
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-FONT-WEIGHT-BOLD:CAPS" role="constant"/><literal>CAIRO_FONT_WEIGHT_BOLD</literal></term>
<listitem><simpara> Bold font weight
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-select-font-face" role="function"/>cairo_select_font_face ()</title>
<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,
                                                         const <link linkend="char">char</link> *family,
                                                         <link linkend="cairo-font-slant-t">cairo_font_slant_t</link> slant,
                                                         <link linkend="cairo-font-weight-t">cairo_font_weight_t</link> weight);</programlisting>
<para>
Note: The <link linkend="cairo-select-font-face"><function>cairo_select_font_face()</function></link> 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 serious text-using applications.
</para>
<para>
Selects a family and style of font from a simplified description as
a family name, slant and weight. Cairo provides no operation to
list available family names on the system (this is a "toy",
remember"), but the standard CSS2 generic family names, ("serif",
"sans-serif", "cursive", "fantasy", "monospace"), are likely to
work as expected.
</para>
<para>
For "real" font selection, see the font-backend-specific
font_face_create functions for the font backend you are using. (For
example, if you are using the freetype-based cairo-ft font backend,
see <link linkend="cairo-ft-font-face-create-for-ft-face"><function>cairo_ft_font_face_create_for_ft_face()</function></link> or
<link linkend="cairo-ft-font-face-create-for-pattern"><function>cairo_ft_font_face_create_for_pattern()</function></link>.) The resulting font face
could then be used with <link linkend="cairo-scaled-font-create"><function>cairo_scaled_font_create()</function></link> and
<link linkend="cairo-set-scaled-font"><function>cairo_set_scaled_font()</function></link>.
</para>
<para>
Similarly, when using the "real" font support, you can call
directly into the underlying font system, (such as fontconfig or
freetype), for operations such as listing available fonts, etc.
</para>
<para>
It is expected that most applications will need to use a more
comprehensive font handling and text layout library, (for example,
pango), in conjunction with cairo.
</para>
<para>
If text is drawn without a call to <link linkend="cairo-select-font-face"><function>cairo_select_font_face()</function></link>, (nor
<link linkend="cairo-set-font-face"><function>cairo_set_font_face()</function></link> nor <link linkend="cairo-set-scaled-font"><function>cairo_set_scaled_font()</function></link>), the default
family is "sans", slant is <link linkend="CAIRO-FONT-SLANT-NORMAL:CAPS"><literal>CAIRO_FONT_SLANT_NORMAL</literal></link>, and weight is
<link linkend="CAIRO-FONT-WEIGHT-NORMAL:CAPS"><literal>CAIRO_FONT_WEIGHT_NORMAL</literal></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>family</parameter>&nbsp;:</term>
<listitem><simpara> a font family name, encoded in UTF-8
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>slant</parameter>&nbsp;:</term>
<listitem><simpara> the slant for the font
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>weight</parameter>&nbsp;:</term>
<listitem><simpara> the weight for the font
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-set-font-size" role="function"/>cairo_set_font_size ()</title>
<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,
                                                         <link linkend="double">double</link> size);</programlisting>
<para>
Sets the current font matrix to a scale by a factor of <parameter>size</parameter>, replacing
any font matrix previously set with <link linkend="cairo-set-font-size"><function>cairo_set_font_size()</function></link> or
<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
units. (More precisely, this matrix will result in the font's
em-square being a <parameter>size</parameter> by <parameter>size</parameter> square in user space.)
</para>
<para>
If text is drawn without a call to <link linkend="cairo-set-font-size"><function>cairo_set_font_size()</function></link>, (nor
<link linkend="cairo-set-font-matrix"><function>cairo_set_font_matrix()</function></link> nor <link linkend="cairo-set-scaled-font"><function>cairo_set_scaled_font()</function></link>), the default
font size is 10.0.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>size</parameter>&nbsp;:</term>
<listitem><simpara> the new font size, in user space units
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-set-font-matrix" role="function"/>cairo_set_font_matrix ()</title>
<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,
                                                         const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
<para>
Sets the current font matrix to <parameter>matrix</parameter>. 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 <link linkend="cairo-set-font-size"><function>cairo_set_font_size()</function></link>), but a more
complex font matrix can be used to shear the font
or stretch it unequally along the two axes</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-matrix-t"><type>cairo_matrix_t</type></link> describing a transform to be applied to
the current font.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-get-font-matrix" role="function"/>cairo_get_font_matrix ()</title>
<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,
                                                         <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
<para>
Stores the current font matrix into <parameter>matrix</parameter>. See
<link linkend="cairo-set-font-matrix"><function>cairo_set_font_matrix()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
<listitem><simpara> return value for the matrix
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-set-font-options" role="function"/>cairo_set_font_options ()</title>
<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,
                                                         const <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options);</programlisting>
<para>
Sets a set of custom font rendering options for the <link linkend="cairo-t"><type>cairo_t</type></link>.
Rendering options are derived by merging these options with the
options derived from underlying surface; if the value in <parameter>options</parameter>
has a default value (like <link linkend="CAIRO-ANTIALIAS-DEFAULT:CAPS"><literal>CAIRO_ANTIALIAS_DEFAULT</literal></link>), then the value
from the surface is used.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>options</parameter>&nbsp;:</term>
<listitem><simpara> font options to use
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-get-font-options" role="function"/>cairo_get_font_options ()</title>
<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,
                                                         <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options);</programlisting>
<para>
Retrieves font rendering options set via <link linkend="cairo-set-font-options"><type>cairo_set_font_options</type></link>.
Note that the returned options do not include any options derived
from the underlying surface; they are literally the options
passed to <link linkend="cairo-set-font-options"><function>cairo_set_font_options()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>options</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-font-options-t"><type>cairo_font_options_t</type></link> object into which to store
  the retrieved options. All existing values are overwritten
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-set-font-face" role="function"/>cairo_set_font_face ()</title>
<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,
                                                         <link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);</programlisting>
<para>
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
<parameter>font_face</parameter>. The replaced font face in the <link linkend="cairo-t"><type>cairo_t</type></link> will be
destroyed if there are no other references to it.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>font_face</parameter>&nbsp;:</term>
<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
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-get-font-face" role="function"/>cairo_get_font_face ()</title>
<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>
<para>
Gets the current font face for a <link linkend="cairo-t"><type>cairo_t</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current font face.  This object is owned by
cairo. To keep a reference to it, you must call
cairo_font_face_reference.

This function never returns <link linkend="NULL:CAPS"><literal>NULL</literal></link>. If memory cannot be allocated, a
special "nil" <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link> object will be returned on which
<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
this nil object will cause its error state to propagate to other
objects it is passed to, (for example, calling
<link linkend="cairo-set-font-face"><function>cairo_set_font_face()</function></link> with a nil font will trigger an error that
will shutdown the <link linkend="cairo-t"><type>cairo_t</type></link> object).
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-set-scaled-font" role="function" condition="since:1.2"/>cairo_set_scaled_font ()</title>
<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,
                                                         const <link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting>
<para>
Replaces the current font face, font matrix, and font options in
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
some translation, the current CTM of the <link linkend="cairo-t"><type>cairo_t</type></link> should be the
same as that of the <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>, which can be accessed
using <link linkend="cairo-scaled-font-get-ctm"><function>cairo_scaled_font_get_ctm()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>scaled_font</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  1.2
</para></refsect2>
<refsect2>
<title><anchor id="cairo-get-scaled-font" role="function" condition="since:1.4"/>cairo_get_scaled_font ()</title>
<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>
<para>
Gets the current scaled font for a <link linkend="cairo-t"><type>cairo_t</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current scaled font. This object is owned by
cairo. To keep a reference to it, you must call
<link linkend="cairo-scaled-font-reference"><function>cairo_scaled_font_reference()</function></link>.

This function never returns <link linkend="NULL:CAPS"><literal>NULL</literal></link>. If memory cannot be allocated, a
special "nil" <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> object will be returned on which
<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
this nil object will cause its error state to propagate to other
objects it is passed to, (for example, calling
<link linkend="cairo-set-scaled-font"><function>cairo_set_scaled_font()</function></link> with a nil font will trigger an error that
will shutdown the <link linkend="cairo-t"><type>cairo_t</type></link> object).

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  1.4
</para></refsect2>
<refsect2>
<title><anchor id="cairo-show-text" role="function"/>cairo_show_text ()</title>
<indexterm><primary>cairo_show_text</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_show_text                     (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="char">char</link> *utf8);</programlisting>
<para>
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.
</para>
<para>
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.
</para>
<para>
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 <link linkend="cairo-show-text"><function>cairo_show_text()</function></link>.
</para>
<para>
Note: The <link linkend="cairo-show-text"><function>cairo_show_text()</function></link> 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
serious text-using applications. See <link linkend="cairo-show-glyphs"><function>cairo_show_glyphs()</function></link> for the
"real" text display API in cairo.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>utf8</parameter>&nbsp;:</term>
<listitem><simpara> a string of text encoded in UTF-8
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-show-glyphs" role="function"/>cairo_show_glyphs ()</title>
<indexterm><primary>cairo_show_glyphs</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_show_glyphs                   (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
                                                         <link linkend="int">int</link> num_glyphs);</programlisting>
<para>
A drawing operator that generates the shape from an array of glyphs,
rendered according to the current font_face, font_size
(font_matrix), and font_options.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>glyphs</parameter>&nbsp;:</term>
<listitem><simpara> array of glyphs to show
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>num_glyphs</parameter>&nbsp;:</term>
<listitem><simpara> number of glyphs to show
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-font-extents" role="function"/>cairo_font_extents ()</title>
<indexterm><primary>cairo_font_extents</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_font_extents                  (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         <link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents);</programlisting>
<para>
Gets the font extents for the currently selected font.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-font-extents-t"><type>cairo_font_extents_t</type></link> object into which the results
will be stored.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-text-extents" role="function"/>cairo_text_extents ()</title>
<indexterm><primary>cairo_text_extents</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_text_extents                  (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="char">char</link> *utf8,
                                                         <link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);</programlisting>
<para>
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 <link linkend="cairo-show-text"><function>cairo_show_text()</function></link>). Additionally, the
x_advance and y_advance values indicate the amount by which the
current point would be advanced by <link linkend="cairo-show-text"><function>cairo_show_text()</function></link>.
</para>
<para>
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.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>utf8</parameter>&nbsp;:</term>
<listitem><simpara> a string of text, encoded in UTF-8
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> object into which the results
will be stored
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-glyph-extents" role="function"/>cairo_glyph_extents ()</title>
<indexterm><primary>cairo_glyph_extents</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_glyph_extents                 (<link linkend="cairo-t">cairo_t</link> *cr,
                                                         const <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
                                                         <link linkend="int">int</link> num_glyphs,
                                                         <link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);</programlisting>
<para>
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 <link linkend="cairo-show-glyphs"><function>cairo_show_glyphs()</function></link>).
Additionally, the x_advance and y_advance values indicate the
amount by which the current point would be advanced by
cairo_show_glyphs.
</para>
<para>
Note that whitespace glyphs do not contribute to the size of the
rectangle (extents.width and extents.height).</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>glyphs</parameter>&nbsp;:</term>
<listitem><simpara> an array of <link linkend="cairo-glyph-t"><type>cairo_glyph_t</type></link> objects
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>num_glyphs</parameter>&nbsp;:</term>
<listitem><simpara> the number of elements in <parameter>glyphs</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> object into which the results
will be stored
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>



<refsect1>
<title>See Also</title>
<para>
<itemizedlist>
<listitem><link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link></listitem>
<listitem><link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link></listitem>
<listitem><link linkend="cairo-text-path"><function>cairo_text_path()</function></link></listitem>
<listitem><link linkend="cairo-glyph-path"><function>cairo_glyph_path()</function></link></listitem>
</itemizedlist>
</para>
</refsect1>


<refsect1><refsect2 /><refsect2 /></refsect1>
</refentry>
