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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>pango.LayoutIter</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="pango-class-reference.html" title="The pango Class Reference"><link rel="previous" href="class-pangolayout.html" title="pango.Layout"><link rel="next" href="class-pangotabarray.html" title="pango.TabArray"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">pango.LayoutIter</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-pangolayout.html">Prev</a></td><th width="60%" align="center">The pango Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-pangotabarray.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-pangolayoutiter"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>pango.LayoutIter</h2><p>pango.LayoutIter — an object used to iterate over the visual extents of a
<a href="class-pangolayout.html" title="pango.Layout"><tt class="classname">pango.Layout</tt></a>
(new in PyGTK 2.6)</p></div><div class="refsect1" lang="en"><a name="id3136518"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">pango.LayoutIter</span></span>(<span class="ooclass"><span class="classname"><a href="class-gobjectgboxed.html" title="gobject.GBoxed">gobject.GBoxed</a></span></span>):
<code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--free" title="pango.LayoutIter.free">free</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--next-char" title="pango.LayoutIter.next_char">next_char</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--next-cluster" title="pango.LayoutIter.next_cluster">next_cluster</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--next-line" title="pango.LayoutIter.next_line">next_line</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--next-run" title="pango.LayoutIter.next_run">next_run</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--at-last-line" title="pango.LayoutIter.at_last_line">at_last_line</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--get-index" title="pango.LayoutIter.get_index">get_index</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--get-baseline" title="pango.LayoutIter.get_baseline">get_baseline</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--get-char-extents" title="pango.LayoutIter.get_char_extents">get_char_extents</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--get-cluster-extents" title="pango.LayoutIter.get_cluster_extents">get_cluster_extents</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--get-layout-extents" title="pango.LayoutIter.get_layout_extents">get_layout_extents</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--get-line-extents" title="pango.LayoutIter.get_line_extents">get_line_extents</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--get-run-extents" title="pango.LayoutIter.get_run_extents">get_run_extents</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangolayoutiter.html#method-pangolayoutiter--get-line-yrange" title="pango.LayoutIter.get_line_yrange">get_line_yrange</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3225842"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobjectgboxed.html" title="gobject.GBoxed">gobject.GBoxed</a>
+-- <a href="class-pangolayoutiter.html" title="pango.LayoutIter">pango.LayoutIter</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id2943529"></a><h2>Description</h2><p>A <a href="class-pangolayoutiter.html" title="pango.LayoutIter"><tt class="classname">pango.LayoutIter</tt></a>
object can be used to iterate over the visual elements of a <a href="class-pangolayout.html" title="pango.Layout"><tt class="classname">pango.Layout</tt></a>. A
<a href="class-pangolayoutiter.html" title="pango.LayoutIter"><tt class="classname">pango.LayoutIter</tt></a>
is created using the <a href="class-pangolayout.html#method-pangolayout--get-iter" title="pango.Layout.get_iter"><tt class="methodname">pango.Layout.get_iter</tt>()</a>
method.</p></div><div class="refsect1" lang="en"><a name="id2970090"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-pangolayoutiter--free"></a><h3>pango.LayoutIter.free</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">free</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-pangolayout.html" title="pango.Layout"><tt class="classname">pango.Layout</tt></a> that
is a copy of the layout</td></tr></tbody></table><p>The <tt class="methodname">free</tt>() method frees the <a href="class-pangolayoutiter.html" title="pango.LayoutIter"><tt class="classname">pango.LayoutIter</tt></a>
object.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--next-char"></a><h3>pango.LayoutIter.next_char</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">next_char</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if the iter was
moved.</td></tr></tbody></table><p>The <tt class="methodname">next_char</tt>() method returns
<tt class="literal">TRUE</tt> if the <a href="class-pangolayoutiter.html" title="pango.LayoutIter"><tt class="classname">pango.LayoutIter</tt></a>
is moved to the next character in visual order. If the iter was already at
the end of the layout this method returns <tt class="literal">FALSE</tt>.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--next-cluster"></a><h3>pango.LayoutIter.next_cluster</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">next_cluster</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if the iter was
moved.</td></tr></tbody></table><p>The <tt class="methodname">next_cluster</tt>() method returns
<tt class="literal">TRUE</tt> if the <a href="class-pangolayoutiter.html" title="pango.LayoutIter"><tt class="classname">pango.LayoutIter</tt></a>
is moved to the next cluster in visual order. If the iter was already at the
end of the layout this method returns <tt class="literal">FALSE</tt>.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--next-line"></a><h3>pango.LayoutIter.next_line</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">next_line</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if the iter was
moved.</td></tr></tbody></table><p>The <tt class="methodname">next_line</tt>() method returns
<tt class="literal">TRUE</tt> if the <a href="class-pangolayoutiter.html" title="pango.LayoutIter"><tt class="classname">pango.LayoutIter</tt></a>
is moved to the next line in visual order. If the iter was already at the
end of the layout this method returns <tt class="literal">FALSE</tt>.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--next-run"></a><h3>pango.LayoutIter.next_run</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">next_run</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if the iter was
moved.</td></tr></tbody></table><p>The <tt class="methodname">next_run</tt>() method returns
<tt class="literal">TRUE</tt> if the <a href="class-pangolayoutiter.html" title="pango.LayoutIter"><tt class="classname">pango.LayoutIter</tt></a>
is moved to the next run in visual order. If the iter was already at the end
of the layout this method returns <tt class="literal">FALSE</tt>.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--at-last-line"></a><h3>pango.LayoutIter.at_last_line</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">at_last_line</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if the iter is in the
last line.</td></tr></tbody></table><p>The <tt class="methodname">at_last_line</tt>() method returns
<tt class="literal">TRUE</tt> if the <a href="class-pangolayoutiter.html" title="pango.LayoutIter"><tt class="classname">pango.LayoutIter</tt></a>
points to a position in the last line of the layout.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--get-index"></a><h3>pango.LayoutIter.get_index</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_index</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the current byte index</td></tr></tbody></table><p>The <tt class="methodname">get_index</tt>() method returns the
current byte index. Note that iterating forward by char moves in visual
order, not logical order, so indexes may not be sequential. Also, the index
may be equal to the length of the text in the layout.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--get-baseline"></a><h3>pango.LayoutIter.get_baseline</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_baseline</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the baseline of the current
line.</td></tr></tbody></table><p>The <tt class="methodname">get_baseline</tt>() method returns the y
position of the current line's baseline, in layout coordinates (origin at
top left of the entire layout).</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--get-char-extents"></a><h3>pango.LayoutIter.get_char_extents</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_char_extents</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 4-tuple containing the logical extents of the
character at the iter position.</td></tr></tbody></table><p>The <tt class="methodname">get_char_extents</tt>() method returns a
4-tuple (x, y, width, height) containing the logical extents of the current
character, in layout coordinates (origin is the top left of the entire
layout). Only logical extents can sensibly be obtained for characters; ink
extents make sense only down to the level of clusters.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--get-cluster-extents"></a><h3>pango.LayoutIter.get_cluster_extents</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_cluster_extents</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 2-tuple containing containing the
ink and logical extents as 4-tuples.</td></tr></tbody></table><p>The <tt class="methodname">get_cluster_extents</tt>() method
returns a 2-tuple containing the ink and logical extents (as 4-tuples: x, y,
width, height) of the cluster at the iter position.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--get-layout-extents"></a><h3>pango.LayoutIter.get_layout_extents</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_layout_extents</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 2-tuple containing containing the
ink and logical extents as 4-tuples.</td></tr></tbody></table><p>The <tt class="methodname">get_layout_extents</tt>() method returns
a 2-tuple containing the ink and logical extents (as 4-tuples: x, y, width,
height) of the layout at the iter position.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--get-line-extents"></a><h3>pango.LayoutIter.get_line_extents</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_line_extents</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 2-tuple containing containing the
ink and logical extents as 4-tuples.</td></tr></tbody></table><p>The <tt class="methodname">get_line_extents</tt>() method returns a
2-tuple containing the ink and logical extents (as 4-tuples: x, y, width,
height) of the line at the iter position.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--get-run-extents"></a><h3>pango.LayoutIter.get_run_extents</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_run_extents</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 2-tuple containing containing the
ink and logical extents as 4-tuples.</td></tr></tbody></table><p>The <tt class="methodname">get_run_extents</tt>() method returns a
2-tuple containing the ink and logical extents (as 4-tuples: x, y, width,
height) of the run at the iter position.</p></div><div class="refsect2" lang="en"><a name="method-pangolayoutiter--get-line-yrange"></a><h3>pango.LayoutIter.get_line_yrange</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_line_yrange</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 2-tuple containing the start and end of the
layout line.</td></tr></tbody></table><p>The <tt class="methodname">get_line_yrange</tt>() method returns a
2-tuple containing the start and end y positions of the layout line. The
vertical space in the <a href="class-pangolayout.html" title="pango.Layout"><tt class="classname">pango.Layout</tt></a>
associated with the iter is devided between the lines in the layout, the
space belonging to the current line is returned in the 2-tuple. A line's
range includes the line's logical extents, plus half of the spacing above
and below the line, if the <a href="class-pangolayout.html#method-pangolayout--set-spacing" title="pango.Layout.set_spacing"><tt class="methodname">pango.Layout.set_spacing</tt>()</a>
method has been called to set the layout spacing. The y positions are in layout
coordinates (origin at top left of the entire layout).</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-pangolayout.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="pango-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-pangotabarray.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">pango.Layout</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">pango.TabArray</td></tr></table></div></body></html>
|