<refentry id="pango-Text-Processing">
<refmeta>
<refentrytitle role="top_of_page" id="pango-Text-Processing.top_of_page">Rendering</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>PANGO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Rendering</refname>
<refpurpose>Functions to run the rendering pipeline</refpurpose>
</refnamediv>

<refsynopsisdiv id="pango-Text-Processing.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>
<anchor id="PangoContext"/>
<synopsis>
                    <link linkend="PangoContext-struct">PangoContext</link>;
                    <link linkend="PangoItem">PangoItem</link>;
                    <link linkend="PangoAnalysis">PangoAnalysis</link>;
#define             <link linkend="PANGO-ANALYSIS-FLAG-CENTERED-BASELINE--CAPS">PANGO_ANALYSIS_FLAG_CENTERED_BASELINE</link>
#define             <link linkend="PANGO-TYPE-DIRECTION--CAPS">PANGO_TYPE_DIRECTION</link>

<link linkend="GList">GList</link> *             <link linkend="pango-itemize">pango_itemize</link>                       (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="char">char</link> *text,
                                                         <link linkend="int">int</link> start_index,
                                                         <link linkend="int">int</link> length,
                                                         <link linkend="PangoAttrList">PangoAttrList</link> *attrs,
                                                         <link linkend="PangoAttrIterator">PangoAttrIterator</link> *cached_iter);
<link linkend="GList">GList</link> *             <link linkend="pango-itemize-with-base-dir">pango_itemize_with_base_dir</link>         (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoDirection">PangoDirection</link> base_dir,
                                                         const <link linkend="char">char</link> *text,
                                                         <link linkend="int">int</link> start_index,
                                                         <link linkend="int">int</link> length,
                                                         <link linkend="PangoAttrList">PangoAttrList</link> *attrs,
                                                         <link linkend="PangoAttrIterator">PangoAttrIterator</link> *cached_iter);
<link linkend="void">void</link>                <link linkend="pango-item-free">pango_item_free</link>                     (<link linkend="PangoItem">PangoItem</link> *item);
<link linkend="PangoItem">PangoItem</link> *         <link linkend="pango-item-copy">pango_item_copy</link>                     (<link linkend="PangoItem">PangoItem</link> *item);
<link linkend="PangoItem">PangoItem</link> *         <link linkend="pango-item-new">pango_item_new</link>                      (void);
<link linkend="PangoItem">PangoItem</link> *         <link linkend="pango-item-split">pango_item_split</link>                    (<link linkend="PangoItem">PangoItem</link> *orig,
                                                         <link linkend="int">int</link> split_index,
                                                         <link linkend="int">int</link> split_offset);
<link linkend="GList">GList</link> *             <link linkend="pango-reorder-items">pango_reorder_items</link>                 (<link linkend="GList">GList</link> *logical_items);

<link linkend="PangoContext">PangoContext</link> *      <link linkend="pango-context-new">pango_context_new</link>                   (void);
<link linkend="void">void</link>                <link linkend="pango-context-set-font-map">pango_context_set_font_map</link>          (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoFontMap">PangoFontMap</link> *font_map);
<link linkend="PangoFontMap">PangoFontMap</link> *      <link linkend="pango-context-get-font-map">pango_context_get_font_map</link>          (<link linkend="PangoContext">PangoContext</link> *context);
<link linkend="PangoFontDescription">PangoFontDescription</link> * <link linkend="pango-context-get-font-description">pango_context_get_font_description</link>
                                                        (<link linkend="PangoContext">PangoContext</link> *context);
<link linkend="void">void</link>                <link linkend="pango-context-set-font-description">pango_context_set_font_description</link>  (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="PangoFontDescription">PangoFontDescription</link> *desc);
<link linkend="PangoLanguage">PangoLanguage</link> *     <link linkend="pango-context-get-language">pango_context_get_language</link>          (<link linkend="PangoContext">PangoContext</link> *context);
<link linkend="void">void</link>                <link linkend="pango-context-set-language">pango_context_set_language</link>          (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoLanguage">PangoLanguage</link> *language);
<link linkend="PangoDirection">PangoDirection</link>      <link linkend="pango-context-get-base-dir">pango_context_get_base_dir</link>          (<link linkend="PangoContext">PangoContext</link> *context);
<link linkend="void">void</link>                <link linkend="pango-context-set-base-dir">pango_context_set_base_dir</link>          (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoDirection">PangoDirection</link> direction);
<link linkend="PangoGravity">PangoGravity</link>        <link linkend="pango-context-get-base-gravity">pango_context_get_base_gravity</link>      (<link linkend="PangoContext">PangoContext</link> *context);
<link linkend="void">void</link>                <link linkend="pango-context-set-base-gravity">pango_context_set_base_gravity</link>      (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoGravity">PangoGravity</link> gravity);
<link linkend="PangoGravity">PangoGravity</link>        <link linkend="pango-context-get-gravity">pango_context_get_gravity</link>           (<link linkend="PangoContext">PangoContext</link> *context);
<link linkend="PangoGravityHint">PangoGravityHint</link>    <link linkend="pango-context-get-gravity-hint">pango_context_get_gravity_hint</link>      (<link linkend="PangoContext">PangoContext</link> *context);
<link linkend="void">void</link>                <link linkend="pango-context-set-gravity-hint">pango_context_set_gravity_hint</link>      (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoGravityHint">PangoGravityHint</link> hint);
const <link linkend="PangoMatrix">PangoMatrix</link> * <link linkend="pango-context-get-matrix">pango_context_get_matrix</link>            (<link linkend="PangoContext">PangoContext</link> *context);
<link linkend="void">void</link>                <link linkend="pango-context-set-matrix">pango_context_set_matrix</link>            (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="PangoMatrix">PangoMatrix</link> *matrix);
<link linkend="PangoFont">PangoFont</link> *         <link linkend="pango-context-load-font">pango_context_load_font</link>             (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="PangoFontDescription">PangoFontDescription</link> *desc);
<link linkend="PangoFontset">PangoFontset</link> *      <link linkend="pango-context-load-fontset">pango_context_load_fontset</link>          (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="PangoFontDescription">PangoFontDescription</link> *desc,
                                                         <link linkend="PangoLanguage">PangoLanguage</link> *language);
<link linkend="PangoFontMetrics">PangoFontMetrics</link> *  <link linkend="pango-context-get-metrics">pango_context_get_metrics</link>           (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="PangoFontDescription">PangoFontDescription</link> *desc,
                                                         <link linkend="PangoLanguage">PangoLanguage</link> *language);
<link linkend="void">void</link>                <link linkend="pango-context-list-families">pango_context_list_families</link>         (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoFontFamily">PangoFontFamily</link> ***families,
                                                         <link linkend="int">int</link> *n_families);


<link linkend="void">void</link>                <link linkend="pango-break">pango_break</link>                         (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="int">int</link> length,
                                                         <link linkend="PangoAnalysis">PangoAnalysis</link> *analysis,
                                                         <link linkend="PangoLogAttr">PangoLogAttr</link> *attrs,
                                                         <link linkend="int">int</link> attrs_len);
<link linkend="void">void</link>                <link linkend="pango-get-log-attrs">pango_get_log_attrs</link>                 (const <link linkend="char">char</link> *text,
                                                         <link linkend="int">int</link> length,
                                                         <link linkend="int">int</link> level,
                                                         <link linkend="PangoLanguage">PangoLanguage</link> *language,
                                                         <link linkend="PangoLogAttr">PangoLogAttr</link> *log_attrs,
                                                         <link linkend="int">int</link> attrs_len);
<link linkend="void">void</link>                <link linkend="pango-find-paragraph-boundary">pango_find_paragraph_boundary</link>       (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="gint">gint</link> length,
                                                         <link linkend="gint">gint</link> *paragraph_delimiter_index,
                                                         <link linkend="gint">gint</link> *next_paragraph_start);
<link linkend="void">void</link>                <link linkend="pango-default-break">pango_default_break</link>                 (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="int">int</link> length,
                                                         <link linkend="PangoAnalysis">PangoAnalysis</link> *analysis,
                                                         <link linkend="PangoLogAttr">PangoLogAttr</link> *attrs,
                                                         <link linkend="int">int</link> attrs_len);
                    <link linkend="PangoLogAttr">PangoLogAttr</link>;

<link linkend="void">void</link>                <link linkend="pango-shape">pango_shape</link>                         (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="gint">gint</link> length,
                                                         const <link linkend="PangoAnalysis">PangoAnalysis</link> *analysis,
                                                         <link linkend="PangoGlyphString">PangoGlyphString</link> *glyphs);
</synopsis>
</refsynopsisdiv>

<refsect1 id="pango-Text-Processing.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----PangoContext
</synopsis>
</refsect1>








<refsect1 id="pango-Text-Processing.description" role="desc">
<title role="desc.title">Description</title>
<para>
The Pango rendering pipeline takes a string of
Unicode characters and converts it into glyphs.
The functions described in this section accomplish
various steps of this process.
</para>
</refsect1>

<refsect1 id="pango-Text-Processing.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="PangoContext-struct" role="struct">
<title>PangoContext</title>
<indexterm zone="PangoContext-struct"><primary sortas="PangoContext">PangoContext</primary></indexterm><programlisting>typedef struct _PangoContext PangoContext;</programlisting>
<para>
The <link linkend="PangoContext"><type>PangoContext</type></link> structure stores global information
used to control the itemization process.
</para></refsect2>
<refsect2 id="PangoItem" role="struct">
<title>PangoItem</title>
<indexterm zone="PangoItem"><primary sortas="PangoItem">PangoItem</primary></indexterm><programlisting>typedef struct {
  gint offset;
  gint length;
  gint num_chars;
  PangoAnalysis analysis;
} PangoItem;
</programlisting>
<para>
The <link linkend="PangoItem"><type>PangoItem</type></link> structure stores information about
a segment of text. It contains the following fields:
</para><variablelist role="struct">
<varlistentry>
<term><link linkend="gint">gint</link>&#160;<structfield>offset</structfield>;</term>
<listitem><simpara>the offset of the segment from the beginning of the
         string in bytes.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="gint">gint</link>&#160;<structfield>length</structfield>;</term>
<listitem><simpara>the length of the segment in bytes.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="gint">gint</link>&#160;<structfield>num_chars</structfield>;</term>
<listitem><simpara>the length of the segment in characters.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="PangoAnalysis">PangoAnalysis</link>&#160;<structfield>analysis</structfield>;</term>
<listitem><simpara>the properties of the segment.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="PangoAnalysis" role="struct">
<title>PangoAnalysis</title>
<indexterm zone="PangoAnalysis"><primary sortas="PangoAnalysis">PangoAnalysis</primary></indexterm><programlisting>typedef struct {
  PangoEngineShape *shape_engine;
  PangoEngineLang  *lang_engine;
  PangoFont *font;

  guint8 level;
  guint8 gravity; /* PangoGravity */
  guint8 flags;

  guint8 script; /* PangoScript */
  PangoLanguage *language;

  GSList *extra_attrs;
} PangoAnalysis;
</programlisting>
<para>
The <link linkend="PangoAnalysis"><type>PangoAnalysis</type></link> structure stores information about
the properties of a segment of text. It has the following
fields:
</para><variablelist role="struct">
<varlistentry>
<term><link linkend="PangoEngineShape">PangoEngineShape</link>&#160;*<structfield>shape_engine</structfield>;</term>
<listitem><simpara>the engine for doing rendering-system-dependent processing.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="PangoEngineLang">PangoEngineLang</link>&#160;*<structfield>lang_engine</structfield>;</term>
<listitem><simpara>the engine for doing rendering-system-independent processing.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="PangoFont">PangoFont</link>&#160;*<structfield>font</structfield>;</term>
<listitem><simpara>the font for this segment.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint8">guint8</link>&#160;<structfield>level</structfield>;</term>
<listitem><simpara>the bidirectional level for this segment.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint8">guint8</link>&#160;<structfield>gravity</structfield>;</term>
<listitem><simpara>the glyph orientation for this segment (A <link linkend="PangoGravity"><type>PangoGravity</type></link>).
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint8">guint8</link>&#160;<structfield>flags</structfield>;</term>
<listitem><simpara>boolean flags for this segment (currently only one) (Since: 1.16).
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint8">guint8</link>&#160;<structfield>script</structfield>;</term>
<listitem><simpara>the detected script for this segment (A <link linkend="PangoScript"><type>PangoScript</type></link>) (Since: 1.18).
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="PangoLanguage">PangoLanguage</link>&#160;*<structfield>language</structfield>;</term>
<listitem><simpara>the detected language for this segment.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GSList">GSList</link>&#160;*<structfield>extra_attrs</structfield>;</term>
<listitem><simpara>extra attributes for this segment.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="PANGO-ANALYSIS-FLAG-CENTERED-BASELINE--CAPS" role="macro">
<title>PANGO_ANALYSIS_FLAG_CENTERED_BASELINE</title>
<indexterm zone="PANGO-ANALYSIS-FLAG-CENTERED-BASELINE--CAPS"><primary sortas="PANGO_ANALYSIS_FLAG_CENTERED_BASELINE">PANGO_ANALYSIS_FLAG_CENTERED_BASELINE</primary></indexterm><programlisting>#define PANGO_ANALYSIS_FLAG_CENTERED_BASELINE (1 &lt;&lt; 0)
</programlisting>
<para>
Whether the segment should be shifted to center around the baseline.
Used in vertical writing directions mostly.
Since: 1.16
</para></refsect2>
<refsect2 id="PANGO-TYPE-DIRECTION--CAPS" role="macro">
<title>PANGO_TYPE_DIRECTION</title>
<indexterm zone="PANGO-TYPE-DIRECTION--CAPS"><primary sortas="PANGO_TYPE_DIRECTION">PANGO_TYPE_DIRECTION</primary></indexterm><programlisting>#define PANGO_TYPE_DIRECTION (pango_direction_get_type())
</programlisting>
<para>
The <link linkend="GObject"><type>GObject</type></link> type for <link linkend="PangoDirection"><type>PangoDirection</type></link>.
</para></refsect2>
<refsect2 id="pango-itemize" role="function">
<title>pango_itemize ()</title>
<indexterm zone="pango-itemize"><primary sortas="pango_itemize">pango_itemize</primary></indexterm><programlisting><link linkend="GList">GList</link> *             pango_itemize                       (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="char">char</link> *text,
                                                         <link linkend="int">int</link> start_index,
                                                         <link linkend="int">int</link> length,
                                                         <link linkend="PangoAttrList">PangoAttrList</link> *attrs,
                                                         <link linkend="PangoAttrIterator">PangoAttrIterator</link> *cached_iter);</programlisting>
<para>
Breaks a piece of text into segments with consistent
directional level and shaping engine. Each byte of <parameter>text</parameter> will
be contained in exactly one of the items in the returned list;
the generated list of items will be in logical order (the start
offsets of the items are ascending).
</para>
<para>
<parameter>cached_iter</parameter> should be an iterator over <parameter>attrs</parameter> currently positioned at a
range before or containing <parameter>start_index</parameter>; <parameter>cached_iter</parameter> will be advanced to
the range covering the position just after <parameter>start_index</parameter> + <parameter>length</parameter>.
(i.e. if itemizing in a loop, just keep passing in the same <parameter>cached_iter</parameter>).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara>   a structure holding information that affects
	       the itemization process.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara>      the text to itemize.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>start_index</parameter>&#160;:</term>
<listitem><simpara> first byte in <parameter>text</parameter> to process
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&#160;:</term>
<listitem><simpara>    the number of bytes (not characters) to process
            after <parameter>start_index</parameter>.
            This must be &gt;= 0.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>attrs</parameter>&#160;:</term>
<listitem><simpara>     the set of attributes that apply to <parameter>text</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cached_iter</parameter>&#160;:</term>
<listitem><simpara>      Cached attribute iterator, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GList"><type>GList</type></link> of <link linkend="PangoItem"><type>PangoItem</type></link> structures.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-itemize-with-base-dir" role="function" condition="since:1.4">
<title>pango_itemize_with_base_dir ()</title>
<indexterm zone="pango-itemize-with-base-dir" role="1.4"><primary sortas="pango_itemize_with_base_dir">pango_itemize_with_base_dir</primary></indexterm><programlisting><link linkend="GList">GList</link> *             pango_itemize_with_base_dir         (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoDirection">PangoDirection</link> base_dir,
                                                         const <link linkend="char">char</link> *text,
                                                         <link linkend="int">int</link> start_index,
                                                         <link linkend="int">int</link> length,
                                                         <link linkend="PangoAttrList">PangoAttrList</link> *attrs,
                                                         <link linkend="PangoAttrIterator">PangoAttrIterator</link> *cached_iter);</programlisting>
<para>
Like <link linkend="pango-itemize"><function>pango_itemize()</function></link>, but the base direction to use when
computing bidirectional levels (see <link linkend="pango-context-set-base-dir"><function>pango_context_set_base_dir()</function></link>),
is specified explicitly rather than gotten from the <link linkend="PangoContext"><type>PangoContext</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara>   a structure holding information that affects
	       the itemization process.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>base_dir</parameter>&#160;:</term>
<listitem><simpara>  base direction to use for bidirectional processing
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara>      the text to itemize.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>start_index</parameter>&#160;:</term>
<listitem><simpara> first byte in <parameter>text</parameter> to process
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&#160;:</term>
<listitem><simpara>    the number of bytes (not characters) to process
            after <parameter>start_index</parameter>.
            This must be &gt;= 0.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>attrs</parameter>&#160;:</term>
<listitem><simpara>     the set of attributes that apply to <parameter>text</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cached_iter</parameter>&#160;:</term>
<listitem><simpara>      Cached attribute iterator, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GList"><type>GList</type></link> of <link linkend="PangoItem"><type>PangoItem</type></link> structures.  The items should be
freed using <link linkend="pango-item-free"><function>pango_item_free()</function></link> probably in combination with <link linkend="g-list-foreach"><function>g_list_foreach()</function></link>,
and the list itself using <link linkend="g-list-free"><function>g_list_free()</function></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="pango-item-free" role="function">
<title>pango_item_free ()</title>
<indexterm zone="pango-item-free"><primary sortas="pango_item_free">pango_item_free</primary></indexterm><programlisting><link linkend="void">void</link>                pango_item_free                     (<link linkend="PangoItem">PangoItem</link> *item);</programlisting>
<para>
Free a <link linkend="PangoItem"><type>PangoItem</type></link> and all associated memory.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>item</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoItem"><type>PangoItem</type></link>, may be <link linkend="NULL--CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-item-copy" role="function">
<title>pango_item_copy ()</title>
<indexterm zone="pango-item-copy"><primary sortas="pango_item_copy">pango_item_copy</primary></indexterm><programlisting><link linkend="PangoItem">PangoItem</link> *         pango_item_copy                     (<link linkend="PangoItem">PangoItem</link> *item);</programlisting>
<para>
Copy an existing <link linkend="PangoItem"><type>PangoItem</type></link> structure.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>item</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoItem"><type>PangoItem</type></link>, may be <link linkend="NULL--CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the newly allocated <link linkend="PangoItem"><type>PangoItem</type></link>, which should
              be freed with <link linkend="pango-item-free"><function>pango_item_free()</function></link>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if
              <parameter>item</parameter> was NULL.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-item-new" role="function">
<title>pango_item_new ()</title>
<indexterm zone="pango-item-new"><primary sortas="pango_item_new">pango_item_new</primary></indexterm><programlisting><link linkend="PangoItem">PangoItem</link> *         pango_item_new                      (void);</programlisting>
<para>
Creates a new <link linkend="PangoItem"><type>PangoItem</type></link> structure initialized to default values.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the newly allocated <link linkend="PangoItem"><type>PangoItem</type></link>, which should
              be freed with <link linkend="pango-item-free"><function>pango_item_free()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-item-split" role="function">
<title>pango_item_split ()</title>
<indexterm zone="pango-item-split"><primary sortas="pango_item_split">pango_item_split</primary></indexterm><programlisting><link linkend="PangoItem">PangoItem</link> *         pango_item_split                    (<link linkend="PangoItem">PangoItem</link> *orig,
                                                         <link linkend="int">int</link> split_index,
                                                         <link linkend="int">int</link> split_offset);</programlisting>
<para>
Modifies <parameter>orig</parameter> to cover only the text after <parameter>split_index</parameter>, and
returns a new item that covers the text before <parameter>split_index</parameter> that
used to be in <parameter>orig</parameter>. You can think of <parameter>split_index</parameter> as the length of
the returned item. <parameter>split_index</parameter> may not be 0, and it may not be
greater than or equal to the length of <parameter>orig</parameter> (that is, there must
be at least one byte assigned to each item, you can't create a
zero-length item). <parameter>split_offset</parameter> is the length of the first item in
chars, and must be provided because the text used to generate the
item isn't available, so <link linkend="pango-item-split"><function>pango_item_split()</function></link> can't count the char
length of the split items itself.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>orig</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoItem"><type>PangoItem</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>split_index</parameter>&#160;:</term>
<listitem><simpara> byte index of position to split item, relative to the start of the item
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>split_offset</parameter>&#160;:</term>
<listitem><simpara> number of chars between start of <parameter>orig</parameter> and <parameter>split_index</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> new item representing text before <parameter>split_index</parameter>, which
              should be freed with <link linkend="pango-item-free"><function>pango_item_free()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-reorder-items" role="function">
<title>pango_reorder_items ()</title>
<indexterm zone="pango-reorder-items"><primary sortas="pango_reorder_items">pango_reorder_items</primary></indexterm><programlisting><link linkend="GList">GList</link> *             pango_reorder_items                 (<link linkend="GList">GList</link> *logical_items);</programlisting>
<para>
From a list of items in logical order and the associated
directional levels, produce a list in visual order.
The original list is unmodified.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>logical_items</parameter>&#160;:</term>
<listitem><simpara>  a <link linkend="GList"><type>GList</type></link> of <link linkend="PangoItem"><type>PangoItem</type></link> in logical order.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GList"><type>GList</type></link> of <link linkend="PangoItem"><type>PangoItem</type></link> structures in visual order.

(Please open a bug if you use this function.
 It is not a particularly convenient interface, and the code
 is duplicated elsewhere in Pango for that reason.)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-new" role="function">
<title>pango_context_new ()</title>
<indexterm zone="pango-context-new"><primary sortas="pango_context_new">pango_context_new</primary></indexterm><programlisting><link linkend="PangoContext">PangoContext</link> *      pango_context_new                   (void);</programlisting>
<para>
Creates a new <link linkend="PangoContext"><type>PangoContext</type></link> initialized to default values.
</para>
<para>
This function is not particularly useful as it should always
be followed by a <link linkend="pango-context-set-font-map"><function>pango_context_set_font_map()</function></link> call, and the
function <link linkend="pango-font-map-create-context"><function>pango_font_map_create_context()</function></link> does these two steps
together and hence users are recommended to use that.
</para>
<para>
If you are using Pango as part of a higher-level system,
that system may have it's own way of create a <link linkend="PangoContext"><type>PangoContext</type></link>.
For instance, the GTK+ toolkit has, among others,
<link linkend="gdk-pango-context-get-for-screen"><function>gdk_pango_context_get_for_screen()</function></link>, and
<link linkend="gtk-widget-get-pango-context"><function>gtk_widget_get_pango_context()</function></link>.  Use those instead.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the newly allocated <link linkend="PangoContext"><type>PangoContext</type></link>, which should
              be freed with <link linkend="g-object-unref"><function>g_object_unref()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-set-font-map" role="function">
<title>pango_context_set_font_map ()</title>
<indexterm zone="pango-context-set-font-map"><primary sortas="pango_context_set_font_map">pango_context_set_font_map</primary></indexterm><programlisting><link linkend="void">void</link>                pango_context_set_font_map          (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoFontMap">PangoFontMap</link> *font_map);</programlisting>
<para>
Sets the font map to be searched when fonts are looked-up in this context.
This is only for internal use by Pango backends, a <link linkend="PangoContext"><type>PangoContext</type></link> obtained
via one of the recommended methods should already have a suitable font map.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>font_map</parameter>&#160;:</term>
<listitem><simpara> the <link linkend="PangoFontMap"><type>PangoFontMap</type></link> to set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-get-font-map" role="function" condition="since:1.6">
<title>pango_context_get_font_map ()</title>
<indexterm zone="pango-context-get-font-map" role="1.6"><primary sortas="pango_context_get_font_map">pango_context_get_font_map</primary></indexterm><programlisting><link linkend="PangoFontMap">PangoFontMap</link> *      pango_context_get_font_map          (<link linkend="PangoContext">PangoContext</link> *context);</programlisting>
<para>
Gets the <link linkend="PangoFontmap"><type>PangoFontmap</type></link> used to look up fonts for this context.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the font map for the <link linkend="PangoContext"><type>PangoContext</type></link>. This value
 is owned by Pango and should not be unreferenced.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.6</para></refsect2>
<refsect2 id="pango-context-get-font-description" role="function">
<title>pango_context_get_font_description ()</title>
<indexterm zone="pango-context-get-font-description"><primary sortas="pango_context_get_font_description">pango_context_get_font_description</primary></indexterm><programlisting><link linkend="PangoFontDescription">PangoFontDescription</link> * pango_context_get_font_description
                                                        (<link linkend="PangoContext">PangoContext</link> *context);</programlisting>
<para>
Retrieve the default font description for the context.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to the context's default font description.
              This value must not be modified or freed.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-set-font-description" role="function">
<title>pango_context_set_font_description ()</title>
<indexterm zone="pango-context-set-font-description"><primary sortas="pango_context_set_font_description">pango_context_set_font_description</primary></indexterm><programlisting><link linkend="void">void</link>                pango_context_set_font_description  (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="PangoFontDescription">PangoFontDescription</link> *desc);</programlisting>
<para>
Set the default font description for the context</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>desc</parameter>&#160;:</term>
<listitem><simpara> the new pango font description
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-get-language" role="function">
<title>pango_context_get_language ()</title>
<indexterm zone="pango-context-get-language"><primary sortas="pango_context_get_language">pango_context_get_language</primary></indexterm><programlisting><link linkend="PangoLanguage">PangoLanguage</link> *     pango_context_get_language          (<link linkend="PangoContext">PangoContext</link> *context);</programlisting>
<para>
Retrieves the global language tag for the context.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the global language tag.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-set-language" role="function">
<title>pango_context_set_language ()</title>
<indexterm zone="pango-context-set-language"><primary sortas="pango_context_set_language">pango_context_set_language</primary></indexterm><programlisting><link linkend="void">void</link>                pango_context_set_language          (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoLanguage">PangoLanguage</link> *language);</programlisting>
<para>
Sets the global language tag for the context.  The default language
for the locale of the running process can be found using
<link linkend="pango-language-get-default"><function>pango_language_get_default()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>language</parameter>&#160;:</term>
<listitem><simpara> the new language tag.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-get-base-dir" role="function">
<title>pango_context_get_base_dir ()</title>
<indexterm zone="pango-context-get-base-dir"><primary sortas="pango_context_get_base_dir">pango_context_get_base_dir</primary></indexterm><programlisting><link linkend="PangoDirection">PangoDirection</link>      pango_context_get_base_dir          (<link linkend="PangoContext">PangoContext</link> *context);</programlisting>
<para>
Retrieves the base direction for the context. See
<link linkend="pango-context-set-base-dir"><function>pango_context_set_base_dir()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the base direction for the context.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-set-base-dir" role="function">
<title>pango_context_set_base_dir ()</title>
<indexterm zone="pango-context-set-base-dir"><primary sortas="pango_context_set_base_dir">pango_context_set_base_dir</primary></indexterm><programlisting><link linkend="void">void</link>                pango_context_set_base_dir          (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoDirection">PangoDirection</link> direction);</programlisting>
<para>
Sets the base direction for the context.
</para>
<para>
The base direction is used in applying the Unicode bidirectional
algorithm; if the <parameter>direction</parameter> is <link linkend="PANGO-DIRECTION-LTR--CAPS"><literal>PANGO_DIRECTION_LTR</literal></link> or
<link linkend="PANGO-DIRECTION-RTL--CAPS"><literal>PANGO_DIRECTION_RTL</literal></link>, then the value will be used as the paragraph
direction in the Unicode bidirectional algorithm.  A value of
<link linkend="PANGO-DIRECTION-WEAK-LTR--CAPS"><literal>PANGO_DIRECTION_WEAK_LTR</literal></link> or <link linkend="PANGO-DIRECTION-WEAK-RTL--CAPS"><literal>PANGO_DIRECTION_WEAK_RTL</literal></link> is used only
for paragraphs that do not contain any strong characters themselves.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>direction</parameter>&#160;:</term>
<listitem><simpara> the new base direction
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-get-base-gravity" role="function" condition="since:1.16">
<title>pango_context_get_base_gravity ()</title>
<indexterm zone="pango-context-get-base-gravity" role="1.16"><primary sortas="pango_context_get_base_gravity">pango_context_get_base_gravity</primary></indexterm><programlisting><link linkend="PangoGravity">PangoGravity</link>        pango_context_get_base_gravity      (<link linkend="PangoContext">PangoContext</link> *context);</programlisting>
<para>
Retrieves the base gravity for the context. See
<link linkend="pango-context-set-base-gravity"><function>pango_context_set_base_gravity()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the base gravity for the context.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.16</para></refsect2>
<refsect2 id="pango-context-set-base-gravity" role="function" condition="since:1.16">
<title>pango_context_set_base_gravity ()</title>
<indexterm zone="pango-context-set-base-gravity" role="1.16"><primary sortas="pango_context_set_base_gravity">pango_context_set_base_gravity</primary></indexterm><programlisting><link linkend="void">void</link>                pango_context_set_base_gravity      (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoGravity">PangoGravity</link> gravity);</programlisting>
<para>
Sets the base gravity for the context.
</para>
<para>
The base gravity is used in laying vertical text out.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>gravity</parameter>&#160;:</term>
<listitem><simpara> the new base gravity
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.16</para></refsect2>
<refsect2 id="pango-context-get-gravity" role="function" condition="since:1.16">
<title>pango_context_get_gravity ()</title>
<indexterm zone="pango-context-get-gravity" role="1.16"><primary sortas="pango_context_get_gravity">pango_context_get_gravity</primary></indexterm><programlisting><link linkend="PangoGravity">PangoGravity</link>        pango_context_get_gravity           (<link linkend="PangoContext">PangoContext</link> *context);</programlisting>
<para>
Retrieves the gravity for the context. This is similar to
<link linkend="pango-context-get-base-gravity"><function>pango_context_get_base_gravity()</function></link>, except for when the base gravity
is <link linkend="PANGO-GRAVITY-AUTO--CAPS"><literal>PANGO_GRAVITY_AUTO</literal></link> for which <link linkend="pango-gravity-get-for-matrix"><function>pango_gravity_get_for_matrix()</function></link> is used
to return the gravity from the current context matrix.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the resolved gravity for the context.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.16</para></refsect2>
<refsect2 id="pango-context-get-gravity-hint" role="function" condition="since:1.16">
<title>pango_context_get_gravity_hint ()</title>
<indexterm zone="pango-context-get-gravity-hint" role="1.16"><primary sortas="pango_context_get_gravity_hint">pango_context_get_gravity_hint</primary></indexterm><programlisting><link linkend="PangoGravityHint">PangoGravityHint</link>    pango_context_get_gravity_hint      (<link linkend="PangoContext">PangoContext</link> *context);</programlisting>
<para>
Retrieves the gravity hint for the context. See
<link linkend="pango-context-set-gravity-hint"><function>pango_context_set_gravity_hint()</function></link> for details.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the gravity hint for the context.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.16</para></refsect2>
<refsect2 id="pango-context-set-gravity-hint" role="function" condition="since:1.16">
<title>pango_context_set_gravity_hint ()</title>
<indexterm zone="pango-context-set-gravity-hint" role="1.16"><primary sortas="pango_context_set_gravity_hint">pango_context_set_gravity_hint</primary></indexterm><programlisting><link linkend="void">void</link>                pango_context_set_gravity_hint      (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoGravityHint">PangoGravityHint</link> hint);</programlisting>
<para>
Sets the gravity hint for the context.
</para>
<para>
The gravity hint is used in laying vertical text out, and is only relevant
if gravity of the context as returned by <link linkend="pango-context-get-gravity"><function>pango_context_get_gravity()</function></link>
is set <link linkend="PANGO-GRAVITY-EAST--CAPS"><literal>PANGO_GRAVITY_EAST</literal></link> or <link linkend="PANGO-GRAVITY-WEST--CAPS"><literal>PANGO_GRAVITY_WEST</literal></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>hint</parameter>&#160;:</term>
<listitem><simpara> the new gravity hint
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.16</para></refsect2>
<refsect2 id="pango-context-get-matrix" role="function" condition="since:1.6">
<title>pango_context_get_matrix ()</title>
<indexterm zone="pango-context-get-matrix" role="1.6"><primary sortas="pango_context_get_matrix">pango_context_get_matrix</primary></indexterm><programlisting>const <link linkend="PangoMatrix">PangoMatrix</link> * pango_context_get_matrix            (<link linkend="PangoContext">PangoContext</link> *context);</programlisting>
<para>
Gets the transformation matrix that will be applied when
rendering with this context. See <link linkend="pango-context-set-matrix"><function>pango_context_set_matrix()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the matrix, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if no matrix has been set
 (which is the same as the identity matrix). The returned
 matrix is owned by Pango and must not be modified or
 freed.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.6</para></refsect2>
<refsect2 id="pango-context-set-matrix" role="function" condition="since:1.6">
<title>pango_context_set_matrix ()</title>
<indexterm zone="pango-context-set-matrix" role="1.6"><primary sortas="pango_context_set_matrix">pango_context_set_matrix</primary></indexterm><programlisting><link linkend="void">void</link>                pango_context_set_matrix            (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="PangoMatrix">PangoMatrix</link> *matrix);</programlisting>
<para>
Sets the transformation matrix that will be applied when rendering
with this context. Note that reported metrics are in the user space
coordinates before the application of the matrix, not device-space
coordinates after the application of the matrix. So, they don't scale
with the matrix, though they may change slightly for different
matrices, depending on how the text is fit to the pixel grid.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>matrix</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoMatrix"><type>PangoMatrix</type></link>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> to unset any existing matrix.
 (No matrix set is the same as setting the identity matrix.)
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.6</para></refsect2>
<refsect2 id="pango-context-load-font" role="function">
<title>pango_context_load_font ()</title>
<indexterm zone="pango-context-load-font"><primary sortas="pango_context_load_font">pango_context_load_font</primary></indexterm><programlisting><link linkend="PangoFont">PangoFont</link> *         pango_context_load_font             (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="PangoFontDescription">PangoFontDescription</link> *desc);</programlisting>
<para>
Loads the font in one of the fontmaps in the context
that is the closest match for <parameter>desc</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>desc</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoFontDescription"><type>PangoFontDescription</type></link> describing the font to load
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the font loaded, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if no font matched.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-load-fontset" role="function">
<title>pango_context_load_fontset ()</title>
<indexterm zone="pango-context-load-fontset"><primary sortas="pango_context_load_fontset">pango_context_load_fontset</primary></indexterm><programlisting><link linkend="PangoFontset">PangoFontset</link> *      pango_context_load_fontset          (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="PangoFontDescription">PangoFontDescription</link> *desc,
                                                         <link linkend="PangoLanguage">PangoLanguage</link> *language);</programlisting>
<para>
Load a set of fonts in the context that can be used to render
a font matching <parameter>desc</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>desc</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoFontDescription"><type>PangoFontDescription</type></link> describing the fonts to load
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>language</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoLanguage"><type>PangoLanguage</type></link> the fonts will be used for
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the fontset, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if no font matched.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-get-metrics" role="function">
<title>pango_context_get_metrics ()</title>
<indexterm zone="pango-context-get-metrics"><primary sortas="pango_context_get_metrics">pango_context_get_metrics</primary></indexterm><programlisting><link linkend="PangoFontMetrics">PangoFontMetrics</link> *  pango_context_get_metrics           (<link linkend="PangoContext">PangoContext</link> *context,
                                                         const <link linkend="PangoFontDescription">PangoFontDescription</link> *desc,
                                                         <link linkend="PangoLanguage">PangoLanguage</link> *language);</programlisting>
<para>
Get overall metric information for a particular font
description.  Since the metrics may be substantially different for
different scripts, a language tag can be provided to indicate that
the metrics should be retrieved that correspond to the script(s)
used by that language.
</para>
<para>
The <link linkend="PangoFontDescription"><type>PangoFontDescription</type></link> is interpreted in the same way as
by <link linkend="pango-itemize"><function>pango_itemize()</function></link>, and the family name may be a comma separated
list of figures. If characters from multiple of these families
would be used to render the string, then the returned fonts would
be a composite of the metrics for the fonts loaded for the
individual families.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>desc</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoFontDescription"><type>PangoFontDescription</type></link> structure.  <link linkend="NULL--CAPS"><literal>NULL</literal></link> means that the font
	      description from the context will be used.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>language</parameter>&#160;:</term>
<listitem><simpara> language tag used to determine which script to get the metrics
           for. <link linkend="NULL--CAPS"><literal>NULL</literal></link> means that the language tag from the context will
           be used. If no language tag is set on the context, metrics
           for the default language (as determined by
           <link linkend="pango-language-get-default"><function>pango_language_get_default()</function></link>) will be returned.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="PangoFontMetrics"><type>PangoFontMetrics</type></link> object. The caller must call <link linkend="pango-font-metrics-unref"><function>pango_font_metrics_unref()</function></link>
  when finished using the object.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-context-list-families" role="function">
<title>pango_context_list_families ()</title>
<indexterm zone="pango-context-list-families"><primary sortas="pango_context_list_families">pango_context_list_families</primary></indexterm><programlisting><link linkend="void">void</link>                pango_context_list_families         (<link linkend="PangoContext">PangoContext</link> *context,
                                                         <link linkend="PangoFontFamily">PangoFontFamily</link> ***families,
                                                         <link linkend="int">int</link> *n_families);</programlisting>
<para>
List all families for a context.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>families</parameter>&#160;:</term>
<listitem><simpara> location to store a pointer to an array of <link linkend="PangoFontFamily"><type>PangoFontFamily</type></link> *.
           This array should be freed with <link linkend="g-free"><function>g_free()</function></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n_families</parameter>&#160;:</term>
<listitem><simpara> location to store the number of elements in <parameter>descs</parameter>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-break" role="function">
<title>pango_break ()</title>
<indexterm zone="pango-break"><primary sortas="pango_break">pango_break</primary></indexterm><programlisting><link linkend="void">void</link>                pango_break                         (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="int">int</link> length,
                                                         <link linkend="PangoAnalysis">PangoAnalysis</link> *analysis,
                                                         <link linkend="PangoLogAttr">PangoLogAttr</link> *attrs,
                                                         <link linkend="int">int</link> attrs_len);</programlisting>
<para>
Determines possible line, word, and character breaks
for a string of Unicode text with a single analysis.  For most
purposes you may want to use <link linkend="pango-get-log-attrs"><function>pango_get_log_attrs()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara>      the text to process
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&#160;:</term>
<listitem><simpara>    length of <parameter>text</parameter> in bytes (may be -1 if <parameter>text</parameter> is nul-terminated)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>analysis</parameter>&#160;:</term>
<listitem><simpara>  <link linkend="PangoAnalysis"><type>PangoAnalysis</type></link> structure from <link linkend="pango-itemize"><function>pango_itemize()</function></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>attrs</parameter>&#160;:</term>
<listitem><simpara>     an array to store character information in
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>attrs_len</parameter>&#160;:</term>
<listitem><simpara> size of the array passed as <parameter>attrs</parameter>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-get-log-attrs" role="function">
<title>pango_get_log_attrs ()</title>
<indexterm zone="pango-get-log-attrs"><primary sortas="pango_get_log_attrs">pango_get_log_attrs</primary></indexterm><programlisting><link linkend="void">void</link>                pango_get_log_attrs                 (const <link linkend="char">char</link> *text,
                                                         <link linkend="int">int</link> length,
                                                         <link linkend="int">int</link> level,
                                                         <link linkend="PangoLanguage">PangoLanguage</link> *language,
                                                         <link linkend="PangoLogAttr">PangoLogAttr</link> *log_attrs,
                                                         <link linkend="int">int</link> attrs_len);</programlisting>
<para>
Computes a <link linkend="PangoLogAttr"><type>PangoLogAttr</type></link> for each character in <parameter>text</parameter>. The <parameter>log_attrs</parameter>
array must have one <link linkend="PangoLogAttr"><type>PangoLogAttr</type></link> for each position in <parameter>text</parameter>; if
<parameter>text</parameter> contains N characters, it has N+1 positions, including the
last position at the end of the text. <parameter>text</parameter> should be an entire
paragraph; logical attributes can't be computed without context
(for example you need to see spaces on either side of a word to know
the word is a word).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara> text to process
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&#160;:</term>
<listitem><simpara> length in bytes of <parameter>text</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>level</parameter>&#160;:</term>
<listitem><simpara> embedding level, or -1 if unknown
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>language</parameter>&#160;:</term>
<listitem><simpara> language tag
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>log_attrs</parameter>&#160;:</term>
<listitem><simpara> array with one <link linkend="PangoLogAttr"><type>PangoLogAttr</type></link> per character in <parameter>text</parameter>, plus one extra, to be filled in
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>attrs_len</parameter>&#160;:</term>
<listitem><simpara> length of <parameter>log_attrs</parameter> array
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-find-paragraph-boundary" role="function">
<title>pango_find_paragraph_boundary ()</title>
<indexterm zone="pango-find-paragraph-boundary"><primary sortas="pango_find_paragraph_boundary">pango_find_paragraph_boundary</primary></indexterm><programlisting><link linkend="void">void</link>                pango_find_paragraph_boundary       (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="gint">gint</link> length,
                                                         <link linkend="gint">gint</link> *paragraph_delimiter_index,
                                                         <link linkend="gint">gint</link> *next_paragraph_start);</programlisting>
<para>
Locates a paragraph boundary in <parameter>text</parameter>. A boundary is caused by
delimiter characters, such as a newline, carriage return, carriage
return-newline pair, or Unicode paragraph separator character.  The
index of the run of delimiters is returned in
<parameter>paragraph_delimiter_index</parameter>. The index of the start of the paragraph
(index after all delimiters) is stored in <parameter>next_paragraph_start</parameter>.
</para>
<para>
If no delimiters are found, both <parameter>paragraph_delimiter_index</parameter> and
<parameter>next_paragraph_start</parameter> are filled with the length of <parameter>text</parameter> (an index one
off the end).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara> UTF-8 text
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&#160;:</term>
<listitem><simpara> length of <parameter>text</parameter> in bytes, or -1 if nul-terminated
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>paragraph_delimiter_index</parameter>&#160;:</term>
<listitem><simpara> return location for index of delimiter
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>next_paragraph_start</parameter>&#160;:</term>
<listitem><simpara> return location for start of next paragraph
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-default-break" role="function">
<title>pango_default_break ()</title>
<indexterm zone="pango-default-break"><primary sortas="pango_default_break">pango_default_break</primary></indexterm><programlisting><link linkend="void">void</link>                pango_default_break                 (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="int">int</link> length,
                                                         <link linkend="PangoAnalysis">PangoAnalysis</link> *analysis,
                                                         <link linkend="PangoLogAttr">PangoLogAttr</link> *attrs,
                                                         <link linkend="int">int</link> attrs_len);</programlisting>
<para>
This is the default break algorithm, used if no language
engine overrides it. Normally you should use <link linkend="pango-break"><function>pango_break()</function></link>
instead. Unlike <link linkend="pango-break"><function>pango_break()</function></link>,
<parameter>analysis</parameter> can be <link linkend="NULL--CAPS"><literal>NULL</literal></link>, but only do that if you know what
you're doing. If you need an analysis to pass to <link linkend="pango-break"><function>pango_break()</function></link>,
you need to <link linkend="pango-itemize"><function>pango_itemize()</function></link>.  In most cases however you should
simply use <link linkend="pango-get-log-attrs"><function>pango_get_log_attrs()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara> text to break
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&#160;:</term>
<listitem><simpara> length of text in bytes (may be -1 if <parameter>text</parameter> is nul-terminated)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>analysis</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="PangoAnalysis"><type>PangoAnalysis</type></link> for the <parameter>text</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>attrs</parameter>&#160;:</term>
<listitem><simpara> logical attributes to fill in
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>attrs_len</parameter>&#160;:</term>
<listitem><simpara> size of the array passed as <parameter>attrs</parameter>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="PangoLogAttr" role="struct">
<title>PangoLogAttr</title>
<indexterm zone="PangoLogAttr"><primary sortas="PangoLogAttr">PangoLogAttr</primary></indexterm><programlisting>typedef struct {
  guint is_line_break : 1;      /* Can break line in front of character */

  guint is_mandatory_break : 1; /* Must break line in front of character */

  guint is_char_break : 1;      /* Can break here when doing char wrap */

  guint is_white : 1;           /* Whitespace character */

  /* Cursor can appear in front of character (i.e. this is a grapheme
   * boundary, or the first character in the text).
   */
  guint is_cursor_position : 1;

  /* Note that in degenerate cases, you could have both start/end set on
   * some text, most likely for sentences (e.g. no space after a period, so
   * the next sentence starts right away).
   */

  guint is_word_start : 1;      /* first character in a word */
  guint is_word_end   : 1;      /* is first non-word char after a word */

  /* There are two ways to divide sentences. The first assigns all
   * intersentence whitespace/control/format chars to some sentence,
   * so all chars are in some sentence; is_sentence_boundary denotes
   * the boundaries there. The second way doesn't assign
   * between-sentence spaces, etc. to any sentence, so
   * is_sentence_start/is_sentence_end mark the boundaries of those
   * sentences.
   */
  guint is_sentence_boundary : 1;
  guint is_sentence_start : 1;  /* first character in a sentence */
  guint is_sentence_end : 1;    /* first non-sentence char after a sentence */

  /* If set, backspace deletes one character rather than
   * the entire grapheme cluster.
   */
  guint backspace_deletes_character : 1;

  /* Only few space variants (U+0020 and U+00A0) have variable
   * width during justification.
   */
  guint is_expandable_space : 1;

  /* Word boundary as defined by UAX#29 */
  guint is_word_boundary : 1;	/* is NOT in the middle of a word */
} PangoLogAttr;
</programlisting>
<para>
The <link linkend="PangoLogAttr"><type>PangoLogAttr</type></link> structure stores information
about the attributes of a single character.
</para><variablelist role="struct">
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_line_break</structfield>&#160;:&#160;1;</term>
<listitem><simpara>if set, can break line in front of character
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_mandatory_break</structfield>&#160;:&#160;1;</term>
<listitem><simpara>if set, must break line in front of character
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_char_break</structfield>&#160;:&#160;1;</term>
<listitem><simpara>if set, can break here when doing character wrapping
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_white</structfield>&#160;:&#160;1;</term>
<listitem><simpara>is whitespace character
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_cursor_position</structfield>&#160;:&#160;1;</term>
<listitem><simpara>if set, cursor can appear in front of character.
	i.e. this is a grapheme boundary, or the first character
        in the text.
	This flag implements Unicode's
	<ulink url="http://www.unicode.org/reports/tr29/">Grapheme
	Cluster Boundaries</ulink> semantics.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_word_start</structfield>&#160;:&#160;1;</term>
<listitem><simpara>is first character in a word
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_word_end</structfield>&#160;:&#160;1;</term>
<listitem><simpara>is first non-word char after a word
	Note that in degenerate cases, you could have both <parameter>is_word_start</parameter>
	and <parameter>is_word_end</parameter> set for some character.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_sentence_boundary</structfield>&#160;:&#160;1;</term>
<listitem><simpara>is a sentence boundary.
        There are two ways to divide sentences. The first assigns all
	inter-sentence whitespace/control/format chars to some sentence,
	so all chars are in some sentence; <parameter>is_sentence_boundary</parameter> denotes
	the boundaries there. The second way doesn't assign
	between-sentence spaces, etc. to any sentence, so
	<parameter>is_sentence_start</parameter>/<parameter>is_sentence_end</parameter> mark the boundaries
	of those sentences.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_sentence_start</structfield>&#160;:&#160;1;</term>
<listitem><simpara>is first character in a sentence
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_sentence_end</structfield>&#160;:&#160;1;</term>
<listitem><simpara>is first char after a sentence.
	Note that in degenerate cases, you could have both <parameter>is_sentence_start</parameter>
	and <parameter>is_sentence_end</parameter> set for some character. (e.g. no space after a
	period, so the next sentence starts right away)
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>backspace_deletes_character</structfield>&#160;:&#160;1;</term>
<listitem><simpara>if set, backspace deletes one character
                              rather than the entire grapheme cluster. This
                              field is only meaningful on grapheme
                              boundaries (where <parameter>is_cursor_position</parameter> is
                              set).  In some languages, the full grapheme
                              (e.g.  letter + diacritics) is considered a
                              unit, while in others, each decomposed
                              character in the grapheme is a unit. In the
                              default implementation of <link linkend="pango-break"><function>pango_break()</function></link>, this
                              bit is set on all grapheme boundaries except
                              those following Latin, Cyrillic or Greek base
                              characters.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_expandable_space</structfield>&#160;:&#160;1;</term>
<listitem><simpara>is a whitespace character that can possibly be
                      expanded for justification purposes. (Since: 1.18)
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>is_word_boundary</structfield>&#160;:&#160;1;</term>
<listitem><simpara>is a word boundary.
	More specifically, means that this is not a position in the middle
	of a word.  For example, both sides of a punctuation mark are
	considered word boundaries.  This flag is particularly useful when
	selecting text word-by-word.
	This flag implements Unicode's
	<ulink url="http://www.unicode.org/reports/tr29/">Word
	Boundaries</ulink> semantics.
	(Since: 1.22)
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="pango-shape" role="function">
<title>pango_shape ()</title>
<indexterm zone="pango-shape"><primary sortas="pango_shape">pango_shape</primary></indexterm><programlisting><link linkend="void">void</link>                pango_shape                         (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="gint">gint</link> length,
                                                         const <link linkend="PangoAnalysis">PangoAnalysis</link> *analysis,
                                                         <link linkend="PangoGlyphString">PangoGlyphString</link> *glyphs);</programlisting>
<para>
Given a segment of text and the corresponding
<link linkend="PangoAnalysis"><type>PangoAnalysis</type></link> structure returned from <link linkend="pango-itemize"><function>pango_itemize()</function></link>,
convert the characters into glyphs. You may also pass
in only a substring of the item from <link linkend="pango-itemize"><function>pango_itemize()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara>      the text to process
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&#160;:</term>
<listitem><simpara>    the length (in bytes) of <parameter>text</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>analysis</parameter>&#160;:</term>
<listitem><simpara>  <link linkend="PangoAnalysis"><type>PangoAnalysis</type></link> structure from <link linkend="pango-itemize"><function>pango_itemize()</function></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>glyphs</parameter>&#160;:</term>
<listitem><simpara>    glyph string in which to store results
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
