---
title: "TextGranularity"
description: "Used by [Paragraph.getRangeForRect]. It specifies the minimal unit of the text ranges that is
considered by the [Paragraph.getRangeForRect]."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
value class TextGranularity private constructor(private val value: Int)
```


Used by `Paragraph.getRangeForRect`. It specifies the minimal unit of the text ranges that is
considered by the `Paragraph.getRangeForRect`.


## Companion Object

#### Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Character = TextGranularity(0)
```


Character level granularity. The text string will be break into ranges each corresponding
to a visual character. e.g. "Hi \uD83D\uDE00" will be break into: 'H', 'i', ' ',
'\uD83D\uDE00' (grin face emoji).



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Word = TextGranularity(1)
```


Word level granularity. The text string will be break into ranges each corresponding to a
word. e.g. "Hello world" wil be break into "Hello", "world" the space character is not
considered as a word.





