Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > bf5ad49bf8714f68fa4d0bb1597cb497 > files > 65

cairomm-doc-1.9.8-2.fc15.2.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
        <title>cairomm: Cairo::UserFontFace Class Reference</title>
        <link href="cairomm.css" rel="stylesheet" type="text/css">
    </head>
<body>
<!-- Generated by Doxygen 1.7.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath">
    <ul>
      <li><a class="el" href="namespaceCairo.html">Cairo</a>      </li>
      <li><a class="el" href="classCairo_1_1UserFontFace.html">Cairo::UserFontFace</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a>  </div>
  <div class="headertitle">
<h1>Cairo::UserFontFace Class Reference</h1>  </div>
</div>
<div class="contents">
<!-- doxytag: class="Cairo::UserFontFace" --><!-- doxytag: inherits="Cairo::FontFace" -->
<p>Font support with font data provided by the user.  
<a href="#_details">More...</a></p>

<p>Inherits <a class="el" href="classCairo_1_1FontFace.html">Cairo::FontFace</a>.</p>

<p><a href="classCairo_1_1UserFontFace-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1UserFontFace.html#ae62d6b0a239f47fd67bda4b182187d62">~UserFontFace</a> ()</td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual ErrorStatus&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1UserFontFace.html#af3f1d3a53a7be1d84a20609984473e07">init</a> (const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ScaledFont.html">ScaledFont</a> &gt;&amp; scaled_font, const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1Context.html">Context</a> &gt;&amp; cr, <a class="el" href="namespaceCairo.html#aa7da46c699a67bfbdd5400af7e6b7b39">FontExtents</a>&amp; extents)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is called when a scaled-font needs to be created for a user font-face.  <a href="#af3f1d3a53a7be1d84a20609984473e07"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual ErrorStatus&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1UserFontFace.html#a43cd65b62eab686477d3773e6fd98b46">unicode_to_glyph</a> (const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ScaledFont.html">ScaledFont</a> &gt;&amp; scaled_font, unsigned long unicode, unsigned long&amp; glyph)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is called to convert an input Unicode character to a single glyph.  <a href="#a43cd65b62eab686477d3773e6fd98b46"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual ErrorStatus&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1UserFontFace.html#a2e53435e92f9975213bd19969cb69375">render_glyph</a> (const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ScaledFont.html">ScaledFont</a> &gt;&amp; scaled_font, unsigned long glyph, const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1Context.html">Context</a> &gt;&amp; cr, <a class="el" href="namespaceCairo.html#af6d8a4744616383984c99f8f052c7a5d">TextExtents</a>&amp; metrics)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is called when a user scaled-font needs to render a glyph.  <a href="#a2e53435e92f9975213bd19969cb69375"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual ErrorStatus&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1UserFontFace.html#a467db4c4a08c8cced992045d791e65f2">text_to_glyphs</a> (const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ScaledFont.html">ScaledFont</a> &gt;&amp; scaled_font, const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00237.html">std::string</a>&amp; utf8, <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00640.html">std::vector</a>&lt; <a class="el" href="namespaceCairo.html#a2483f165322e844c095c7be95849fdc2">Glyph</a> &gt;&amp; glyphs, <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00640.html">std::vector</a>&lt; <a class="el" href="namespaceCairo.html#a3c23510889078c8a75d66add004ab288">TextCluster</a> &gt;&amp; clusters, <a class="el" href="namespaceCairo.html#a61b770cf36c555a4098b5428e030542a">TextClusterFlags</a>&amp; cluster_flags)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is called to convert input text to an array of glyphs.  <a href="#a467db4c4a08c8cced992045d791e65f2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCairo_1_1UserFontFace.html#aa63810b6ea9db5b62986e6ce9b7fa13a">UserFontFace</a> ()</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Font support with font data provided by the user. </p>
<p>The user-font feature allows the cairo user to provide drawings for glyphs in a font. This is most useful in implementing fonts in non-standard formats, like SVG fonts and Flash fonts, but can also be used by games and other application to draw "funky" fonts.</p>
<p>To use user fonts, you must derive from this class and implement the virtual functions below. The only virtual function that absolutely must be implemented is <a class="el" href="classCairo_1_1UserFontFace.html#a2e53435e92f9975213bd19969cb69375" title="This function is called when a user scaled-font needs to render a glyph.">render_glyph()</a>. You should make the constructor protected and provide a factory function that returns a new object in a <a class="el" href="classCairo_1_1RefPtr.html" title="RefPtr&lt;&gt; is a reference-counting shared smartpointer.">RefPtr</a> since it is a refcounted object</p>
<div class="fragment"><pre class="fragment"> <span class="keyword">class </span>MyUserFont : <span class="keyword">public</span> <a class="code" href="classCairo_1_1UserFontFace.html#aa63810b6ea9db5b62986e6ce9b7fa13a">UserFontFace</a> {

 <span class="keyword">public</span>:
   <span class="keyword">static</span> <a class="code" href="classCairo_1_1RefPtr.html" title="RefPtr&amp;lt;&amp;gt; is a reference-counting shared smartpointer.">Cairo::RefPtr&lt;MyUserFont&gt;</a> create() {
     <span class="keywordflow">return</span> <a class="code" href="classCairo_1_1RefPtr.html" title="RefPtr&amp;lt;&amp;gt; is a reference-counting shared smartpointer.">Cairo::RefPtr&lt;MyUserFont&gt;</a>(<span class="keyword">new</span> MyUserFont);

 <span class="keyword">protected</span>:
   <span class="comment">// implement render_glyph() and any other virtual functions you want to override</span>
   ErrorStatus <a class="code" href="classCairo_1_1UserFontFace.html#a2e53435e92f9975213bd19969cb69375" title="This function is called when a user scaled-font needs to render a glyph.">render_glyph</a>(<span class="keyword">const</span> RefPtr&lt;ScaledFont&gt;&amp; scaled_font,
                            <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> glyph,
                            <span class="keyword">const</span> RefPtr&lt;Context&gt;&amp; cr,
                            <a class="code" href="namespaceCairo.html#af6d8a4744616383984c99f8f052c7a5d" title="See the cairo_text_extents_t reference in the cairo manual for more information.">TextExtents</a>&amp; metrics) {
     <span class="comment">// render the glyph into cr here</span>
   }

   MyUserFont() : <a class="code" href="classCairo_1_1UserFontFace.html#aa63810b6ea9db5b62986e6ce9b7fa13a">UserFontFace</a>() {
     <span class="comment">// constructor implementation</span>
   }
 };
</pre></div><dl class="warning"><dt><b>Warning:</b></dt><dd>Because of a design flaw in cairomm, it is currently necessary to keep the the <a class="el" href="classCairo_1_1UserFontFace.html" title="Font support with font data provided by the user.">UserFontFace</a> object around until as long as you are rendering text with the user font. The following code illustrates the issue:</dd></dl>
<div class="fragment"><pre class="fragment"> {
   <a class="code" href="classCairo_1_1RefPtr.html" title="RefPtr&amp;lt;&amp;gt; is a reference-counting shared smartpointer.">Cairo::RefPtr&lt;MyUserFont&gt;</a> face = MyUserFont::create();
   cr-&gt;set_font_face(face);
 }  <span class="comment">// scope for demonstration purposes</span>

 <span class="comment">// the following call will cause a crash because your user font is no longer</span>
 <span class="comment">// in scope but it needs to call the virtual functions in face</span>
 cr-&gt;show_text(<span class="stringliteral">&quot;hello, world&quot;</span>);
</pre></div><p>The preceding is obviously a very contrived example, but the important thing to know is that you *must* cache all userfont objects yourself as long as you intend to render text with that font. A future release of cairomm will fix this requirement, but that will require ABI-incompatible changes.</p>
<dl class="since"><dt><b>Since:</b></dt><dd>1.8 </dd></dl>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ae62d6b0a239f47fd67bda4b182187d62"></a><!-- doxytag: member="Cairo::UserFontFace::~UserFontFace" ref="ae62d6b0a239f47fd67bda4b182187d62" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual Cairo::UserFontFace::~UserFontFace </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&#160;)&#160;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="aa63810b6ea9db5b62986e6ce9b7fa13a"></a><!-- doxytag: member="Cairo::UserFontFace::UserFontFace" ref="aa63810b6ea9db5b62986e6ce9b7fa13a" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Cairo::UserFontFace::UserFontFace </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&#160;)&#160;</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="af3f1d3a53a7be1d84a20609984473e07"></a><!-- doxytag: member="Cairo::UserFontFace::init" ref="af3f1d3a53a7be1d84a20609984473e07" args="(const RefPtr&lt; ScaledFont &gt; &amp;scaled_font, const RefPtr&lt; Context &gt; &amp;cr, FontExtents &amp;extents)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual ErrorStatus Cairo::UserFontFace::init </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ScaledFont.html">ScaledFont</a> &gt;&amp;&#160;</td>
          <td class="paramname"> <em>scaled_font</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1Context.html">Context</a> &gt;&amp;&#160;</td>
          <td class="paramname"> <em>cr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceCairo.html#aa7da46c699a67bfbdd5400af7e6b7b39">FontExtents</a>&amp;&#160;</td>
          <td class="paramname"> <em>extents</em></td><td>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function is called when a scaled-font needs to be created for a user font-face. </p>
<p>The <a class="el" href="classCairo_1_1Context.html" title="Context is the main class used to draw in cairomm.">Context</a> <em>cr</em> is not used by the caller, but is prepared in font space, similar to what the cairo contexts passed to the render_glyph method will look like. The callback can use this context for extents computation for example. After the callback is called, <em>cr</em> is checked for any error status.</p>
<p>The <em>extents</em> argument is where the user font sets the font extents for scaled_font. It is in font space, which means that for most cases its ascent and descent members should add to 1.0. <em>extents</em> is preset to hold a value of 1.0 for ascent, height, and max_x_advance, and 0.0 for descent and max_y_advance members.</p>
<p>The default implementation sets the font extents as described in the previous paragraph. If you need different extents, you can override this function in your derived class.</p>
<p>Note that <em>scaled_font</em> is not fully initialized at this point and trying to use it for text operations in the callback will result in deadlock.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>scaled_font</em>&#160;</td><td>the scaled-font being created </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>cr</em>&#160;</td><td>cairo context, in font space </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>extents</em>&#160;</td><td>extents to fill in, in font space </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>CAIRO_STATUS_SUCCESS upon success, or CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.</dd></dl>
<dl class="since"><dt><b>Since:</b></dt><dd>1.8 </dd></dl>

</div>
</div>
<a class="anchor" id="a2e53435e92f9975213bd19969cb69375"></a><!-- doxytag: member="Cairo::UserFontFace::render_glyph" ref="a2e53435e92f9975213bd19969cb69375" args="(const RefPtr&lt; ScaledFont &gt; &amp;scaled_font, unsigned long glyph, const RefPtr&lt; Context &gt; &amp;cr, TextExtents &amp;metrics)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual ErrorStatus Cairo::UserFontFace::render_glyph </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ScaledFont.html">ScaledFont</a> &gt;&amp;&#160;</td>
          <td class="paramname"> <em>scaled_font</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned long&#160;</td>
          <td class="paramname"> <em>glyph</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1Context.html">Context</a> &gt;&amp;&#160;</td>
          <td class="paramname"> <em>cr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceCairo.html#af6d8a4744616383984c99f8f052c7a5d">TextExtents</a>&amp;&#160;</td>
          <td class="paramname"> <em>metrics</em></td><td>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [protected, pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function is called when a user scaled-font needs to render a glyph. </p>
<p>You must implement this in your derived class, and it is expected to draw the glyph with code <em>glyph</em> to the <a class="el" href="classCairo_1_1Context.html" title="Context is the main class used to draw in cairomm.">Context</a> <em>cr</em>. <em>cr</em> is prepared such that the glyph drawing is done in font space. That is, the matrix set on <em>cr</em> is the scale matrix of <em>scaled_font</em>, The <em>extents</em> argument is where the user font sets the font extents for scaled_font. However, if user prefers to draw in user space, they can achieve that by changing the matrix on <em>cr</em>. All cairo rendering operations to <em>cr</em> are permitted, however, the result is undefined if any source other than the default source on <em>cr</em> is used. That means, glyph bitmaps should be rendered using <a class="el" href="classCairo_1_1Context.html#a2ad3ea59afb6bb4fa04d000f5e9c3cf2" title="A drawing operator that paints the current source using the alpha channel of pattern as a mask...">Context::mask()</a> instead of <a class="el" href="classCairo_1_1Context.html#ad919eae3bc3b9827a3c1ceff2d86833e" title="A drawing operator that paints the current source everywhere within the current clip region...">Context::paint()</a>.</p>
<p>Other non-default settings on <em>cr</em> include a font size of 1.0 (given that it is set up to be in font space), and font options corresponding to <em>scaled_font</em>.</p>
<p>The <em>extents</em> argument is preset to have x_bearing, width, and y_advance of zero, y_bearing set to -font_extents.ascent, height to font_extents.ascent+font_extents.descent, and x_advance to font_extents.max_x_advance. The only field user needs to set in majority of cases is x_advance. If the width field is zero upon this function returning (which is its preset value), the glyph extents are automatically computed based on the drawings done to <em>cr</em>. This is in most cases exactly what the desired behavior is. However, if for any reason this function sets the extents, it must be ink extents, and include the extents of all drawing done to <em>cr</em>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>scaled_font</em>&#160;</td><td>user scaled-font </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>glyph</em>&#160;</td><td>glyph code to render </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>cr</em>&#160;</td><td><a class="el" href="classCairo_1_1Context.html" title="Context is the main class used to draw in cairomm.">Context</a> to draw to, in font space </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>extents</em>&#160;</td><td>glyph extents to fill in, in font space </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>CAIRO_STATUS_SUCCESS upon success, or CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.</dd></dl>
<dl class="since"><dt><b>Since:</b></dt><dd>1.8 </dd></dl>

</div>
</div>
<a class="anchor" id="a467db4c4a08c8cced992045d791e65f2"></a><!-- doxytag: member="Cairo::UserFontFace::text_to_glyphs" ref="a467db4c4a08c8cced992045d791e65f2" args="(const RefPtr&lt; ScaledFont &gt; &amp;scaled_font, const std::string &amp;utf8, std::vector&lt; Glyph &gt; &amp;glyphs, std::vector&lt; TextCluster &gt; &amp;clusters, TextClusterFlags &amp;cluster_flags)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual ErrorStatus Cairo::UserFontFace::text_to_glyphs </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ScaledFont.html">ScaledFont</a> &gt;&amp;&#160;</td>
          <td class="paramname"> <em>scaled_font</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00237.html">std::string</a> &amp;&#160;</td>
          <td class="paramname"> <em>utf8</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00640.html">std::vector</a>&lt; <a class="el" href="namespaceCairo.html#a2483f165322e844c095c7be95849fdc2">Glyph</a> &gt;&amp;&#160;</td>
          <td class="paramname"> <em>glyphs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00640.html">std::vector</a>&lt; <a class="el" href="namespaceCairo.html#a3c23510889078c8a75d66add004ab288">TextCluster</a> &gt;&amp;&#160;</td>
          <td class="paramname"> <em>clusters</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceCairo.html#a61b770cf36c555a4098b5428e030542a">TextClusterFlags</a>&amp;&#160;</td>
          <td class="paramname"> <em>cluster_flags</em></td><td>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function is called to convert input text to an array of glyphs. </p>
<p>This is used by the <a class="el" href="classCairo_1_1Context.html#a584596d6f12dbea30519b908cacce038">Context::show_text()</a> operation.</p>
<p>Using this function, the user-font has full control on glyphs and their positions. That means, it allows for features like ligatures and kerning, as well as complex shaping required for scripts like Arabic and Indic.</p>
<p>This function should populate the glyph indices and positions (in font space) assuming that the text is to be shown at the origin.</p>
<p>If clusters is not empty, cluster mapping should be computed.</p>
<p>If you do not override this virtual function in your derived class, the unicode_to_glyph function is used instead.</p>
<p>Note: While cairo does not impose any limitation on glyph indices, some applications may assume that a glyph index fits in a 16-bit unsigned integer. As such, it is advised that user-fonts keep their glyphs in the 0 to 65535 range. Furthermore, some applications may assume that glyph 0 is a special glyph-not-found glyph. User-fonts are advised to use glyph 0 for such purposes and do not use that glyph value for other purposes.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>scaled_font</em>&#160;</td><td>the scaled-font being created </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>utf8</em>&#160;</td><td>a string of text encoded in UTF-8 </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>glyphs</em>&#160;</td><td>array of glyphs to fill, in font space </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>clusters</em>&#160;</td><td>array of cluster mapping information to fill </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>cluster_flags</em>&#160;</td><td>a variable to set the cluster flags corresponding to the output clusters </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>CAIRO_STATUS_SUCCESS upon success, or CAIRO_STATUS_USER_FONT_ERROR or any other error status on error. </dd></dl>
<dl class="since"><dt><b>Since:</b></dt><dd>1.8 </dd></dl>

</div>
</div>
<a class="anchor" id="a43cd65b62eab686477d3773e6fd98b46"></a><!-- doxytag: member="Cairo::UserFontFace::unicode_to_glyph" ref="a43cd65b62eab686477d3773e6fd98b46" args="(const RefPtr&lt; ScaledFont &gt; &amp;scaled_font, unsigned long unicode, unsigned long &amp;glyph)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual ErrorStatus Cairo::UserFontFace::unicode_to_glyph </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classCairo_1_1RefPtr.html">RefPtr</a>&lt; <a class="el" href="classCairo_1_1ScaledFont.html">ScaledFont</a> &gt;&amp;&#160;</td>
          <td class="paramname"> <em>scaled_font</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned long&#160;</td>
          <td class="paramname"> <em>unicode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned long &amp;&#160;</td>
          <td class="paramname"> <em>glyph</em></td><td>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function is called to convert an input Unicode character to a single glyph. </p>
<p>This is used by the <a class="el" href="classCairo_1_1Context.html#a584596d6f12dbea30519b908cacce038">Context::show_text()</a> operation.</p>
<p>This function is used to provide the same functionality as the text_to_glyphs callback does but has much less control on the output, in exchange for increased ease of use. The inherent assumption to using this callback is that each character maps to one glyph, and that the mapping is context independent. It also assumes that glyphs are positioned according to their advance width. These mean no ligatures, kerning, or complex scripts can be implemented using this callback.</p>
<p>The default implementation of this function is an identity mapping from Unicode code-points to glyph indices. If you need different behavior, you may override this virtual function in your derived class.</p>
<p>Note: While cairo does not impose any limitation on glyph indices, some applications may assume that a glyph index fits in a 16-bit unsigned integer. As such, it is advised that user-fonts keep their glyphs in the 0 to 65535 range. Furthermore, some applications may assume that glyph 0 is a special glyph-not-found glyph. User-fonts are advised to use glyph 0 for such purposes and do not use that glyph value for other purposes.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>scaled_font</em>&#160;</td><td>the scaled-font being created </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>unicode</em>&#160;</td><td>input unicode character code-point </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>glyph_index</em>&#160;</td><td>output glyph index </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>CAIRO_STATUS_SUCCESS upon success, or CAIRO_STATUS_USER_FONT_ERROR or any other error status on error. </dd></dl>
<dl class="since"><dt><b>Since:</b></dt><dd>1.8 </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>cairomm/fontface.h</li>
</ul>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Thu Dec 30 2010 22:31:50 for cairomm by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>