Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/text/Layout.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/text/Layout.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/text/Layout.Builder#inhmethods)

# Layout.Builder

*** ** * ** ***

` public static final class Layout.Builder `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.text.Layout.Builder |

<br />

*** ** * ** ***

A builder class for Layout object. Different from `https://developer.android.com/reference/android/text/StaticLayout.Builder`, this builder generates the optimal layout based on input. If the given text and parameters can be rendered with `https://developer.android.com/reference/android/text/BoringLayout`, this builder generates `https://developer.android.com/reference/android/text/BoringLayout` instance. Otherwise, `https://developer.android.com/reference/android/text/StaticLayout` instance is generated.
**See also:**

- `https://developer.android.com/reference/android/text/StaticLayout.Builder`

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/text/Layout.Builder#Builder(java.lang.CharSequence,%20int,%20int,%20android.text.TextPaint,%20int)(https://developer.android.com/reference/java/lang/CharSequence text, int start, int end, https://developer.android.com/reference/android/text/TextPaint paint, int width) ` Construct a builder class. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/text/Layout` | ` https://developer.android.com/reference/android/text/Layout.Builder#build()() ` Build a Layout object. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setAlignment(android.text.Layout.Alignment)(https://developer.android.com/reference/android/text/Layout.Alignment alignment) ` Set the text alignment. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setBreakStrategy(int)(int breakStrategy) ` Set the line break strategy. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setEllipsize(android.text.TextUtils.TruncateAt)(https://developer.android.com/reference/android/text/TextUtils.TruncateAt ellipsize) ` Set the ellipsizing type. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setEllipsizedWidth(int)(int ellipsizeWidth) ` Set the width as used for ellipsizing purpose in pixels. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setFallbackLineSpacingEnabled(boolean)(boolean fallbackLineSpacing) ` Set whether to respect the ascent and descent of the fallback fonts. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setFontPaddingIncluded(boolean)(boolean includeFontPadding) ` Set whether including extra padding into the first and the last line height. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setHyphenationFrequency(int)(int hyphenationFrequency) ` Set the hyphenation frequency. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setJustificationMode(int)(int justificationMode) ` Set justification mode. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setLeftIndents(int[])(int[] leftIndents) ` Set visually left indents in pixels per lines. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setLineBreakConfig(android.graphics.text.LineBreakConfig)(https://developer.android.com/reference/android/graphics/text/LineBreakConfig lineBreakConfig) ` Set the line break configuration. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setLineSpacingAmount(float)(float amount) ` Set the line spacing amount. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setLineSpacingMultiplier(float)(float multiplier) ` Set the line spacing multiplier. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setMaxLines(int)(int maxLines) ` Set the maximum number of lines. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setMinimumFontMetrics(android.graphics.Paint.FontMetrics)(https://developer.android.com/reference/android/graphics/Paint.FontMetrics minimumFontMetrics) ` Set the minimum font metrics used for line spacing. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setRightIndents(int[])(int[] rightIndents) ` Set visually right indents in pixels per lines. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setShiftDrawingOffsetForStartOverhang(boolean)(boolean shiftDrawingOffsetForStartOverhang) ` Set true for shifting the drawing x offset for showing overhang at the start position. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setTextDirectionHeuristic(android.text.TextDirectionHeuristic)(https://developer.android.com/reference/android/text/TextDirectionHeuristic textDirection) ` Set the text direction heuristics. |
| ` https://developer.android.com/reference/android/text/Layout.Builder` | ` https://developer.android.com/reference/android/text/Layout.Builder#setUseBoundsForWidth(boolean)(boolean useBoundsForWidth) ` Set true for using width of bounding box as a source of automatic line breaking and drawing. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### Builder

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder (CharSequence text, 
                int start, 
                int end, 
                TextPaint paint, 
                int width)
```

Construct a builder class.

<br />

| Parameters ||
|---|---|
| `text` | `CharSequence`: a text to be displayed. This value cannot be `null`. <br /> |
| `start` | `int`: an inclusive start index of the text to be displayed. Value is 0 or greater <br /> |
| `end` | `int`: an exclusive end index of the text to be displayed. Value is 0 or greater <br /> |
| `paint` | `TextPaint`: a paint object to be used for drawing text. This value cannot be `null`. <br /> |
| `width` | `int`: a width constraint in pixels. Value is 0 or greater <br /> |

## Public methods

### build

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout build ()
```

Build a Layout object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout` | This value cannot be `null`. <br /> |

### setAlignment

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setAlignment (Layout.Alignment alignment)
```

Set the text alignment. The default value is `https://developer.android.com/reference/android/text/Layout.Alignment#ALIGN_NORMAL`.

<br />

| Parameters ||
|---|---|
| `alignment` | `Layout.Alignment`: an alignment. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout.Alignment`
- `https://developer.android.com/reference/android/text/Layout#getAlignment()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setAlignment(android.text.Layout.Alignment)`

### setBreakStrategy

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setBreakStrategy (int breakStrategy)
```

Set the line break strategy. The default value is `https://developer.android.com/reference/android/text/Layout#BREAK_STRATEGY_SIMPLE`.

<br />

| Parameters ||
|---|---|
| `breakStrategy` | `int`: a break strategy for line breaking. Value is one of the following: - `https://developer.android.com/reference/android/graphics/text/LineBreaker#BREAK_STRATEGY_SIMPLE` - `https://developer.android.com/reference/android/graphics/text/LineBreaker#BREAK_STRATEGY_HIGH_QUALITY` - `https://developer.android.com/reference/android/graphics/text/LineBreaker#BREAK_STRATEGY_BALANCED` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getBreakStrategy()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setBreakStrategy(int)`
- `https://developer.android.com/reference/android/text/Layout#BREAK_STRATEGY_SIMPLE`
- `https://developer.android.com/reference/android/text/Layout#BREAK_STRATEGY_HIGH_QUALITY`
- `https://developer.android.com/reference/android/text/Layout#BREAK_STRATEGY_BALANCED`

### setEllipsize

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setEllipsize (TextUtils.TruncateAt ellipsize)
```

Set the ellipsizing type. By setting null, the ellipsize is disabled. The default value is `null`.

<br />

| Parameters ||
|---|---|
| `ellipsize` | `TextUtils.TruncateAt`: type of the ellipsize. null for disabling ellipsize. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getEllipsize()`
- `https://developer.android.com/reference/android/text/Layout#getEllipsize()`
- `https://developer.android.com/reference/android/text/TextUtils.TruncateAt`

### setEllipsizedWidth

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setEllipsizedWidth (int ellipsizeWidth)
```

Set the width as used for ellipsizing purpose in pixels. The passed value is ignored and forced to set to the value of width constraint passed in constructor if no ellipsize option is set. The default value is the width constraint.

<br />

| Parameters ||
|---|---|
| `ellipsizeWidth` | `int`: a ellipsizing width in pixels. Value is 0 or greater <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getEllipsizedWidth()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setEllipsizedWidth(int)`

### setFallbackLineSpacingEnabled

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setFallbackLineSpacingEnabled (boolean fallbackLineSpacing)
```

Set whether to respect the ascent and descent of the fallback fonts. Set whether to respect the ascent and descent of the fallback fonts that are used in displaying the text (which is needed to avoid text from consecutive lines running into each other). If set, fallback fonts that end up getting used can increase the ascent and descent of the lines that they are used on. The default value is `false`

<br />

| Parameters ||
|---|---|
| `fallbackLineSpacing` | `boolean`: whether to expand line height based on fallback fonts. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#isFallbackLineSpacingEnabled()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setUseLineSpacingFromFallbacks(boolean)`

### setFontPaddingIncluded

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setFontPaddingIncluded (boolean includeFontPadding)
```

Set whether including extra padding into the first and the last line height. By setting true, the first line of the text and the last line of the text will have extra vertical space for avoiding clipping. The default value is `true`.

<br />

| Parameters ||
|---|---|
| `includeFontPadding` | `boolean`: true for including extra space into first and last line. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#isFontPaddingIncluded()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setIncludePad(boolean)`

### setHyphenationFrequency

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setHyphenationFrequency (int hyphenationFrequency)
```

Set the hyphenation frequency. The default value is `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_NONE`.

<br />

| Parameters ||
|---|---|
| `hyphenationFrequency` | `int`: a hyphenation frequency. Value is one of the following: - `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_NORMAL` - `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_NORMAL_FAST` - `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_FULL` - `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_FULL_FAST` - `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_NONE` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getHyphenationFrequency()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setHyphenationFrequency(int)`
- `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_NONE`
- `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_NORMAL`
- `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_FULL`
- `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_NORMAL_FAST`
- `https://developer.android.com/reference/android/text/Layout#HYPHENATION_FREQUENCY_FULL_FAST`

### setJustificationMode

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setJustificationMode (int justificationMode)
```

Set justification mode. When justification mode is `https://developer.android.com/reference/android/text/Layout#JUSTIFICATION_MODE_INTER_WORD`, the word spacing on the given Paint passed to the constructor will be ignored. This behavior also affects spans which change the word spacing. The default value is `https://developer.android.com/reference/android/text/Layout#JUSTIFICATION_MODE_NONE`.

<br />

| Parameters ||
|---|---|
| `justificationMode` | `int`: justification mode. Value is one of the following: - `https://developer.android.com/reference/android/graphics/text/LineBreaker#JUSTIFICATION_MODE_NONE` - `https://developer.android.com/reference/android/graphics/text/LineBreaker#JUSTIFICATION_MODE_INTER_WORD` - `https://developer.android.com/reference/android/graphics/text/LineBreaker#JUSTIFICATION_MODE_INTER_CHARACTER` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getJustificationMode()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setJustificationMode(int)`
- `https://developer.android.com/reference/android/text/Layout#JUSTIFICATION_MODE_NONE`
- `https://developer.android.com/reference/android/text/Layout#JUSTIFICATION_MODE_INTER_WORD`

### setLeftIndents

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setLeftIndents (int[] leftIndents)
```

Set visually left indents in pixels per lines. For the lines past the last element in the array, the last element repeats. Passing null for disabling indents. Note that even with the RTL layout, this method reserve spacing at the visually left of the line. The default value is `null`.

<br />

| Parameters ||
|---|---|
| `leftIndents` | `int`: array of indents values for the left margins in pixels. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getLeftIndents()`
- `https://developer.android.com/reference/android/text/Layout#getRightIndents()`
- `https://developer.android.com/reference/android/text/Layout.Builder#setRightIndents(int[])`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setIndents(int[],%20int[])`

### setLineBreakConfig

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setLineBreakConfig (LineBreakConfig lineBreakConfig)
```

Set the line break configuration. The default value is a LinebreakConfig instance that has `https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_NONE` and `https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_WORD_STYLE_NONE`.

<br />

| Parameters ||
|---|---|
| `lineBreakConfig` | `LineBreakConfig`: the line break configuration. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getLineBreakConfig()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setLineBreakConfig(android.graphics.text.LineBreakConfig)`

### setLineSpacingAmount

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setLineSpacingAmount (float amount)
```

Set the line spacing amount. The specified amount of pixels will be added to each line. The default value is `0`. The negative value is allowed for squeezing lines.

<br />

| Parameters ||
|---|---|
| `amount` | `float`: an amount of pixels to be added to line height. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getLineSpacingAmount()`
- `https://developer.android.com/reference/android/text/Layout#getSpacingAdd()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setLineSpacing(float,%20float)`

### setLineSpacingMultiplier

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setLineSpacingMultiplier (float multiplier)
```

Set the line spacing multiplier. The specified value will be multiplied to each line. The default value is `1`.

<br />

| Parameters ||
|---|---|
| `multiplier` | `float`: a multiplier to be applied to the line height. Value is 0.0f or greater <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getLineSpacingMultiplier()`
- `https://developer.android.com/reference/android/text/Layout#getSpacingMultiplier()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setLineSpacing(float,%20float)`

### setMaxLines

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setMaxLines (int maxLines)
```

Set the maximum number of lines. The default value is unlimited.

<br />

| Parameters ||
|---|---|
| `maxLines` | `int`: maximum number of lines in the layout. Value is 1 or greater <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getMaxLines()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setMaxLines(int)`

### setMinimumFontMetrics

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setMinimumFontMetrics (Paint.FontMetrics minimumFontMetrics)
```

Set the minimum font metrics used for line spacing.

`null` is the default value. If `null` is set or left it as default, the font metrics obtained by `https://developer.android.com/reference/android/graphics/Paint#getFontMetricsForLocale(android.graphics.Paint.FontMetrics)` is used.

The minimum meaning here is the minimum value of line spacing: maximum value of `https://developer.android.com/reference/android/graphics/Paint#ascent()`, minimum value of `https://developer.android.com/reference/android/graphics/Paint#descent()`.

By setting this value, each line will have minimum line spacing regardless of the text rendered. For example, usually Japanese script has larger vertical metrics than Latin script. By setting the metrics obtained by `https://developer.android.com/reference/android/graphics/Paint#getFontMetricsForLocale(android.graphics.Paint.FontMetrics)` for Japanese or leave it `null` if the Paint's locale is Japanese, the line spacing for Japanese is reserved if the text is an English text. If the vertical metrics of the text is larger than Japanese, for example Burmese, the bigger font metrics is used.

<br />

| Parameters ||
|---|---|
| `minimumFontMetrics` | `Paint.FontMetrics`: A minimum font metrics. Passing `null` for using the value obtained by `https://developer.android.com/reference/android/graphics/Paint#getFontMetricsForLocale(android.graphics.Paint.FontMetrics)` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/TextView#setMinimumFontMetrics(android.graphics.Paint.FontMetrics)`
- `https://developer.android.com/reference/android/widget/TextView#getMinimumFontMetrics()`
- `https://developer.android.com/reference/android/text/Layout#getMinimumFontMetrics()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setMinimumFontMetrics(android.graphics.Paint.FontMetrics)`
- `https://developer.android.com/reference/android/text/DynamicLayout.Builder#setMinimumFontMetrics(android.graphics.Paint.FontMetrics)`

### setRightIndents

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setRightIndents (int[] rightIndents)
```

Set visually right indents in pixels per lines. For the lines past the last element in the array, the last element repeats. Passing null for disabling indents. Note that even with the RTL layout, this method reserve spacing at the visually right of the line. The default value is `null`.

<br />

| Parameters ||
|---|---|
| `rightIndents` | `int`: array of indents values for the right margins in pixels. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getLeftIndents()`
- `https://developer.android.com/reference/android/text/Layout#getRightIndents()`
- `https://developer.android.com/reference/android/text/Layout.Builder#setLeftIndents(int[])`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setIndents(int[],%20int[])`

### setShiftDrawingOffsetForStartOverhang

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setShiftDrawingOffsetForStartOverhang (boolean shiftDrawingOffsetForStartOverhang)
```

Set true for shifting the drawing x offset for showing overhang at the start position. This flag is ignored if the `https://developer.android.com/reference/android/text/Layout#getUseBoundsForWidth()` is false. If this value is false, the Layout draws text from the zero even if there is a glyph stroke in a region where the x coordinate is negative. If this value is true, the Layout draws text with shifting the x coordinate of the drawing bounding box. This value is false by default.

<br />

| Parameters ||
|---|---|
| `shiftDrawingOffsetForStartOverhang` | `boolean`: true for shifting the drawing offset for showing the stroke that is in the region where the x coordinate is negative. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout.Builder#setUseBoundsForWidth(boolean)`
- `https://developer.android.com/reference/android/text/Layout#getUseBoundsForWidth()`

### setTextDirectionHeuristic

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setTextDirectionHeuristic (TextDirectionHeuristic textDirection)
```

Set the text direction heuristics. The text direction heuristics is used to resolve text direction on the text. The default value is `https://developer.android.com/reference/android/text/TextDirectionHeuristics#FIRSTSTRONG_LTR`

<br />

| Parameters ||
|---|---|
| `textDirection` | `TextDirectionHeuristic`: a text direction heuristic. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/TextDirectionHeuristics`
- `https://developer.android.com/reference/android/text/Layout#getTextDirectionHeuristic()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setTextDirection(android.text.TextDirectionHeuristic)`

### setUseBoundsForWidth

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Layout.Builder setUseBoundsForWidth (boolean useBoundsForWidth)
```

Set true for using width of bounding box as a source of automatic line breaking and drawing. If this value is false, the Layout determines the drawing offset and automatic line breaking based on total advances. By setting true, use all joined glyph's bounding boxes as a source of text width. If the font has glyphs that have negative bearing X or its xMax is greater than advance, the glyph clipping can happen because the drawing area may be bigger. By setting this to true, the Layout will reserve more spaces for drawing.

<br />

| Parameters ||
|---|---|
| `useBoundsForWidth` | `boolean`: True for using bounding box, false for advances. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/Layout.Builder` | this builder instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/text/Layout#getUseBoundsForWidth()`
- `https://developer.android.com/reference/android/text/StaticLayout.Builder#setUseBoundsForWidth(boolean)`