diff options
Diffstat (limited to 'doc/public/html/cairo-cairo-scaled-font-t.html')
-rw-r--r-- | doc/public/html/cairo-cairo-scaled-font-t.html | 209 |
1 files changed, 61 insertions, 148 deletions
diff --git a/doc/public/html/cairo-cairo-scaled-font-t.html b/doc/public/html/cairo-cairo-scaled-font-t.html index 54f1919..83c974b 100644 --- a/doc/public/html/cairo-cairo-scaled-font-t.html +++ b/doc/public/html/cairo-cairo-scaled-font-t.html @@ -544,176 +544,89 @@ array was large enough. In the simplest case, <em class="parameter"><code>glyphs</code></em> and <em class="parameter"><code>clusters</code></em> can point to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> initially and a suitable array will be allocated. In code: </p> -<div class="informalexample"> - <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> - <tbody> - <tr> - <td class="listing_lines" align="right"><pre>1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23</pre></td> - <td class="listing_code"><pre class="programlisting"><span class="usertype">cairo_status_t</span><span class="normal"> status</span><span class="symbol">;</span> +<div class="informalexample"><pre class="programlisting"> +cairo_status_t status; -<span class="usertype">cairo_glyph_t</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">glyphs </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span> -<span class="type">int</span><span class="normal"> num_glyphs</span><span class="symbol">;</span> -<span class="usertype">cairo_text_cluster_t</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">clusters </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span> -<span class="type">int</span><span class="normal"> num_clusters</span><span class="symbol">;</span> -<span class="usertype">cairo_text_cluster_flags_t</span><span class="normal"> cluster_flags</span><span class="symbol">;</span> +cairo_glyph_t *glyphs = NULL; +int num_glyphs; +cairo_text_cluster_t *clusters = NULL; +int num_clusters; +cairo_text_cluster_flags_t cluster_flags; -<span class="normal">status </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-scaled-font-t.html#cairo-scaled-font-text-to-glyphs">cairo_scaled_font_text_to_glyphs</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">scaled_font</span><span class="symbol">,</span> -<span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">,</span> -<span class="normal"> utf8</span><span class="symbol">,</span><span class="normal"> utf8_len</span><span class="symbol">,</span> -<span class="normal"> </span><span class="symbol">&</span><span class="normal">glyphs</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">num_glyphs</span><span class="symbol">,</span> -<span class="normal"> </span><span class="symbol">&</span><span class="normal">clusters</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">num_clusters</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">cluster_flags</span><span class="symbol">);</span> +status = cairo_scaled_font_text_to_glyphs (scaled_font, + x, y, + utf8, utf8_len, + &glyphs, &num_glyphs, + &clusters, &num_clusters, &cluster_flags); -<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">status </span><span class="symbol">==</span><span class="normal"> <a href="/usr/share/gtk-doc/html/cairo/cairo-Error-handling.html#CAIRO-STATUS-SUCCESS:CAPS">CAIRO_STATUS_SUCCESS</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span> -<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-text.html#cairo-show-text-glyphs">cairo_show_text_glyphs</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cr</span><span class="symbol">,</span> -<span class="normal"> utf8</span><span class="symbol">,</span><span class="normal"> utf8_len</span><span class="symbol">,</span> -<span class="normal"> glyphs</span><span class="symbol">,</span><span class="normal"> num_glyphs</span><span class="symbol">,</span> -<span class="normal"> clusters</span><span class="symbol">,</span><span class="normal"> num_clusters</span><span class="symbol">,</span><span class="normal"> cluster_flags</span><span class="symbol">);</span> - -<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-text.html#cairo-glyph-free">cairo_glyph_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">glyphs</span><span class="symbol">);</span> -<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-text.html#cairo-text-cluster-free">cairo_text_cluster_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">clusters</span><span class="symbol">);</span> -<span class="cbracket">}</span></pre></td> - </tr> - </tbody> - </table> -</div> +if (status == CAIRO_STATUS_SUCCESS) { + cairo_show_text_glyphs (cr, + utf8, utf8_len, + glyphs, num_glyphs, + clusters, num_clusters, cluster_flags); + cairo_glyph_free (glyphs); + cairo_text_cluster_free (clusters); +} +</pre></div> <p> </p> <p> If no cluster mapping is needed: </p> -<div class="informalexample"> - <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> - <tbody> - <tr> - <td class="listing_lines" align="right"><pre>1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16</pre></td> - <td class="listing_code"><pre class="programlisting"><span class="usertype">cairo_status_t</span><span class="normal"> status</span><span class="symbol">;</span> - -<span class="usertype">cairo_glyph_t</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">glyphs </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span> -<span class="type">int</span><span class="normal"> num_glyphs</span><span class="symbol">;</span> +<div class="informalexample"><pre class="programlisting"> +cairo_status_t status; -<span class="normal">status </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-scaled-font-t.html#cairo-scaled-font-text-to-glyphs">cairo_scaled_font_text_to_glyphs</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">scaled_font</span><span class="symbol">,</span> -<span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">,</span> -<span class="normal"> utf8</span><span class="symbol">,</span><span class="normal"> utf8_len</span><span class="symbol">,</span> -<span class="normal"> </span><span class="symbol">&</span><span class="normal">glyphs</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">num_glyphs</span><span class="symbol">,</span> -<span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span> -<span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span> +cairo_glyph_t *glyphs = NULL; +int num_glyphs; -<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">status </span><span class="symbol">==</span><span class="normal"> <a href="/usr/share/gtk-doc/html/cairo/cairo-Error-handling.html#CAIRO-STATUS-SUCCESS:CAPS">CAIRO_STATUS_SUCCESS</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span> -<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-text.html#cairo-show-glyphs">cairo_show_glyphs</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cr</span><span class="symbol">,</span><span class="normal"> glyphs</span><span class="symbol">,</span><span class="normal"> num_glyphs</span><span class="symbol">);</span> -<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-text.html#cairo-glyph-free">cairo_glyph_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">glyphs</span><span class="symbol">);</span> -<span class="cbracket">}</span></pre></td> - </tr> - </tbody> - </table> -</div> +status = cairo_scaled_font_text_to_glyphs (scaled_font, + x, y, + utf8, utf8_len, + &glyphs, &num_glyphs, + NULL, NULL, + NULL); +if (status == CAIRO_STATUS_SUCCESS) { + cairo_show_glyphs (cr, glyphs, num_glyphs); + cairo_glyph_free (glyphs); +} +</pre></div> <p> </p> <p> If stack-based glyph and cluster arrays are to be used for small arrays: </p> -<div class="informalexample"> - <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> - <tbody> - <tr> - <td class="listing_lines" align="right"><pre>1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27</pre></td> - <td class="listing_code"><pre class="programlisting"><span class="usertype">cairo_status_t</span><span class="normal"> status</span><span class="symbol">;</span> - -<span class="usertype">cairo_glyph_t</span><span class="normal"> stack_glyphs</span><span class="symbol">[</span><span class="number">40</span><span class="symbol">];</span> -<span class="usertype">cairo_glyph_t</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">glyphs </span><span class="symbol">=</span><span class="normal"> stack_glyphs</span><span class="symbol">;</span> -<span class="type">int</span><span class="normal"> num_glyphs </span><span class="symbol">=</span><span class="normal"> </span><span class="keyword">sizeof</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">stack_glyphs</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> </span><span class="keyword">sizeof</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">stack_glyphs</span><span class="symbol">[</span><span class="number">0</span><span class="symbol">]);</span> -<span class="usertype">cairo_text_cluster_t</span><span class="normal"> stack_clusters</span><span class="symbol">[</span><span class="number">40</span><span class="symbol">];</span> -<span class="usertype">cairo_text_cluster_t</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">clusters </span><span class="symbol">=</span><span class="normal"> stack_clusters</span><span class="symbol">;</span> -<span class="type">int</span><span class="normal"> num_clusters </span><span class="symbol">=</span><span class="normal"> </span><span class="keyword">sizeof</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">stack_clusters</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> </span><span class="keyword">sizeof</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">stack_clusters</span><span class="symbol">[</span><span class="number">0</span><span class="symbol">]);</span> -<span class="usertype">cairo_text_cluster_flags_t</span><span class="normal"> cluster_flags</span><span class="symbol">;</span> +<div class="informalexample"><pre class="programlisting"> +cairo_status_t status; -<span class="normal">status </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-scaled-font-t.html#cairo-scaled-font-text-to-glyphs">cairo_scaled_font_text_to_glyphs</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">scaled_font</span><span class="symbol">,</span> -<span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">,</span> -<span class="normal"> utf8</span><span class="symbol">,</span><span class="normal"> utf8_len</span><span class="symbol">,</span> -<span class="normal"> </span><span class="symbol">&</span><span class="normal">glyphs</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">num_glyphs</span><span class="symbol">,</span> -<span class="normal"> </span><span class="symbol">&</span><span class="normal">clusters</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">num_clusters</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">cluster_flags</span><span class="symbol">);</span> +cairo_glyph_t stack_glyphs[40]; +cairo_glyph_t *glyphs = stack_glyphs; +int num_glyphs = sizeof (stack_glyphs) / sizeof (stack_glyphs[0]); +cairo_text_cluster_t stack_clusters[40]; +cairo_text_cluster_t *clusters = stack_clusters; +int num_clusters = sizeof (stack_clusters) / sizeof (stack_clusters[0]); +cairo_text_cluster_flags_t cluster_flags; -<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">status </span><span class="symbol">==</span><span class="normal"> <a href="/usr/share/gtk-doc/html/cairo/cairo-Error-handling.html#CAIRO-STATUS-SUCCESS:CAPS">CAIRO_STATUS_SUCCESS</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span> -<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-text.html#cairo-show-text-glyphs">cairo_show_text_glyphs</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cr</span><span class="symbol">,</span> -<span class="normal"> utf8</span><span class="symbol">,</span><span class="normal"> utf8_len</span><span class="symbol">,</span> -<span class="normal"> glyphs</span><span class="symbol">,</span><span class="normal"> num_glyphs</span><span class="symbol">,</span> -<span class="normal"> clusters</span><span class="symbol">,</span><span class="normal"> num_clusters</span><span class="symbol">,</span><span class="normal"> cluster_flags</span><span class="symbol">);</span> +status = cairo_scaled_font_text_to_glyphs (scaled_font, + x, y, + utf8, utf8_len, + &glyphs, &num_glyphs, + &clusters, &num_clusters, &cluster_flags); -<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">glyphs </span><span class="symbol">!=</span><span class="normal"> stack_glyphs</span><span class="symbol">)</span> -<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-text.html#cairo-glyph-free">cairo_glyph_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">glyphs</span><span class="symbol">);</span> -<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">clusters </span><span class="symbol">!=</span><span class="normal"> stack_clusters</span><span class="symbol">)</span> -<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-text.html#cairo-text-cluster-free">cairo_text_cluster_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">clusters</span><span class="symbol">);</span> -<span class="cbracket">}</span></pre></td> - </tr> - </tbody> - </table> -</div> +if (status == CAIRO_STATUS_SUCCESS) { + cairo_show_text_glyphs (cr, + utf8, utf8_len, + glyphs, num_glyphs, + clusters, num_clusters, cluster_flags); + if (glyphs != stack_glyphs) + cairo_glyph_free (glyphs); + if (clusters != stack_clusters) + cairo_text_cluster_free (clusters); +} +</pre></div> <p> </p> <p> |