Basics
Guides
API Reference
Basics
Guides
API Reference
[16:7] extends: object
A PangoLayoutLine represents one of the lines resulting from laying out a
paragraph via PangoLayout. PangoLayoutLine structures are obtained by
calling [method@Pango.Layout.get_line] and are only valid until the text,
attributes, or settings of the parent PangoLayout are modified.
PangoLayoutLine (Handle = null)
Creates a new
LayoutLineby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.get_extents ()
Computes the logical and ink extents of a layout line. See [method@Pango.Font.get_glyph_extents] for details about the interpretation of the rectangles.
ink_rect is rectangle used to store the extents of the glyph string as drawn.logical_rect is rectangle used to store the logical extents of the glyph string.None.get_height ()
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 [method@Pango.Layout.set_spacing] and [method@Pango.Layout.set_line_spacing].
height is return location for the line height.None.get_length ()
Returns the length of the line, in bytes.
the length of the line.get_pixel_extents ()
Computes the logical and ink extents of @layout_line in device units. This function just calls [method@Pango.LayoutLine.get_extents] followed by two [func@extents_to_pixels] calls, rounding @ink_rect and
such that the rounded rectangles fully contain the unrounded one (that is, passes them as first argument to [func@extents_to_pixels]).ink_rect is rectangle used to store the extents of the glyph string as drawn.logical_rect is rectangle used to store the logical extents of the glyph string.None.get_resolved_direction ()
Returns the resolved direction of the line.
the resolved direction of the line.get_start_index ()
Returns the start index of the line, as byte index into the text of the layout.
the start index of the line.get_x_ranges (int start_index, int end_index)
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.
start_index is 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 is 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..ranges is location to store a pointer to an array of ranges. The array will be of length 2*n_ranges, with each range starting at (*ranges)[2*n] and of width (*ranges)[2*n + 1] - (*ranges)[2*n]. This array must be freed with g_free(). The coordinates are relative to the layout and are in Pango units..n_ranges is The number of ranges stored in @ranges.None.index_to_x (int index_, bool trailing)
Converts an index within a line to a X position.
index_ is byte offset of a grapheme within the layout.trailing is 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.x_pos is location to store the x_offset (in Pango units).None.is_paragraph_start ()
Returns whether this is the first line of the paragraph.
%TRUE if this is the first line.ref ()
Increase the reference count of a
PangoLayoutLineby one.
the line passed in..unref ()
Decrease the reference count of a
PangoLayoutLineby one. If the result is zero, the line and all associated memory will be freed.
None.x_to_index (int x_pos)
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
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 inand @trailing. An X position to the left of the line results inpointing 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.x_pos is the X offset (in Pango units) from the left edge of the line..index_ is location to store calculated byte index for the grapheme in which the user clicked.trailing is location to store an integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the leading edge of the grapheme..%FALSE if @x_pos was outside the line, %TRUE if inside.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.