summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-pangolayoutline.xml
blob: d6efe553dea0453c4d7d2e8a5e97e2251576f8d4 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="class-pangolayoutline">
  <refnamediv>
    <refname>pango.LayoutLine</refname>
    <refpurpose>a line in a <link
linkend="class-pangolayout"><classname>pango.Layout</classname></link>
(new in PyGTK 2.8)</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>pango.LayoutLine</classname></ooclass>
      <ooclass><classname><link
linkend="class-gobjectgboxed">gobject.GBoxed</link></classname></ooclass>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangolayoutline--get-extents">get_extents</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangolayoutline--get-pixel-extents">get_pixel_extents</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangolayoutline--index-to-x">index_to_x</link></methodname>
	<methodparam><parameter role="keyword">index</parameter></methodparam>
	<methodparam><parameter role="keyword">trailing</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangolayoutline--x-to-index">x_to_index</link></methodname>
	<methodparam><parameter role="keyword">x_pos</parameter></methodparam>
      </methodsynopsis>

    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobjectgboxed">gobject.GBoxed</link>
  +-- <link linkend="class-pangolayoutline">pango.LayoutLine</link>
</synopsis>

  </refsect1>

  <refsect1>
    <title>Attributes</title>
 
    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
        <tgroup cols="3">
        <?dbhtml cellpadding="5"?>
          <colspec column="1" colwidth="1in"/>
          <colspec column="2" colwidth="1in"/>
          <colspec column="3" colwidth="4in"/>
          <tbody>
 
            <row valign="top">
              <entry>"is_paragraph_start"</entry>
              <entry>Read</entry>
              <entry><literal>True</literal> if this is the first line of
the paragraph</entry>
            </row>
 
            <row valign="top">
              <entry>"length"</entry>
              <entry>Read</entry>
              <entry>the length of the line in bytes</entry>
            </row>
 
            <row valign="top">
              <entry>"resolved_dir"</entry>
              <entry>Read</entry>
              <entry>the resolved direction of line</entry>
            </row>
 
            <row valign="top">
              <entry>"runs"</entry>
              <entry>Read</entry>
              <entry>a list containing the runs of the line in visual
order.</entry>
            </row>
 
            <row valign="top">
              <entry>"start_index"</entry>
              <entry>Read</entry>
              <entry>the start of the line as byte index into the
layout.</entry>
            </row>
 
        </tbody>
      </tgroup>
      </informaltable>
    </blockquote>
 
  </refsect1>
 
  <refsect1>
    <title>Description</title>

    <para>A <link
linkend="class-pangolayoutline"><classname>pango.LayoutLine</classname></link>
object represents one of the lines resulting from laying out a paragraph via
<link
linkend="class-pangolayout"><classname>pango.Layout</classname></link>. <link
linkend="class-pangolayoutline"><classname>pango.LayoutLine</classname></link>
objects are obtained by calling the <link
linkend="method-pangolayout--get-line"><methodname>pango.Layout.get_line</methodname>()</link>
method or the <link
linkend="method-pangolayoutiter--get-line"><methodname>pango.LayoutIter.get_line</methodname>()</link>
method. <link
linkend="class-pangolayoutline"><classname>pango.LayoutLine</classname></link>
objects are only valid until the text, attributes, or settings of the parent
<link linkend="class-pangolayout"><classname>pango.Layout</classname></link>
are modified.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

  <refsect2 id="method-pangolayoutline--get-extents">
      <title>pango.LayoutLine.get_extents</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_extents</methodname>
       </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a 2-tuple containing 4-tuples representing
the rectangles for the logical and ink extents in Pango
units.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.8 and above.</para>
      </note>

      <para>The <methodname>get_extents</methodname>() method returns the
logical and ink extents rectangles of the layout line in a 2-tuple
containing two 4-tuples which represent the rectangles. See the
documentation for the <link
linkend="method-pangofont--get-glyph-extents"><methodname>pango.Font.get_glyph_extents</methodname>()</link>
method for details about the interpretation of the rectangles. The return
extents are in Pango units (1 device unit = pango.SCALE pango units).</para>

    </refsect2>

  <refsect2 id="method-pangolayoutline--get-pixel-extents">
      <title>pango.LayoutLine.get_pixel_extents</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_pixel_extents</methodname>
        </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a 2-tuple containing 4-tuples representing
the rectangles for the logical and ink extents in device
units.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.8 and above.</para>
      </note>

      <para>The <methodname>get_pixel_extents</methodname>() method returns
the logical and ink extents rectangles of the layout line in a 2-tuple
containing two 4-tuples which represent the rectangles. See the
documentation for the <link
linkend="method-pangofont--get-glyph-extents"><methodname>pango.Font.get_glyph_extents</methodname>()</link>
method for details about the interpretation of the rectangles. The return
extents are in device units (1 device unit = pango.SCALE pango
units).</para>

    </refsect2>

  <refsect2 id="method-pangolayoutline--index-to-x">
      <title>pango.LayoutLine.index_to_x</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>index_to_x</methodname>
          <methodparam><parameter
		       role="keyword">index</parameter></methodparam>
          <methodparam><parameter
		       role="keyword">trailing</parameter></methodparam>
        </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">index</parameter>&nbsp;:</term>
	  <listitem><simpara>the byte offset of a grapheme
within the layout</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">trailing</parameter>&nbsp;:</term>
	  <listitem><simpara>an integer indicating the edge of the grapheme
to retrieve the position of. If 0, the trailing edge of the grapheme,
if > 0, the leading edge of the grapheme.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the X position in Pango units</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.8 and above.</para>
      </note>

      <para>The <methodname>index_to_x</methodname>() method returns the X
position (in Pango units) of the grapheme at the byte offset specified by
<parameter>index</parameter> and edge specified by
<parameter>trailing</parameter>.</para>

    </refsect2>

  <refsect2 id="method-pangolayoutline--x-to-index">
      <title>pango.LayoutLine.x_to_index</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>x_to_index</methodname>
          <methodparam><parameter
		       role="keyword">x_pos</parameter></methodparam>
        </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">x_pos</parameter>&nbsp;:</term>
	  <listitem><simpara>the x offset (in Pango units) from the left
edge of the line.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a 3-tuple containing a boolean indicating if the
<parameter>x_pos</parameter> is inside the line, the byte offset of the
grapheme and the location in the grapheme.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.8 and above.</para>
      </note>

      <para>The <methodname>x_to_index</methodname>() method returns a
3-tuple containing a boolean that is <literal>True</literal> if x_pos is
inside the line, the location inside the grapheme - either zero, or the
number of characters in the grapheme. 0 represents the trailing edge of the
grapheme.</para>

    </refsect2>

  </refsect1>

</refentry>