LayoutIterProtocol

public protocol LayoutIterProtocol

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

To obtain a PangoLayoutIter, use [methodPango.Layout.get_iter].

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

The LayoutIterProtocol protocol exposes the methods and properties of an underlying PangoLayoutIter instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see LayoutIter. Alternatively, use LayoutIterRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying PangoLayoutIter instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • layout_iter_ptr Default implementation

    Typed pointer to the underlying PangoLayoutIter instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the PangoLayoutIter instance.

    Declaration

    Swift

    var layout_iter_ptr: UnsafeMutablePointer<PangoLayoutIter>! { get }
  • Required Initialiser for types conforming to LayoutIterProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

LayoutIter Record: LayoutIterProtocol extension (methods and fields)

  • atLastLine() Extension method

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

    Declaration

    Swift

    @inlinable
    func atLastLine() -> Bool
  • copy() Extension method

    Copies a PangoLayoutIter.

    Declaration

    Swift

    @inlinable
    func copy() -> Pango.LayoutIterRef!
  • free() Extension method

    Frees an iterator that’s no longer in use.

    Declaration

    Swift

    @inlinable
    func free()
  • getBaseline() Extension method

    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.

    Declaration

    Swift

    @inlinable
    func getBaseline() -> Int
  • getCharExtents(logicalRect:) Extension method

    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.

    Declaration

    Swift

    @inlinable
    func getCharExtents<RectangleT>(logicalRect: RectangleT) where RectangleT : RectangleProtocol
  • Gets the extents of the current cluster, in layout coordinates.

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

    Declaration

    Swift

    @inlinable
    func getClusterExtents(inkRect: RectangleRef? = nil, logicalRect: RectangleRef? = nil)
  • Gets the extents of the current cluster, in layout coordinates.

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

    Declaration

    Swift

    @inlinable
    func getClusterExtents<RectangleT>(inkRect: RectangleT?, logicalRect: RectangleT?) where RectangleT : RectangleProtocol
  • getIndex() Extension method

    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 nil run (see [methodPango.LayoutIter.get_run]).

    Declaration

    Swift

    @inlinable
    func getIndex() -> Int
  • getLayout() Extension method

    Gets the layout associated with a PangoLayoutIter.

    Declaration

    Swift

    @inlinable
    func getLayout() -> Pango.LayoutRef!
  • Obtains the extents of the PangoLayout being iterated over.

    Declaration

    Swift

    @inlinable
    func getLayoutExtents(inkRect: RectangleRef? = nil, logicalRect: RectangleRef? = nil)
  • Obtains the extents of the PangoLayout being iterated over.

    Declaration

    Swift

    @inlinable
    func getLayoutExtents<RectangleT>(inkRect: RectangleT?, logicalRect: RectangleT?) where RectangleT : RectangleProtocol
  • getLine() Extension method

    Gets the current line.

    Use the faster [methodPango.LayoutIter.get_line_readonly] if you do not plan to modify the contents of the line (glyphs, glyph widths, etc.).

    Declaration

    Swift

    @inlinable
    func getLine() -> Pango.LayoutLineRef!
  • 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 [methodPango.LayoutLine.get_extents].

    Declaration

    Swift

    @inlinable
    func getLineExtents(inkRect: RectangleRef? = nil, logicalRect: RectangleRef? = nil)
  • 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 [methodPango.LayoutLine.get_extents].

    Declaration

    Swift

    @inlinable
    func getLineExtents<RectangleT>(inkRect: RectangleT?, logicalRect: RectangleT?) where RectangleT : RectangleProtocol
  • getLineReadonly() Extension method

    Gets the current line for read-only access.

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

    Declaration

    Swift

    @inlinable
    func getLineReadonly() -> Pango.LayoutLineRef!
  • getLineYrange(y0:y1:) Extension method

    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 [methodPango.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.

    Declaration

    Swift

    @inlinable
    func getLineYrange(y0: UnsafeMutablePointer<gint>! = nil, y1: UnsafeMutablePointer<gint>! = nil)
  • getRun() Extension method

    Gets the current run.

    When iterating by run, at the end of each line, there’s a position with a nil run, so this function can return nil. The nil 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 [methodPango.LayoutIter.get_run_readonly] if you do not plan to modify the contents of the run (glyphs, glyph widths, etc.).

    Declaration

    Swift

    @inlinable
    func getRun() -> UnsafeMutablePointer<PangoLayoutRun>?
  • getRunBaseline() Extension method

    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.

    Declaration

    Swift

    @inlinable
    func getRunBaseline() -> Int
  • Gets the extents of the current run in layout coordinates.

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

    Declaration

    Swift

    @inlinable
    func getRunExtents(inkRect: RectangleRef? = nil, logicalRect: RectangleRef? = nil)
  • Gets the extents of the current run in layout coordinates.

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

    Declaration

    Swift

    @inlinable
    func getRunExtents<RectangleT>(inkRect: RectangleT?, logicalRect: RectangleT?) where RectangleT : RectangleProtocol
  • getRunReadonly() Extension method

    Gets the current run for read-only access.

    When iterating by run, at the end of each line, there’s a position with a nil run, so this function can return nil. The nil 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 [methodPango.LayoutIter.get_run], but the user is not expected to modify the contents of the run (glyphs, glyph widths, etc.).

    Declaration

    Swift

    @inlinable
    func getRunReadonly() -> UnsafeMutablePointer<PangoLayoutRun>?
  • nextChar() Extension method

    Moves iter forward to the next character in visual order.

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

    Declaration

    Swift

    @inlinable
    func nextChar() -> Bool
  • nextCluster() Extension method

    Moves iter forward to the next cluster in visual order.

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

    Declaration

    Swift

    @inlinable
    func nextCluster() -> Bool
  • nextLine() Extension method

    Moves iter forward to the start of the next line.

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

    Declaration

    Swift

    @inlinable
    func nextLine() -> Bool
  • nextRun() Extension method

    Moves iter forward to the next run in visual order.

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

    Declaration

    Swift

    @inlinable
    func nextRun() -> Bool
  • baseline Extension method

    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.

    Declaration

    Swift

    @inlinable
    var baseline: Int { get }
  • index Extension method

    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 nil run (see [methodPango.LayoutIter.get_run]).

    Declaration

    Swift

    @inlinable
    var index: Int { get }
  • layout Extension method

    Gets the layout associated with a PangoLayoutIter.

    Declaration

    Swift

    @inlinable
    var layout: Pango.LayoutRef! { get }
  • line Extension method

    Gets the current line.

    Use the faster [methodPango.LayoutIter.get_line_readonly] if you do not plan to modify the contents of the line (glyphs, glyph widths, etc.).

    Declaration

    Swift

    @inlinable
    var line: Pango.LayoutLineRef! { get }
  • lineReadonly Extension method

    Gets the current line for read-only access.

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

    Declaration

    Swift

    @inlinable
    var lineReadonly: Pango.LayoutLineRef! { get }
  • run Extension method

    Gets the current run.

    When iterating by run, at the end of each line, there’s a position with a nil run, so this function can return nil. The nil 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 [methodPango.LayoutIter.get_run_readonly] if you do not plan to modify the contents of the run (glyphs, glyph widths, etc.).

    Declaration

    Swift

    @inlinable
    var run: UnsafeMutablePointer<PangoLayoutRun>? { get }
  • runBaseline Extension method

    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.

    Declaration

    Swift

    @inlinable
    var runBaseline: Int { get }
  • runReadonly Extension method

    Gets the current run for read-only access.

    When iterating by run, at the end of each line, there’s a position with a nil run, so this function can return nil. The nil 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 [methodPango.LayoutIter.get_run], but the user is not expected to modify the contents of the run (glyphs, glyph widths, etc.).

    Declaration

    Swift

    @inlinable
    var runReadonly: UnsafeMutablePointer<PangoLayoutRun>? { get }