pango.LayoutIter

pango.LayoutIter — an object used to iterate over the visual extents of a pango.Layout (new in PyGTK 2.6)

Synopsis

class pango.LayoutIter(gobject.GBoxed):
    def free()
def next_char()
def next_cluster()
def next_line()
def next_run()
def at_last_line()
def get_index()
def get_baseline()
def get_char_extents()
def get_cluster_extents()
def get_layout_extents()
def get_line_extents()
def get_run_extents()
def get_line_yrange()
def get_line()

Ancestry

+-- gobject.GBoxed
  +-- pango.LayoutIter

Description

A pango.LayoutIter object can be used to iterate over the visual elements of a pango.Layout. A pango.LayoutIter is created using the pango.Layout.get_iter() method.

Methods

pango.LayoutIter.free

    def free()

Returns :

a new pango.Layout that is a copy of the layout

Warning

This method is deprecated and should not be used since it may crash your application.

The free() method frees the pango.LayoutIter object.

pango.LayoutIter.next_char

    def next_char()

Returns :

True if the iter was moved.

The next_char() method returns True if the pango.LayoutIter is moved to the next character in visual order. If the iter was already at the end of the layout this method returns False.

pango.LayoutIter.next_cluster

    def next_cluster()

Returns :

True if the iter was moved.

The next_cluster() method returns True if the pango.LayoutIter is moved to the next cluster in visual order. If the iter was already at the end of the layout this method returns False.

pango.LayoutIter.next_line

    def next_line()

Returns :

True if the iter was moved.

The next_line() method returns True if the pango.LayoutIter is moved to the next line in visual order. If the iter was already at the end of the layout this method returns False.

pango.LayoutIter.next_run

    def next_run()

Returns :

True if the iter was moved.

The next_run() method returns True if the pango.LayoutIter is moved to the next run in visual order. If the iter was already at the end of the layout this method returns False.

pango.LayoutIter.at_last_line

    def at_last_line()

Returns :

True if the iter is in the last line.

The at_last_line() method returns True if the pango.LayoutIter points to a position in the last line of the layout.

pango.LayoutIter.get_index

    def get_index()

Returns :

the current byte index

The get_index() 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.

pango.LayoutIter.get_baseline

    def get_baseline()

Returns :

the baseline of the current line.

The get_baseline() method returns the y position of the current line's baseline, in layout coordinates (origin at top left of the entire layout).

pango.LayoutIter.get_char_extents

    def get_char_extents()

Returns :

a 4-tuple containing the logical extents of the character at the iter position.

The get_char_extents() 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.

pango.LayoutIter.get_cluster_extents

    def get_cluster_extents()

Returns :

a 2-tuple containing containing the ink and logical extents as 4-tuples.

The get_cluster_extents() 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.

pango.LayoutIter.get_layout_extents

    def get_layout_extents()

Returns :

a 2-tuple containing containing the ink and logical extents as 4-tuples.

The get_layout_extents() 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.

pango.LayoutIter.get_line_extents

    def get_line_extents()

Returns :

a 2-tuple containing containing the ink and logical extents as 4-tuples.

The get_line_extents() 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.

pango.LayoutIter.get_run_extents

    def get_run_extents()

Returns :

a 2-tuple containing containing the ink and logical extents as 4-tuples.

The get_run_extents() 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.

pango.LayoutIter.get_line_yrange

    def get_line_yrange()

Returns :

a 2-tuple containing the start and end of the layout line.

The get_line_yrange() method returns a 2-tuple containing the start and end y positions of the layout line. The vertical space in the pango.Layout 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 pango.Layout.set_spacing() method has been called to set the layout spacing. The y positions are in layout coordinates (origin at top left of the entire layout).

pango.LayoutIter.get_line

    def get_line()

Returns :

a pango.LayoutLine containing the current line.

Note

This method is available in PyGTK 2.8 and above.

The get_line() method returns a pango.LayoutLine containing the current line.