2.20 <PangoLayoutIter>

Structure: <PangoLayoutIter>

A <PangoLayoutIter> can be used to iterate over the visual extents of a <PangoLayout>.

To obtain a <PangoLayoutIter>, use layout:get-iter.

The <PangoLayoutIter> structure is opaque, and has no user-visible fields.

Procedures

Method: layout-iter:at-last-line? self ⇒ %return
Method: at-last-line? self ⇒ %return

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

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a boolean.

#t if self is on the last line

Method: layout-iter:copy self ⇒ %return
Method: copy self ⇒ %return

Copies a <PangoLayoutIter>.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a <PangoLayoutIter>, or #f.

the newly allocated <PangoLayoutIter>

Method: layout-iter:free self
Method: free self

Frees an iterator that’s no longer in use.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>, may be #f

Method: layout-iter:get-baseline self ⇒ %return
Method: get-baseline self ⇒ %return

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.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a 32-bit integer.

baseline of current line

Method: layout-iter:get-char-extents! self logical-rect ⇒ logical-rect
Method: get-char-extents! self logical-rect ⇒ logical-rect

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

Layout coordinates have the origin at 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.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

logical-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle to fill with logical extents

Method: layout-iter:get-cluster-extents! self ink-rect logical-rect ⇒ ink-rect logical-rect
Method: get-cluster-extents! self ink-rect logical-rect ⇒ ink-rect logical-rect

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

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

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

ink-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle to fill with ink extents

logical-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle to fill with logical extents

Method: layout-iter:get-index self ⇒ %return
Method: get-index self ⇒ %return

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 #f run (see layout-iter:get-run).

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a 32-bit integer.

current byte index

Method: layout-iter:get-layout self ⇒ %return
Method: get-layout self ⇒ %return

Gets the layout associated with a <PangoLayoutIter>.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a <PangoLayout>, or #f.

the layout associated with self

Method: layout-iter:get-layout-extents! self ink-rect logical-rect ⇒ ink-rect logical-rect
Method: get-layout-extents! self ink-rect logical-rect ⇒ ink-rect logical-rect

Obtains the extents of the <PangoLayout> being iterated over.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

ink-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle to fill with ink extents

logical-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle to fill with logical extents

Method: layout-iter:get-line self ⇒ %return
Method: get-line self ⇒ %return

Gets the current line.

Use the faster layout-iter:get-line-readonly if you do not plan to modify the contents of the line (glyphs, glyph widths, etc.).

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a <PangoLayoutLine>, or #f.

the current line

Method: layout-iter:get-line-extents! self ink-rect logical-rect ⇒ ink-rect logical-rect
Method: get-line-extents! self ink-rect logical-rect ⇒ ink-rect logical-rect

Obtains the extents of the current line.

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 layout-line:get-extents!.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

ink-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle to fill with ink extents

logical-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle to fill with logical extents

Method: layout-iter:get-line-readonly self ⇒ %return
Method: get-line-readonly self ⇒ %return

Gets the current line for read-only access.

This is a faster alternative to layout-iter:get-line, but the user is not expected to modify the contents of the line (glyphs, glyph widths, etc.).

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a <PangoLayoutLine>, or #f.

the current line, that should not be modified

Method: layout-iter:get-line-yrange self ⇒ y0- y1-
Method: get-line-yrange self ⇒ y0- 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 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).

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

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

y0-

Returned: a 32-bit integer.

start of line

y1-

Returned: a 32-bit integer.

end of line

Method: layout-iter:get-run self ⇒ %return
Method: get-run self ⇒ %return

Gets the current run.

When iterating by run, at the end of each line, there’s a position with a #f run, so this function can return #f. The #f 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 layout-iter:get-run-readonly if you do not plan to modify the contents of the run (glyphs, glyph widths, etc.).

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a <PangoGlyphItem>, or #f.

the current run

Method: layout-iter:get-run-baseline self ⇒ %return
Method: get-run-baseline self ⇒ %return

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.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a 32-bit integer.

Method: layout-iter:get-run-extents! self ink-rect logical-rect ⇒ ink-rect logical-rect
Method: get-run-extents! self ink-rect logical-rect ⇒ ink-rect logical-rect

Gets the extents of the current run in layout coordinates.

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

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

ink-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle to fill with ink extents

logical-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle to fill with logical extents

Method: layout-iter:get-run-readonly self ⇒ %return
Method: get-run-readonly self ⇒ %return

Gets the current run for read-only access.

When iterating by run, at the end of each line, there’s a position with a #f run, so this function can return #f. The #f 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 layout-iter:get-run, but the user is not expected to modify the contents of the run (glyphs, glyph widths, etc.).

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a <PangoGlyphItem>, or #f.

the current run, that should not be modified

Method: layout-iter:next-char? self ⇒ %return
Method: next-char? self ⇒ %return

Moves self forward to the next character in visual order.

If self was already at the end of the layout, returns #f.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a boolean.

whether motion was possible

Method: layout-iter:next-cluster? self ⇒ %return
Method: next-cluster? self ⇒ %return

Moves self forward to the next cluster in visual order.

If self was already at the end of the layout, returns #f.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a boolean.

whether motion was possible

Method: layout-iter:next-line? self ⇒ %return
Method: next-line? self ⇒ %return

Moves self forward to the start of the next line.

If self is already on the last line, returns #f.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a boolean.

whether motion was possible

Method: layout-iter:next-run? self ⇒ %return
Method: next-run? self ⇒ %return

Moves self forward to the next run in visual order.

If self was already at the end of the layout, returns #f.

self

Passed: a <PangoLayoutIter>.

a <PangoLayoutIter>

%return

Returned: a boolean.

whether motion was possible