# LineHeightStyle.Trim

Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/style/LineHeightStyle.kt+class:androidx.compose.ui.text.style.LineHeightStyle.Trim) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0) Common/AllAndroid/JVM
- Cmn

  ```
  value class LineHeightStyle.Trim
  ```

*** ** * ** ***

Controls trimming of extra space from the first line top and last line bottom.

Requires PlatformParagraphStyle.includeFontPadding to be false to take effect.

Trimming behavior depends on the selected `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Mode`:

- `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Mode#Fixed()` / `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Mode#Minimum()`: Trims extra space only when the configured line height is taller than the font default (prevents clipping).

- `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Mode#Tight()`: Trims space even when the configured line height is shorter than the font default.

**Warning:** Use `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Mode#Tight()` with caution to avoid cutting off tall characters or accents. Test your text layout with tall scripts (e.g., Arabic "العَرَبِيَّةُ", Tibetan "དབུ་ཅན་", or Burmese "မြန်မာဘာသာ") before using in production.

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim#Both()` Trim the space that would be added to the top of the first line and bottom of the last line as a result of the line height. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim#FirstLineTop()` Trim the space that would be added to the top of the first line as a result of the line height. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim#LastLineBottom()` Trim the space that would be added to the bottom of the last line as a result of the line height. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim#None()` Do not trim first line top or last line bottom. | Cmn |

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim#trimsFirstLineTop()` Returns true if this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim` configuration trims the space at the top of the first line. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim#trimsLastLineBottom()` Returns true if this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim` configuration trims the space at the bottom of the last line. | Cmn |

## Public companion properties

### Both

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
val Both: LineHeightStyle.Trim
```

Trim the space that would be added to the top of the first line and bottom of the last line as a result of the line height. This feature is available only when PlatformParagraphStyle.includeFontPadding is false.

For example, when line height is 3.em, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Alignment` is `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Alignment#Center()`, the first and last line has 2.em height and the height from first line baseline to second line baseline is still 3.em:

```
+---+
| Line1  |
|        |
|---|
|        |
| Line2  |
+---+
```

### FirstLineTop

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
val FirstLineTop: LineHeightStyle.Trim
```

Trim the space that would be added to the top of the first line as a result of the line height. Single line text is both the first and last line. This feature is available only when PlatformParagraphStyle.includeFontPadding is false.

For example, when line height is 3.em, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Alignment` is `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Alignment#Center()`, the first line has 2.em height and the height from first line baseline to second line baseline is still 3.em:

```
+---+
| Line1  |
|        |
|---|
|        |
| Line2  |
|        |
+---+
```

### LastLineBottom

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
val LastLineBottom: LineHeightStyle.Trim
```

Trim the space that would be added to the bottom of the last line as a result of the line height. Single line text is both the first and last line. This feature is available only when PlatformParagraphStyle.includeFontPadding is false.

For example, when line height is 3.em, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Alignment` is `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Alignment#Center()`, the last line has 2.em height and the height from first line baseline to second line baseline is still 3.em:

```
+---+
|        |
| Line1  |
|        |
|---|
|        |
| Line2  |
+---+
```

### None

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
val None: LineHeightStyle.Trim
```

Do not trim first line top or last line bottom.

For example, when line height is 3.em, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Alignment` is `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Alignment#Center()`, the first line height, last line height and the height from first line baseline to second line baseline are 3.em:

```
+---+
|        |
| Line1  |
|        |
|---|
|        |
| Line2  |
|        |
+---+
```

## Public functions

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### trimsFirstLineTop

Cmn

```
val trimsFirstLineTop: Boolean
```

Returns true if this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim` configuration trims the space at the top of the first line.

### trimsLastLineBottom

Cmn

```
val trimsLastLineBottom: Boolean
```

Returns true if this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineHeightStyle.Trim` configuration trims the space at the bottom of the last line.