pango.LayoutLine — a line in a pango.Layout
(new in PyGTK 2.8)
class pango.LayoutLine( |
|
A pango.LayoutLine
object represents one of the lines resulting from laying out a paragraph via
pango.Layout
. pango.LayoutLine
objects are obtained by calling the pango.Layout.get_line
()
method or the pango.LayoutIter.get_line
()
method. pango.LayoutLine
objects are only valid until the text, attributes, or settings of the parent
pango.Layout
are modified.
def get_extents()
Returns : | a 2-tuple containing 4-tuples representing the rectangles for the logical and ink extents in Pango units. |
This method is available in PyGTK 2.8 and above.
The get_extents
() 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 pango.Font.get_glyph_extents
()
method for details about the interpretation of the rectangles. The return
extents are in Pango units (1 device unit = pango.SCALE pango units).
def get_pixel_extents()
Returns : | a 2-tuple containing 4-tuples representing the rectangles for the logical and ink extents in device units. |
This method is available in PyGTK 2.8 and above.
The get_pixel_extents
() 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 pango.Font.get_glyph_extents
()
method for details about the interpretation of the rectangles. The return
extents are in device units (1 device unit = pango.SCALE pango
units).
def index_to_x(index
, trailing
)
| the byte offset of a grapheme within the layout |
| 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. |
Returns : | the X position in Pango units |
This method is available in PyGTK 2.8 and above.
The index_to_x
() method returns the X
position (in Pango units) of the grapheme at the byte offset specified by
index
and edge specified by
trailing
.
def x_to_index(x_pos
)
| the x offset (in Pango units) from the left edge of the line. |
Returns : | a 3-tuple containing a boolean indicating if the
x_pos is inside the line, the byte offset of the
grapheme and the location in the grapheme. |
This method is available in PyGTK 2.8 and above.
The x_to_index
() method returns a
3-tuple containing a boolean that is True
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.