PgLayoutIter

While complete access to the layout capabilities of Pango is provided using the detailed interfaces for itemization and shaping, using that functionality directly involves writing a fairly large amount of code. The objects and functions in this section provide a high-level driver for formatting entire paragraphs of text at once.

Constructors

this
this(PangoLayoutIter* pangoLayoutIter)

Sets our main struct and passes it to the parent class

Members

Functions

atLastLine
int atLastLine()

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

copy
PgLayoutIter copy()

Copies a PangoLayoutIter. Since 1.20

free
void free()

Frees an iterator that's no longer in use.

getBaseline
int getBaseline()

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

getCharExtents
void getCharExtents(PangoRectangle* logicalRect)

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.

getClusterExtents
void getClusterExtents(PangoRectangle* inkRect, PangoRectangle* logicalRect)

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

getIndex
int getIndex()

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 NULL run (see pango_layout_iter_get_run()).

getLayout
PgLayout getLayout()

Gets the layout associated with a PangoLayoutIter. Since 1.20

getLayoutExtents
void getLayoutExtents(PangoRectangle* inkRect, PangoRectangle* logicalRect)

Obtains the extents of the PangoLayout being iterated over. ink_rect or logical_rect can be NULL if you aren't interested in them.

getLine
PgLayoutLine getLine()

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

getLineExtents
void getLineExtents(PangoRectangle* inkRect, PangoRectangle* logicalRect)

Obtains the extents of the current line. 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 PangoLayout). 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_layout_line_get_extents().

getLineReadonly
PgLayoutLine getLineReadonly()

Gets the current line for read-only access. This is a faster alternative to pango_layout_iter_get_line(), but the user is not expected to modify the contents of the line (glyphs, glyph widths, etc.). Since 1.16

getLineYrange
void getLineYrange(int y0_, int y1_)

Divides the vertical space in the PangoLayout 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 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).

getPgLayoutIterStruct
PangoLayoutIter* getPgLayoutIterStruct()

Get the main Gtk struct

getRun
PangoLayoutRun* getRun()

Gets the current run. When iterating by run, at the end of each line, there's a position with a NULL run, so this function 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. Use the faster pango_layout_iter_get_run_readonly() if you do not plan to modify the contents of the run (glyphs, glyph widths, etc.).

getRunExtents
void getRunExtents(PangoRectangle* inkRect, PangoRectangle* logicalRect)

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

getRunReadonly
PangoLayoutRun* getRunReadonly()

Gets the current run. When iterating by run, at the end of each line, there's a position with a NULL run, so this function 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. This is a faster alternative to pango_layout_iter_get_run(), but the user is not expected to modify the contents of the run (glyphs, glyph widths, etc.). Since 1.16

getStruct
void* getStruct()

the main Gtk struct as a void*

nextChar
int nextChar()

Moves iter forward to the next character in visual order. If iter was already at the end of the layout, returns FALSE.

nextCluster
int nextCluster()

Moves iter forward to the next cluster in visual order. If iter was already at the end of the layout, returns FALSE.

nextLine
int nextLine()

Moves iter forward to the start of the next line. If iter is already on the last line, returns FALSE.

nextRun
int nextRun()

Moves iter forward to the next run in visual order. If iter was already at the end of the layout, returns FALSE.

Variables

pangoLayoutIter
PangoLayoutIter* pangoLayoutIter;

the main Gtk struct

Meta