> ## Documentation Index
> Fetch the complete documentation index at: https://rive.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# TextLine

One line of a [Text](/docs/scripting/api-reference/text/text) after wrapping. Iterate it to visit its glyphs in
visual order, left to right, whatever the writing direction.

```lua theme={null}
for _, line in text:lines() do
  for _, glyph in line do
    renderer:save()
    renderer:transform(glyph.transform)
    renderer:drawPath(glyph.font:glyphPath(glyph.id), paint)
    renderer:restore()
  end
end
```

## Fields

### `index`

1 based index of the line within the text.

### `x`

Left edge after alignment.

### `top`

### `baseline`

### `bottom`

### `width`

### `direction`

Base direction of the paragraph the line belongs to.

### `firstIndex`

First and last codepoint index on the line, 1 based.

### `lastIndex`

### `glyphCount`

## Methods

### `glyph`

<div class="signature">
  ```lua theme={null}
  glyph(index: number) -> Glyph
  ```
</div>

The glyph at a 1 based visual position.

### `glyphs`

<div class="signature">
  ```lua theme={null}
  glyphs() -> {Glyph}
  ```
</div>

All glyphs in visual order.

### `__iter`

<div class="signature">
  ```lua theme={null}
  __iter() -> ((TextLine, number) ->(number?, Glyph), TextLine, number)
  ```
</div>

Iterates the glyphs in visual order: `for _, glyph in line do`.
