📄 pango-layout-objects.html
字号:
<a href="pango-Glyph-Storage.html#PangoRectangle">PangoRectangle</a> *ink_rect, <a href="pango-Glyph-Storage.html#PangoRectangle">PangoRectangle</a> *logical_rect);void <a href="pango-Layout-Objects.html#pango-layout-line-get-pixel-extents">pango_layout_line_get_pixel_extents</a> (<a href="pango-Layout-Objects.html#PangoLayoutLine">PangoLayoutLine</a> *layout_line, <a href="pango-Glyph-Storage.html#PangoRectangle">PangoRectangle</a> *ink_rect, <a href="pango-Glyph-Storage.html#PangoRectangle">PangoRectangle</a> *logical_rect);void <a href="pango-Layout-Objects.html#pango-layout-line-index-to-x">pango_layout_line_index_to_x</a> (<a href="pango-Layout-Objects.html#PangoLayoutLine">PangoLayoutLine</a> *line, int index_, <ahref="../glib/glib-Basic-Types.html#gboolean">gboolean</a> trailing, int *x_pos);<ahref="../glib/glib-Basic-Types.html#gboolean">gboolean</a> <a href="pango-Layout-Objects.html#pango-layout-line-x-to-index">pango_layout_line_x_to_index</a> (<a href="pango-Layout-Objects.html#PangoLayoutLine">PangoLayoutLine</a> *line, int x_pos, int *index_, int *trailing);void <a href="pango-Layout-Objects.html#pango-layout-line-get-x-ranges">pango_layout_line_get_x_ranges</a> (<a href="pango-Layout-Objects.html#PangoLayoutLine">PangoLayoutLine</a> *line, int start_index, int end_index, int **ranges, int *n_ranges);</pre></div><div class="refsect1" lang="en"><a name="desc"></a><h2>Description</h2><p>While complete access to the layout capabilities of Pango is providedusing the detailed interfaces for itemization and shaping, usingthat functionality directly involves writing a fairly large amountof code. The objects and functions in this section provide ahigh-level driver for formatting entire paragraphs of textat once.</p></div><div class="refsect1" lang="en"><a name="details"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2839158"></a><h3><a name="PangoLayout"></a>PangoLayout</h3><a class="indexterm" name="id2839170"></a><pre class="programlisting">typedef struct _PangoLayout PangoLayout;</pre><p>The <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> structure represents and entire paragraphof text. It is initialized with a <a href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a>, UTF-8 stringand set of attributes for that string. Once that is done, theset of formatted lines can be extracted from the object,the layout can be rendered, and conversion between logicalcharacter positions within the layout's text, and the physicalposition of the resulting glyphs can be made.</p><p>There are also a number of parameters to adjust the formattingof a <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a>, which are illustrated in <a href="pango-Layout-Objects.html#parameters" title="Figure 1. Adjustable parameters for a PangoLayout">Figure 1, “Adjustable parameters for a PangoLayout”</a>.It is possible, as well, to ignore the 2-D setup, and simplytreat the results of a <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> as a list of lines.</p><div class="figure"><a name="parameters"></a><p class="title"><b>Figure 1. Adjustable parameters for a PangoLayout</b></p><div><img src="layout.gif" alt="Adjustable parameters for a PangoLayout"></div></div><p>The <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> structure is opaque, and has no user-visiblefields.</p></div><hr><div class="refsect2" lang="en"><a name="id2839268"></a><h3><a name="PangoLayoutIter"></a>PangoLayoutIter</h3><a class="indexterm" name="id2839281"></a><pre class="programlisting">typedef struct _PangoLayoutIter PangoLayoutIter;</pre><p>A <a href="pango-Layout-Objects.html#PangoLayoutIter"><span class="type">PangoLayoutIter</span></a> structure can be used toiterate over the visual extents of a <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a>. </p><p>The <a href="pango-Layout-Objects.html#PangoLayoutIter"><span class="type">PangoLayoutIter</span></a> structure is opaque, and has no user-visible fields.</p></div><hr><div class="refsect2" lang="en"><a name="id2839327"></a><h3><a name="pango-layout-new"></a>pango_layout_new ()</h3><a class="indexterm" name="id2839340"></a><pre class="programlisting"><a href="pango-Layout-Objects.html#PangoLayout">PangoLayout</a>* pango_layout_new (<a href="pango-Text-Processing.html#PangoContext">PangoContext</a> *context);</pre><p>Create a new <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> object with attributes initialized todefault values for a particular <a href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>context</code></em> :</span></td><td> a <a href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the newly allocated <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a>, with a reference count of one, which should be freed with <ahref="../gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2839445"></a><h3><a name="pango-layout-copy"></a>pango_layout_copy ()</h3><a class="indexterm" name="id2839459"></a><pre class="programlisting"><a href="pango-Layout-Objects.html#PangoLayout">PangoLayout</a>* pango_layout_copy (<a href="pango-Layout-Objects.html#PangoLayout">PangoLayout</a> *src);</pre><p>Does a deep copy-by-value of the <em class="parameter"><code>src</code></em> layout. The attribute list,tab array, and text from the original layout are all copied byvalue.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>src</code></em> :</span></td><td> a <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the newly allocated <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a>, with a reference count of one, which should be freed with <ahref="../gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2839553"></a><h3><a name="pango-layout-get-context"></a>pango_layout_get_context ()</h3><a class="indexterm" name="id2839566"></a><pre class="programlisting"><a href="pango-Text-Processing.html#PangoContext">PangoContext</a>* pango_layout_get_context (<a href="pango-Layout-Objects.html#PangoLayout">PangoLayout</a> *layout);</pre><p>Retrieves the <a href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a> used for this layout.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>layout</code></em> :</span></td><td> a <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the <a href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a> for the layout. This does nothave an additional refcount added, so if you want to keepa copy of this around, you must reference it yourself.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2839654"></a><h3><a name="pango-layout-context-changed"></a>pango_layout_context_changed ()</h3><a class="indexterm" name="id2839667"></a><pre class="programlisting">void pango_layout_context_changed (<a href="pango-Layout-Objects.html#PangoLayout">PangoLayout</a> *layout);</pre><p>Forces recomputation of any state in the <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> thatmight depend on the layout's context. This function shouldbe called if you make changes to the context subsequentto creating the layout.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>layout</code></em> :</span></td><td> a <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2839735"></a><h3><a name="pango-layout-set-text"></a>pango_layout_set_text ()</h3><a class="indexterm" name="id2839748"></a><pre class="programlisting">void pango_layout_set_text (<a href="pango-Layout-Objects.html#PangoLayout">PangoLayout</a> *layout, const char *text, int length);</pre><p>Sets the text of the layout.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>layout</code></em> :</span></td><td> a <a href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>text</code></em> :</span></td><td> a valid UTF-8 string</td></tr><tr><td><span class="term"><em class="parameter"><code>length</code></em> :</span></td><td> maximum length of <em class="parameter"><code>text</code></em>, in bytes. -1 indicates that the string is nul-terminated and the length should be calculated. The text will also be truncated on encountering a nul-termination even when <em class="parameter"><code>length</code></em> is positive.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2839864"></a><h3><a name="pango-layout-get-text"></a>pango_layout_get_text ()</h3><a class="indexterm" name="id2839878"></a><pre class="programlisting">const char* pango_layout_get_text (<a href="pango-Layout-Objects.html#PangoLayout">PangoLayout</a> *layout);</pre><p>Gets the text in the layout. The returned text should notbe freed or modified.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>layout</code></em> :</span></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -