pango.LayoutLine
Prev | The pango Class Reference | Next

## pango.LayoutLine

pango.LayoutLine — a line in a `pango.Layout` (new in PyGTK 2.8)

## Synopsis

    class pango.LayoutLine(gobject.GBoxed):
        def get_extents()
        def get_pixel_extents()
        def index_to_x(index, trailing)
        def x_to_index(x_pos)

## Ancestry

    +-- gobject.GBoxed
      +-- pango.LayoutLine

## Attributes

"is_paragraph_start" | Read | `True` if this is the first line of the paragraph
"length" | Read | the length of the line in bytes
"resolved_dir" | Read | the resolved direction of line
"runs" | Read | a list containing the runs of the line in visual order.
"start_index" | Read | the start of the line as byte index into the layout.

## Description

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.

## Methods

### pango.LayoutLine.get_extents

        def get_extents()

Returns : | a 2-tuple containing 4-tuples representing the rectangles for the logical and ink extents in Pango units.

### Note

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).

### pango.LayoutLine.get_pixel_extents

        def get_pixel_extents()

Returns : | a 2-tuple containing 4-tuples representing the rectangles for the logical and ink extents in device units.

### Note

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).

### pango.LayoutLine.index_to_x

        def index_to_x(index, trailing)

`index` : | the byte offset of a grapheme within the layout
`trailing` : | 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

### Note

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`.

### pango.LayoutLine.x_to_index

        def x_to_index(x_pos)

`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.

### Note

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.

Prev | Up | Next
pango.LayoutIter | Home | pango.Renderer