org.gnome.pango

## Class LayoutLine

- Object
- - org.freedesktop.bindings.Pointer
  - - org.gnome.glib.Boxed
    - - org.gnome.pango.LayoutLine

-     public final class LayoutLine
      extends Boxed

  A line within a Layout. Once a Layout has been given text to lay out, individual lines within it can be accessed via the methods on this class.

       lines = layout.getLinesReadonly();

       x = leftMargin;
       y = topMargin + rect.getAscent();

       for (i = 0; i < lines.length; i++) {
           rect = lines[i].getExtentsLogical();
           y += rect.getHeight();

           cr.moveTo(x, y);
           cr.showLayout(lines[i]);
       }

  which of course is the hard way of doing:

       cr.showLayout(layout);

  but gives you control over the individual lines of the paragraph which is necessary when doing paginated layout and worrying about available vertical space.
  Since:
    4.0.10
  Author:
    Andrew Cowie

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Rectangle` | `getExtentsInk()`
    `Rectangle` | `getExtentsLogical()` Get a Rectangle describing the logical extents calculated for this line of rendered text.
    `int` | `getLength()` Get the width of this LayoutLine, in characters.
    `int` | `getStartIndex()` Get the character position into the parent Layout that this LayoutLine begins at.

    - ### Methods inherited from class org.freedesktop.bindings.Pointer

      `toString`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getExtentsInk

          public Rectangle getExtentsInk()

    - #### getExtentsLogical

          public Rectangle getExtentsLogical()

      Get a Rectangle describing the logical extents calculated for this line of rendered text.

      The `x`, `y`, and `height` parameters of these Rectangles are the same for each LayoutLine in a given Layout; the width will be variable (unless you have evenly justified the text, and even then last line of each paragraph will be less than the width of the others).

      Note
      It is a common mistake to assume that the origin of the Pango co-ordinate space is the top-right corner of an extents Rectangle. This is not the case; the vertical origin is at the base line.

      The `showLayout()` method that takes a LayoutLine starts its drawing by placing its Rectangle's origin at the current Context point. So to render consistently spaced lines of text you will need to move the Context point down by the value of the ascent (which is the negative of the `y` co-ordinate describing top of the rectangle from the origin):

           rect = line.getExtentsLogical();

           h = leftMargin;
           v = topMargin + rect.getAscent() + lineNumber * rect.getHeight();

           cr.moveTo(h, v);
           cr.showLayout(line);

      Since:
        4.0.10

    - #### getLength

          public int getLength()

      Get the width of this LayoutLine, in characters.
      Since:
        4.0.14

    - #### getStartIndex

          public int getStartIndex()

      Get the character position into the parent Layout that this LayoutLine begins at.

      The underlying PangoLayout and PangoLayoutLine structures work in byte widths; we convert to character offsets.

      Since:
        4.0.14