Class LayoutLine

All Implemented Interfaces:
PointerInterface

public class LayoutLine extends Record
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.

https://docs.gtk.org/Pango/struct.LayoutLine.html

  • Field Details

  • Constructor Details

    • LayoutLine

      public LayoutLine(PointerContainer pointer)
    • LayoutLine

      public LayoutLine()
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • setFieldLayout

      public void setFieldLayout(Layout layout)
      the layout this line belongs to, might be %NULL
    • getFieldLayout

      public Layout getFieldLayout()
      the layout this line belongs to, might be %NULL
    • setFieldStartIndex

      public void setFieldStartIndex(int start_index)
      start of line as byte index into layout->text
    • getFieldStartIndex

      public int getFieldStartIndex()
      start of line as byte index into layout->text
    • setFieldLength

      public void setFieldLength(int length)
      length of line in bytes
    • getFieldLength

      public int getFieldLength()
      length of line in bytes
    • setFieldRuns

      public void setFieldRuns(SList runs)
      list of runs in the
      line, from left to right
    • getFieldRuns

      public SList getFieldRuns()
      list of runs in the
      line, from left to right
    • setFieldIsParagraphStart

      public void setFieldIsParagraphStart(int is_paragraph_start)
      #TRUE if this is the first line of the paragraph
    • getFieldIsParagraphStart

      public int getFieldIsParagraphStart()
      #TRUE if this is the first line of the paragraph
    • setFieldResolvedDir

      public void setFieldResolvedDir(int resolved_dir)
      #Resolved PangoDirection of line
    • getFieldResolvedDir

      public int getFieldResolvedDir()
      #Resolved PangoDirection of line
    • getExtents

      public void getExtents(@Nullable Rectangle ink_rect, @Nullable Rectangle logical_rect)
      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.
      Parameters:
      ink_rect - rectangle used to store the extents of the glyph string as drawn
      logical_rect - rectangle used to store the logical extents of the glyph string
    • getHeight

      public void getHeight(@Nullable Int 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].
      Parameters:
      height - return location for the line height
    • getLength

      public int getLength()
      Returns the length of the line, in bytes.
      Returns:
      the length of the line
    • getPixelExtents

      public void getPixelExtents(@Nullable Rectangle ink_rect, @Nullable Rectangle logical_rect)
      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 @logical_rect
      such that the rounded rectangles fully contain the unrounded one (that is,
      passes them as first argument to [func@extents_to_pixels]).
      Parameters:
      ink_rect - rectangle used to store the extents of the glyph string as drawn
      logical_rect - rectangle used to store the logical extents of the glyph string
    • getResolvedDirection

      public int getResolvedDirection()
      Returns the resolved direction of the line.
      Returns:
      the resolved direction of the line
    • getStartIndex

      public int getStartIndex()
      Returns the start index of the line, as byte index
      into the text of the layout.
      Returns:
      the start index of the line
    • indexToX

      public void indexToX(int index_, boolean trailing, @Nonnull Int x_pos)
      Converts an index within a line to a X position.
      Parameters:
      index_ - byte offset of a grapheme within the layout
      trailing - 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 - location to store the x_offset (in Pango units)
    • isParagraphStart

      public boolean isParagraphStart()
      Returns whether this is the first line of the paragraph.
      Returns:
      %TRUE if this is the first line
    • ref

      public LayoutLine ref()
      Increase the reference count of a `PangoLayoutLine` by one.
      Returns:
      the line passed in.
    • unref

      public void unref()
      Decrease the reference count of a `PangoLayoutLine` by one.

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

      public boolean xToIndex(int x_pos, @Nonnull Int index_, @Nonnull Int trailing)
      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 - the X offset (in Pango units) from the left edge of the line.
      index_ - location to store calculated byte index for the grapheme in which the user clicked
      trailing - 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.
      Returns:
      %FALSE if @x_pos was outside the line, %TRUE if inside
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()