Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Pango::LayoutIter Class Reference

A PangoLayoutIter C++ wrapper class. More...

`#include <inti/pango/layout.h>`

Inheritance diagram for Inti::Pango::LayoutIter:

List of all members.

## Public Member Functions

Constructors

- LayoutIter (PangoLayoutIter *iter)
    Construct a new LayoutIter from an existing PangoLayoutIter.
- ~LayoutIter ()
    Destructor.

Accessors

- PangoLayoutIter * pango_layout_iter () const
    Get a pointer to the PangoLayoutIter structure.
- operator PangoLayoutIter * () const
    Conversion operator; safely converts a LayoutIter to a PangoLayoutIter pointer.
- int get_index () const
    Gets the current byte index.
- LayoutRun * get_run () const
    Gets the current run.
- Pointer< LayoutLine > get_line () const
    Returns a smart pointer to the current line.
- bool at_last_line () const
    Returns true if the iterator is on the last line of the layout.
- void get_char_extents (Rectangle &logical_rect) const
    Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).
- Rectangle get_char_extents () const
    Returns the extents of the current character, in layout coordinates (see get_char_extents(Rectangle&) const).
- void get_cluster_extents (Rectangle *ink_rect, Rectangle *logical_rect) const
    Gets the extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
- void get_run_extents (Rectangle *ink_rect, Rectangle *logical_rect) const
    Gets the extents of the current run in layout coordinates (origin is the top left of the entire layout).
- void get_line_extents (Rectangle *ink_rect, Rectangle *logical_rect) const
    Obtains the extents of the current line.
- void get_line_yrange (int *y0, int *y1) const
    Divides the vertical space in the Layout being iterated over between the lines in the layout, and returns the space belonging to the current line.
- void get_layout_extents (Rectangle *ink_rect, Rectangle *logical_rect) const
    Obtains the extents of the Layout being iterated over.
- int get_baseline () const
    Gets the y position of the current line's baseline, in layout coordinates (origin at top left of the entire layout).

Methods

- bool next_char ()
    Moves the iterator forward to the next character in visual order.
- bool next_cluster ()
    Moves the iterator forward to the next cluster in visual order.
- bool next_run ()
    Moves the iterator forward to the next run in visual order.
- bool next_line ()
    Moves the iterator forward to the next line in visual order.

## Detailed Description

A PangoLayoutIter C++ wrapper class.

LayoutIter can be used to iterate over the visual extents of a Layout.

## Constructor & Destructor Documentation

Inti::Pango::LayoutIter::LayoutIter | ( | PangoLayoutIter * | iter | ) | `[explicit]`

Construct a new LayoutIter from an existing PangoLayoutIter.

Parameters:

  iter | A pointer to a PangoLayoutIter.

LayoutIter takes over the ownership of PangoLayoutIter and frees it when it's no longer required.

## Member Function Documentation

int Inti::Pango::LayoutIter::get_baseline | ( |  | ) | const

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

Returns:
  The baseline of the current line.

void Inti::Pango::LayoutIter::get_char_extents | ( | Rectangle & | logical_rect | ) | const

Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).

Parameters:

  logical_rect | The rectangle to fill with logical extents.

Only logical extents can sensibly be obtained for characters; ink extents make sense only down to the level of clusters.

Parameters:

  logical_rect | The rectangle to fill with logical extents.

void Inti::Pango::LayoutIter::get_cluster_extents | ( | Rectangle * | ink_rect,
|  | Rectangle * | logical_rect
| ) | const

Gets the extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).

Parameters:

  ink_rect | The rectangle to fill with the ink extents.
  logical_rect | The rectangle to fill with the logical extents.

int Inti::Pango::LayoutIter::get_index | ( |  | ) | const

Gets the current byte index.

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, if on the null run (see get_run()).

void Inti::Pango::LayoutIter::get_layout_extents | ( | Rectangle * | ink_rect,
|  | Rectangle * | logical_rect
| ) | const

Obtains the extents of the Layout being iterated over.

Parameters:

  ink_rect | The rectangle to fill with the ink extents.
  logical_rect | The rectangle to fill with the logical extents.

ink_rect or logical_rect can be null if you aren't interested in them.

void Inti::Pango::LayoutIter::get_line_extents | ( | Rectangle * | ink_rect,
|  | Rectangle * | logical_rect
| ) | const

Obtains the extents of the current line.

Parameters:

  ink_rect | The rectangle to fill with the ink extents.
  logical_rect | The rectangle to fill with the logical extents.

ink_rect or logical_rect can be null if you aren't interested in them. Extents are in layout coordinates (origin is the top-left corner of the entire Layout). Thus the extents returned by this method will be the same width/height but not at the same x/y as the extents returned from Pango::LayoutLine::get_extents().

void Inti::Pango::LayoutIter::get_line_yrange | ( | int * | y0,
|  | int * | y1
| ) | const

Divides the vertical space in the Layout being iterated over between the lines in the layout, and returns the space belonging to the current line.

Parameters:

  y0 | The start of the line.
  y1 | The end of the line.

A line's range includes the line's logical extents, plus half of the spacing above and below the line, if Pango::Layout::set_spacing() has been called to set layout spacing. The y positions are in layout coordinates (origin at top left of the entire layout).

LayoutRun* Inti::Pango::LayoutIter::get_run | ( |  | ) | const

Gets the current run.

Returns:
  The current run.

When iterating by run, at the end of each line, there's a position with a null run, so this method can return null. The null run at the end of each line ensures that all lines have at least one run, even lines consisting of only a newline.

void Inti::Pango::LayoutIter::get_run_extents | ( | Rectangle * | ink_rect,
|  | Rectangle * | logical_rect
| ) | const

Gets the extents of the current run in layout coordinates (origin is the top left of the entire layout).

Parameters:

  ink_rect | The rectangle to fill with the ink extents.
  logical_rect | The rectangle to fill with the logical extents.

bool Inti::Pango::LayoutIter::next_char | ( |  | ) |

Moves the iterator forward to the next character in visual order.

Returns:
  Whether motion was possible.

If the iterator was already at the end of the layout, false is returned.

bool Inti::Pango::LayoutIter::next_cluster | ( |  | ) |

Moves the iterator forward to the next cluster in visual order.

Returns:
  Whether motion was possible.

If the iterator was already at the end of the layout, false is returned.

bool Inti::Pango::LayoutIter::next_line | ( |  | ) |

Moves the iterator forward to the next line in visual order.

Returns:
  Whether motion was possible.

If the iterator was already at the end of the layout, false is returned.

bool Inti::Pango::LayoutIter::next_run | ( |  | ) |

Moves the iterator forward to the next run in visual order.

Returns:
  Whether motion was possible.

If the iterator was already at the end of the layout, false is returned.

The documentation for this class was generated from the following file:

- pango/layout.h

Main Page - Footer