# EmphasisSpan

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/EmphasisSpan.kt+class:androidx.text.vertical.EmphasisSpan) Added in [1.0.0-beta03](https://developer.android.com/jetpack/androidx/releases/text#1.0.0-beta03)

*** ** * ** ***


```
class EmphasisSpan : ReplacementSpan
```

<br />

|---|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||||
| ↳ | [android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html) ||||
|   | ↳ | [android.text.style.MetricAffectingSpan](https://developer.android.com/reference/android/text/style/MetricAffectingSpan.html) |||
|   |   | ↳ | [android.text.style.ReplacementSpan](https://developer.android.com/reference/android/text/style/ReplacementSpan.html) ||
|   |   |   | ↳ | [androidx.text.vertical.EmphasisSpan](https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan) |

*** ** * ** ***

A span that applies emphasis marks to text in a vertical layout.

This span is designed for use with `https://developer.android.com/reference/kotlin/androidx/text/vertical/VerticalTextLayout` and will not have an effect in other contexts. It allows for the application of various emphasis styles, such as dots, circles, or triangles, above or next to characters in vertical text.

The `EmphasisSpan` takes a style, a boolean indicating whether the mark should be filled, and a scale factor for the size of the mark.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#DEFAULT_EMPHASIS_FILL() = true` The default value for whether the emphasis mark should be filled. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#DEFAULT_SCALE() = 0.5f` The default scale factor for emphasis marks. |

| ### Public companion properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisStyle` | `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#DEFAULT_EMPHASIS_STYLE()` The default style used for emphasis marks, typically a dot. |
| `https://developer.android.com/reference/kotlin/androidx/text/vertical/AnnotationPosition` | `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#DEFAULT_POSITION()` The default position of the emphasis mark relative to the text. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#EmphasisSpan(androidx.text.vertical.EmphasisStyle,kotlin.Boolean,androidx.text.vertical.AnnotationPosition,kotlin.Float)( style: https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisStyle, isFilled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, position: https://developer.android.com/reference/kotlin/androidx/text/vertical/AnnotationPosition, scale: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` |

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#draw(android.graphics.Canvas,kotlin.CharSequence,kotlin.Int,kotlin.Int,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,android.graphics.Paint)( canvas: https://developer.android.com/reference/android/graphics/Canvas.html, text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, top: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, bottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, paint: https://developer.android.com/reference/android/graphics/Paint.html )` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#getSize(android.graphics.Paint,kotlin.CharSequence,kotlin.Int,kotlin.Int,android.graphics.Paint.FontMetricsInt)( paint: https://developer.android.com/reference/android/graphics/Paint.html, text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, fm: https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt.html? )` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#isFilled()` Whether the mark should be filled or outlined. |
| `https://developer.android.com/reference/kotlin/androidx/text/vertical/AnnotationPosition` | `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#position()` The position of the emphasis mark relative to the text. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#scale()` The scale factor for the size of the mark. |
| `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisStyle` | `https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisSpan#style()` The style of the emphasis mark. |

### Inherited functions

From [android.text.style.ReplacementSpan](https://developer.android.com/reference/android/text/style/ReplacementSpan.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/text/style/ReplacementSpan.html#updateDrawState(android.text.TextPaint)(ds: https://developer.android.com/reference/android/text/TextPaint.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/text/style/ReplacementSpan.html#updateMeasureState(android.text.TextPaint)(p: https://developer.android.com/reference/android/text/TextPaint.html)`

### Inherited properties

From [android.text.style.MetricAffectingSpan](https://developer.android.com/reference/android/text/style/MetricAffectingSpan.html) `open https://developer.android.com/reference/android/text/style/MetricAffectingSpan.html` `https://developer.android.com/reference/android/text/style/MetricAffectingSpan.html#underlying` From [android.text.style.ReplacementSpan](https://developer.android.com/reference/android/text/style/ReplacementSpan.html) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` `https://developer.android.com/reference/android/text/style/ReplacementSpan.html#contentDescription`

## Constants

### DEFAULT_EMPHASIS_FILL

```
const val DEFAULT_EMPHASIS_FILL = true: Boolean
```

The default value for whether the emphasis mark should be filled.

### DEFAULT_SCALE

```
const val DEFAULT_SCALE = 0.5f: Float
```

The default scale factor for emphasis marks.

## Public companion properties

### DEFAULT_EMPHASIS_STYLE

```
val DEFAULT_EMPHASIS_STYLE: EmphasisStyle
```

The default style used for emphasis marks, typically a dot.

### DEFAULT_POSITION

```
val DEFAULT_POSITION: AnnotationPosition
```

The default position of the emphasis mark relative to the text.

## Public constructors

### EmphasisSpan

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

```
EmphasisSpan(
    style: EmphasisStyle = DEFAULT_EMPHASIS_STYLE,
    isFilled: Boolean = DEFAULT_EMPHASIS_FILL,
    position: AnnotationPosition = AnnotationPosition.Before,
    scale: Float = DEFAULT_SCALE
)
```

| Parameters |
|---|---|
| `style: https://developer.android.com/reference/kotlin/androidx/text/vertical/EmphasisStyle = DEFAULT_EMPHASIS_STYLE` | The style of the emphasis mark. |
| `isFilled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = DEFAULT_EMPHASIS_FILL` | Whether the mark should be filled or outlined. When `true`, the emphasis mark will be drawn as a solid shape. When `false`, it will be drawn as an outline. |
| `position: https://developer.android.com/reference/kotlin/androidx/text/vertical/AnnotationPosition = AnnotationPosition.Before` | The position of the emphasis mark relative to the text. `https://developer.android.com/reference/kotlin/androidx/text/vertical/AnnotationPosition#Before()` puts the mark on the right side in vertical writing mode and above the text in horizontal writing mode. `https://developer.android.com/reference/kotlin/androidx/text/vertical/AnnotationPosition#After()` puts it on the opposite side. |
| `scale: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = DEFAULT_SCALE` | The scale factor for the size of the mark. This value determines the size of the emphasis mark relative to the font size. A scale of 0.5f means the emphasis mark will be half the size of the text. |

## Public functions

### draw

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

```
open fun draw(
    canvas: Canvas,
    text: CharSequence?,
    start: Int,
    end: Int,
    x: Float,
    top: Int,
    y: Int,
    bottom: Int,
    paint: Paint
): Unit
```

### getSize

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

```
open fun getSize(
    paint: Paint,
    text: CharSequence?,
    start: Int,
    end: Int,
    fm: Paint.FontMetricsInt?
): Int
```

## Public properties

### isFilled

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

```
val isFilled: Boolean
```

Whether the mark should be filled or outlined. When `true`, the emphasis mark will be drawn as a solid shape. When `false`, it will be drawn as an outline.

### position

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

```
val position: AnnotationPosition
```

The position of the emphasis mark relative to the text. `https://developer.android.com/reference/kotlin/androidx/text/vertical/AnnotationPosition#Before()` puts the mark on the right side in vertical writing mode and above the text in horizontal writing mode. `https://developer.android.com/reference/kotlin/androidx/text/vertical/AnnotationPosition#After()` puts it on the opposite side.

### scale

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

```
val scale: Float
```

The scale factor for the size of the mark. This value determines the size of the emphasis mark relative to the font size. A scale of 0.5f means the emphasis mark will be half the size of the text.

### style

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

```
val style: EmphasisStyle
```

The style of the emphasis mark.