# VerticalTextLayout

Artifact: [androidx.text:text-vertical](https://developer.android.com/jetpack/androidx/releases/text) [View Source](https://cs.android.com/search?q=file:androidx/text/vertical/VerticalTextLayout.kt+class:androidx.text.vertical.VerticalTextLayout) Added in [1.0.0-beta03](https://developer.android.com/jetpack/androidx/releases/text#1.0.0-beta03)

*** ** * ** ***


```
public final class VerticalTextLayout
```

<br />

*** ** * ** ***

Represents the result of laying out text vertically.

This class encapsulates the result of a vertical text layout process. It stores the layout's properties and provides methods to draw the layout on a `https://developer.android.com/reference/android/graphics/Canvas.html`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/text/vertical/VerticalTextLayout#VerticalTextLayout(kotlin.CharSequence,kotlin.Int,kotlin.Int,android.text.TextPaint,kotlin.Float,androidx.text.vertical.TextOrientation)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html text, int start, int end, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/text/TextPaint.html paint, @https://developer.android.com/reference/androidx/annotation/Px float height, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/text/vertical/TextOrientation orientation )` |

| ### Public methods |
|---|---|
| `final void` | `https://developer.android.com/reference/androidx/text/vertical/VerticalTextLayout#draw(android.graphics.Canvas,kotlin.Float,kotlin.Float)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas, @https://developer.android.com/reference/androidx/annotation/Px float x, @https://developer.android.com/reference/androidx/annotation/Px float y)` Draws this text layout onto the specified `https://developer.android.com/reference/android/graphics/Canvas.html`. |
| `final int` | `https://developer.android.com/reference/androidx/text/vertical/VerticalTextLayout#getLineCount()()` The number of lines (columns) in this vertical text layout. |
| `final @https://developer.android.com/reference/androidx/annotation/Px float` | `https://developer.android.com/reference/androidx/text/vertical/VerticalTextLayout#getWidth()()` The computed width of the vertical text layout in pixels. |
| `final boolean` | `https://developer.android.com/reference/androidx/text/vertical/VerticalTextLayout#isVerticalTextSupported()()` Capability query to determine whether `https://developer.android.com/reference/androidx/text/vertical/VerticalTextLayout` supports vertical text painting. |

## Public constructors

### VerticalTextLayout

Added in [1.0.0-beta03](https://developer.android.com/jetpack/androidx/releases/text#1.0.0-beta03)

```
public VerticalTextLayout(
    @NonNull CharSequence text,
    int start,
    int end,
    @NonNull TextPaint paint,
    @Px float height,
    @NonNull TextOrientation orientation
)
```

## Public methods

### draw

Added in [1.0.0-beta03](https://developer.android.com/jetpack/androidx/releases/text#1.0.0-beta03)

```
public final void draw(@NonNull Canvas canvas, @Px float x, @Px float y)
```

Draws this text layout onto the specified `https://developer.android.com/reference/android/graphics/Canvas.html`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas` | The `https://developer.android.com/reference/android/graphics/Canvas.html` to draw onto. |
| `@https://developer.android.com/reference/androidx/annotation/Px float x` | The horizontal offset in pixels. The drawing origin is the top-right corner. |
| `@https://developer.android.com/reference/androidx/annotation/Px float y` | The vertical offset in pixels. The drawing origin is the top-right corner. |

### getLineCount

Added in [1.0.0-beta03](https://developer.android.com/jetpack/androidx/releases/text#1.0.0-beta03)

```
public final int getLineCount()
```

The number of lines (columns) in this vertical text layout.

### getWidth

Added in [1.0.0-beta03](https://developer.android.com/jetpack/androidx/releases/text#1.0.0-beta03)

```
public final @Px float getWidth()
```

The computed width of the vertical text layout in pixels.

### isVerticalTextSupported

Added in [1.0.0-beta03](https://developer.android.com/jetpack/androidx/releases/text#1.0.0-beta03)

```
public final boolean isVerticalTextSupported()
```

Capability query to determine whether `https://developer.android.com/reference/androidx/text/vertical/VerticalTextLayout` supports vertical text painting. If this returns false, `https://developer.android.com/reference/androidx/text/vertical/VerticalTextLayout#draw(android.graphics.Canvas,kotlin.Float,kotlin.Float)` will have no effect.