Class (GI Struct)

Pango-1.0PangoLayoutLine

A Pango.LayoutLine represents one of the lines resulting from laying out a paragraph via Pango.Layout.

Pango.LayoutLine structures are obtained by calling Pango.Layout.get_line and are only valid until the text, attributes, or settings of the parent Pango.Layout are modified.

Index

Constructors

Properties

layout: Pango.Layout
length: number
resolved_dir: number
runs: GlyphItem[]
start_index: number
$gtype: GType<LayoutLine>

Methods

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

    Returns number

    the start index of the line

  • 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.

    Parameters

    • start_index: number

      Start byte index of the logical range. If this value is less than the start index for the line, then the first range will extend all the way to the leading edge of the layout. Otherwise, it will start at the leading edge of the first character.

    • end_index: number

      Ending byte index of the logical range. If this value is greater than the end index for the line, then the last range will extend all the way to the trailing edge of the layout. Otherwise, it will end at the trailing edge of the last character.

    Returns number[]

  • Converts an index within a line to a X position.

    Parameters

    • index_: number

      byte offset of a grapheme within the layout

    • trailing: boolean

      an integer indicating the edge of the grapheme to retrieve the position of. If > 0, the trailing edge of the grapheme, if 0, the leading of the grapheme

    Returns number

  • Returns whether this is the first line of the paragraph.

    Returns boolean

    true if this is the first line

  • 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.

    Parameters

    • x_pos: number

      the X offset (in Pango units) from the left edge of the line.

    Returns [boolean, number, number]

    false if x_pos was outside the line, true if inside