LayoutLineProtocol

public protocol LayoutLineProtocol

A PangoLayoutLine represents one of the lines resulting from laying out a paragraph via PangoLayout.

PangoLayoutLine structures are obtained by calling [methodPango.Layout.get_line] and are only valid until the text, attributes, or settings of the parent PangoLayout are modified.

The LayoutLineProtocol protocol exposes the methods and properties of an underlying PangoLayoutLine 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 LayoutLine. Alternatively, use LayoutLineRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying PangoLayoutLine instance.

    Declaration

    Swift

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

    Typed pointer to the underlying PangoLayoutLine instance.

    Default Implementation

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

    Declaration

    Swift

    var layout_line_ptr: UnsafeMutablePointer<PangoLayoutLine>! { get }
  • Required Initialiser for types conforming to LayoutLineProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

LayoutLine Record: LayoutLineProtocol extension (methods and fields)

  • Computes the logical and ink extents of a layout line.

    See [methodPango.Font.get_glyph_extents] for details about the interpretation of the rectangles.

    Declaration

    Swift

    @inlinable
    func getExtents(inkRect: RectangleRef? = nil, logicalRect: RectangleRef? = nil)
  • Computes the logical and ink extents of a layout line.

    See [methodPango.Font.get_glyph_extents] for details about the interpretation of the rectangles.

    Declaration

    Swift

    @inlinable
    func getExtents<RectangleT>(inkRect: RectangleT?, logicalRect: RectangleT?) where RectangleT : RectangleProtocol
  • get(height:) Extension method

    Computes the height of the line, as the maximum of the heights of fonts used in this line.

    Note that the actual baseline-to-baseline distance between lines of text is influenced by other factors, such as [methodPango.Layout.set_spacing] and [methodPango.Layout.set_line_spacing].

    Declaration

    Swift

    @inlinable
    func get(height: UnsafeMutablePointer<gint>! = nil)
  • getLength() Extension method

    Returns the length of the line, in bytes.

    Declaration

    Swift

    @inlinable
    func getLength() -> Int
  • Computes the logical and ink extents of layout_line in device units.

    This function just calls [methodPango.LayoutLine.get_extents] followed by two [funcextents_to_pixels] calls, rounding ink_rect and logical_rect such that the rounded rectangles fully contain the unrounded one (that is, passes them as first argument to [funcextents_to_pixels]).

    Declaration

    Swift

    @inlinable
    func getPixelExtents(inkRect: RectangleRef? = nil, logicalRect: RectangleRef? = nil)
  • Computes the logical and ink extents of layout_line in device units.

    This function just calls [methodPango.LayoutLine.get_extents] followed by two [funcextents_to_pixels] calls, rounding ink_rect and logical_rect such that the rounded rectangles fully contain the unrounded one (that is, passes them as first argument to [funcextents_to_pixels]).

    Declaration

    Swift

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

    Returns the resolved direction of the line.

    Declaration

    Swift

    @inlinable
    func getResolvedDirection() -> PangoDirection
  • getStartIndex() Extension method

    Returns the start index of the line, as byte index into the text of the layout.

    Declaration

    Swift

    @inlinable
    func getStartIndex() -> Int
  • Gets a list of visual ranges corresponding to a given logical range.

    This list is not necessarily minimal - there may be consecutive ranges which are adjacent. The ranges will be sorted from left to right. The ranges are with respect to the left edge of the entire layout, not with respect to the line.

    Declaration

    Swift

    @inlinable
    func getXRanges(startIndex: Int, endIndex: Int, ranges: UnsafeMutablePointer<UnsafeMutablePointer<CInt>?>!, nRanges: UnsafeMutablePointer<gint>!)
  • Converts an index within a line to a X position.

    Declaration

    Swift

    @inlinable
    func indexToX(index: Int, trailing: Bool, xPos: UnsafeMutablePointer<gint>!)
  • ref() Extension method

    Increase the reference count of a PangoLayoutLine by one.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func ref() -> Pango.LayoutLineRef!
  • unref() Extension method

    Decrease the reference count of a PangoLayoutLine by one.

    If the result is zero, the line and all associated memory will be freed.

    Declaration

    Swift

    @inlinable
    func unref()
  • Converts from x offset to the byte index of the corresponding character within the text of the layout.

    If x_pos is outside the line, index_ and trailing will point to the very first or very last position in the line. This determination is based on the resolved direction of the paragraph; for example, if the resolved direction is right-to-left, then an X position to the right of the line (after it) results in 0 being stored in index_ and trailing. An X position to the left of the line results in index_ pointing to the (logical) last grapheme in the line and trailing being set to the number of characters in that grapheme. The reverse is true for a left-to-right line.

    Declaration

    Swift

    @inlinable
    func xToIndex(xPos: Int, index: UnsafeMutablePointer<gint>!, trailing: UnsafeMutablePointer<gint>!) -> Bool
  • isParagraphStart Extension method

    Returns whether this is the first line of the paragraph.

    Declaration

    Swift

    @inlinable
    var isParagraphStart: Bool { get }
  • length Extension method

    Returns the length of the line, in bytes.

    Declaration

    Swift

    @inlinable
    var length: Int { get }
  • resolvedDirection Extension method

    Returns the resolved direction of the line.

    Declaration

    Swift

    @inlinable
    var resolvedDirection: PangoDirection { get }
  • startIndex Extension method

    Returns the start index of the line, as byte index into the text of the layout.

    Declaration

    Swift

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

    the layout this line belongs to, might be nil

    Declaration

    Swift

    @inlinable
    var layout: LayoutRef! { get set }
  • _startIndex Extension method

    start of line as byte index into layout->text

    Declaration

    Swift

    @inlinable
    var _startIndex: gint { get set }
  • _length Extension method

    length of line in bytes

    Declaration

    Swift

    @inlinable
    var _length: gint { get set }
  • runs Extension method

    list of runs in the line, from left to right

    Declaration

    Swift

    @inlinable
    var runs: SListRef! { get set }
  • _isParagraphStart Extension method

    TRUE if this is the first line of the paragraph

    Declaration

    Swift

    @inlinable
    var _isParagraphStart: guint { get set }
  • resolvedDir Extension method

    Resolved PangoDirection of line

    Declaration

    Swift

    @inlinable
    var resolvedDir: guint { get set }