pangomm 2.56.2

Public Member Functions | Static Public Member Functions | Protected Attributes | Related Symbols | List of all members
Pango::LayoutIter Class Reference

A Pango::LayoutIter can be used to iterate over the visual extents of a Pango::Layout. More...

`#include <pangomm/layoutiter.h>`

## Public Member Functions
| LayoutIter ()
| LayoutIter (PangoLayoutIter * gobject, bool make_a_copy=true)
| LayoutIter (const LayoutIter & other)
LayoutIter & | operator= (const LayoutIter & other)
| LayoutIter (LayoutIter && other) noexcept
LayoutIter & | operator= (LayoutIter && other) noexcept
| ~LayoutIter () noexcept
void | swap (LayoutIter & other) noexcept
PangoLayoutIter * | gobj ()
| Provides access to the underlying C instance.
const PangoLayoutIter * | gobj () const
| Provides access to the underlying C instance.
PangoLayoutIter * | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
| operator bool () const
| Checks whether this iterator is valid.
int | get_index () const
| Gets the current byte index.
GlyphItem | get_run () const
| Gets the current run.
Glib::RefPtr< LayoutLine > | get_line ()
| Gets the current line.
Glib::RefPtr< const LayoutLine > | get_line () const
| Gets the current line for read-only access.
Glib::RefPtr< const LayoutLine > | get_const_line () const
| Gets the current line for read-only access.
bool | at_last_line () const
| Determines whether iter is on the last line of the layout.
Glib::RefPtr< Layout > | get_layout ()
| Gets the layout associated with a Pango::LayoutIter.
Glib::RefPtr< const Layout > | get_layout () const
| Gets the layout associated with a Pango::LayoutIter.
bool | next_char ()
| Moves iter forward to the next character in visual order.
bool | next_cluster ()
| Moves iter forward to the next cluster in visual order.
bool | next_run ()
| Moves iter forward to the next run in visual order.
bool | next_line ()
| Moves iter forward to the start of the next line.
Rectangle | get_char_extents () const
| Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).
void | get_cluster_extents (Rectangle & ink_rect, Rectangle & logical_rect) const
| Gets the extents of the current cluster, in layout coordinates.
Rectangle | get_cluster_ink_extents () const
| Gets the ink extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
Rectangle | get_cluster_logical_extents () const
| Gets the logical 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.
Rectangle | get_run_ink_extents () const
| Gets the ink extents of the current run in layout coordinates (origin is the top left of the entire layout).
Rectangle | get_run_logical_extents () const
| Gets the logical 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.
Rectangle | get_line_ink_extents () const
| Obtains the ink extents of the current line.
Rectangle | get_line_logical_extents () const
| Obtains the logical extents of the current line.
void | get_line_yrange (int & y0, int & y1) const
| Divides the vertical space in the Pango::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 Pango::Layout being iterated over.
Rectangle | get_layout_ink_extents () const
| Obtains the ink extents of the Pango::Layout being iterated over.
Rectangle | get_layout_logical_extents () const
| Obtains the logical extents of the Pango::Layout being iterated over.
int | get_baseline () const
| Gets the Y position of the current line's baseline, in layout coordinates.
int | get_run_baseline () const
| Gets the Y position of the current run's baseline, in layout coordinates.

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Attributes
PangoLayoutIter * | gobject_

## Related Symbols
(Note that these are not member symbols.)
void | swap (LayoutIter & lhs, LayoutIter & rhs) noexcept
Pango::LayoutIter | wrap (PangoLayoutIter * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

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

## Constructor & Destructor Documentation

## ◆ LayoutIter() [1/4]

Pango::LayoutIter::LayoutIter | ( |  | ) |

## ◆ LayoutIter() [2/4]

Pango::LayoutIter::LayoutIter | ( | PangoLayoutIter * | gobject,
|  | bool | make_a_copy = true )
| explicit

## ◆ LayoutIter() [3/4]

Pango::LayoutIter::LayoutIter | ( | const LayoutIter & | other | ) |

## ◆ LayoutIter() [4/4]

Pango::LayoutIter::LayoutIter | ( | LayoutIter && | other | ) |
| noexcept

## ◆ ~LayoutIter()

Pango::LayoutIter::~LayoutIter | ( |  | ) |
| noexcept

## Member Function Documentation

## ◆ at_last_line()

bool Pango::LayoutIter::at_last_line | ( |  | ) | const

Determines whether iter is on the last line of the layout.

Returns
  true if iter is on the last line.

## ◆ get_baseline()

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

Gets the Y position of the current line's baseline, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

Returns
  Baseline of current line.

## ◆ get_char_extents()

Rectangle Pango::LayoutIter::get_char_extents | ( |  | ) | const

Gets the 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.

Returns
  The logical extents of the current character.

## ◆ get_cluster_extents()

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

Gets the extents of the current cluster, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

Parameters

  ink_rect | Rectangle to fill with ink extents.
  logical_rect | Rectangle to fill with logical extents.

## ◆ get_cluster_ink_extents()

Rectangle Pango::LayoutIter::get_cluster_ink_extents | ( |  | ) | const

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

Returns
  The extents of the current cluster as drawn.

## ◆ get_cluster_logical_extents()

Rectangle Pango::LayoutIter::get_cluster_logical_extents | ( |  | ) | const

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

Returns
  The logical extents of the current cluster.

## ◆ get_const_line()

Glib::RefPtr< const LayoutLine > Pango::LayoutIter::get_const_line | ( |  | ) | const

Gets the current line for read-only access.

This is a faster alternative to get_line(), but the user is not expected to modify the contents of the line (glyphs, glyph widths, etc.).

Since pangomm 2.50

Returns
  The current line, that should not be modified.

## ◆ get_index()

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

Gets 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 nullptr run (see get_run()).

Returns
  Current byte index.

## ◆ get_layout() [1/2]

Glib::RefPtr< Layout > Pango::LayoutIter::get_layout | ( |  | ) |

Gets the layout associated with a Pango::LayoutIter.

Since pangomm 1.20

Returns
  The layout associated with iter.

## ◆ get_layout() [2/2]

Glib::RefPtr< const Layout > Pango::LayoutIter::get_layout | ( |  | ) | const

Gets the layout associated with a Pango::LayoutIter.

Since pangomm 1.20

Returns
  The layout associated with iter.

## ◆ get_layout_extents()

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

Obtains the extents of the Pango::Layout being iterated over.

Parameters

  ink_rect | Rectangle to fill with ink extents.
  logical_rect | Rectangle to fill with logical extents.

## ◆ get_layout_ink_extents()

Rectangle Pango::LayoutIter::get_layout_ink_extents | ( |  | ) | const

Obtains the ink extents of the Pango::Layout being iterated over.

Returns
  The extents of the layout as drawn.

## ◆ get_layout_logical_extents()

Rectangle Pango::LayoutIter::get_layout_logical_extents | ( |  | ) | const

Obtains the logical extents of the Pango::Layout being iterated over.

Returns
  The logical extents of the layout.

## ◆ get_line() [1/2]

Glib::RefPtr< LayoutLine > Pango::LayoutIter::get_line | ( |  | ) |

Gets the current line.

Use the faster get_const_line() if you do not plan to modify the contents of the line (glyphs, glyph widths, etc.).

Returns
  The current line.

## ◆ get_line() [2/2]

Glib::RefPtr< const LayoutLine > Pango::LayoutIter::get_line | ( |  | ) | const

Gets the current line for read-only access.

Returns
  The current line, that should not be modified.

## ◆ get_line_extents()

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

Obtains the extents of the current line.

Extents are in layout coordinates (origin is the top-left corner of the entire Pango::Layout). Thus the extents returned by this function will be the same width/height but not at the same x/y as the extents returned from Pango::LayoutLine::get_extents().

Parameters

  ink_rect | Rectangle to fill with ink extents.
  logical_rect | Rectangle to fill with logical extents.

## ◆ get_line_ink_extents()

Rectangle Pango::LayoutIter::get_line_ink_extents | ( |  | ) | const

Obtains the ink extents of the current line.

Returns
  The extents of the current line as drawn.

## ◆ get_line_logical_extents()

Rectangle Pango::LayoutIter::get_line_logical_extents | ( |  | ) | const

Obtains the logical extents of the current line.

Returns
  The logical extents of the current line.

## ◆ get_line_yrange()

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

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

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

Note
  Since 1.44, Pango uses line heights for placing lines, and there may be gaps between the ranges returned by this function.

Parameters

  y0 | Start of line.
  y1 | End of line.

## ◆ get_run()

GlyphItem Pango::LayoutIter::get_run | ( |  | ) | const

Gets the current run.

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

Returns
  The current run.

## ◆ get_run_baseline()

int Pango::LayoutIter::get_run_baseline | ( |  | ) | const

Gets the Y position of the current run's baseline, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

The run baseline can be different from the line baseline, for example due to superscript or subscript positioning.

Since pangomm 2.54

## ◆ get_run_extents()

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

Gets the extents of the current run in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

Parameters

  ink_rect | Rectangle to fill with ink extents.
  logical_rect | Rectangle to fill with logical extents.

## ◆ get_run_ink_extents()

Rectangle Pango::LayoutIter::get_run_ink_extents | ( |  | ) | const

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

Returns
  The extents of the current run as drawn.

## ◆ get_run_logical_extents()

Rectangle Pango::LayoutIter::get_run_logical_extents | ( |  | ) | const

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

Returns
  The logical extents of the current run.

## ◆ get_type()

GType Pango::LayoutIter::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

PangoLayoutIter * Pango::LayoutIter::gobj | ( |  | ) |
| inline

Provides access to the underlying C instance.

## ◆ gobj() [2/2]

const PangoLayoutIter * Pango::LayoutIter::gobj | ( |  | ) | const
| inline

Provides access to the underlying C instance.

## ◆ gobj_copy()

PangoLayoutIter * Pango::LayoutIter::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

## ◆ next_char()

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

Moves iter forward to the next character in visual order.

If iter was already at the end of the layout, returns false.

Returns
  Whether motion was possible.

## ◆ next_cluster()

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

Moves iter forward to the next cluster in visual order.

If iter was already at the end of the layout, returns false.

Returns
  Whether motion was possible.

## ◆ next_line()

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

Moves iter forward to the start of the next line.

If iter is already on the last line, returns false.

Returns
  Whether motion was possible.

## ◆ next_run()

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

Moves iter forward to the next run in visual order.

If iter was already at the end of the layout, returns false.

Returns
  Whether motion was possible.

## ◆ operator bool()

Pango::LayoutIter::operator bool | ( |  | ) | const
| explicit

Checks whether this iterator is valid.

Since pangomm 2.54

Returns
  true if the iterator is valid.

## ◆ operator=() [1/2]

LayoutIter & Pango::LayoutIter::operator= | ( | const LayoutIter & | other | ) |

## ◆ operator=() [2/2]

LayoutIter & Pango::LayoutIter::operator= | ( | LayoutIter && | other | ) |
| noexcept

## ◆ swap()

void Pango::LayoutIter::swap | ( | LayoutIter & | other | ) |
| noexcept

## Friends And Related Symbol Documentation

## ◆ swap()

void swap | ( | LayoutIter & | lhs,
|  | LayoutIter & | rhs )
| related

Parameters

  lhs | The left-hand side
  rhs | The right-hand side

## ◆ wrap()

Pango::LayoutIter wrap | ( | PangoLayoutIter * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.

## Member Data Documentation

## ◆ gobject_

PangoLayoutIter* Pango::LayoutIter::gobject_
| protected