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


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

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



```kotlin
@JvmDefaultWithCompatibility
expect interface FontScaling
```


Converts `TextUnit` to `Dp` and vice-versa.

If you are implementing this interface yourself on Android, please check the docs for important
optimization tips about caching.


## Properties

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


```kotlin
val fontScale: Float
```


Current user preference for the scaling factor for fonts.



## Functions



<h2 id="tosp">toSp</h2>

```kotlin
open fun Dp.toSp(): TextUnit
```


Convert `Dp` to Sp. Sp is used for font size, etc.




<hr class="docs-overload-divider">


<h2 id="todp">toDp</h2>

```kotlin
open fun TextUnit.toDp(): Dp
```


Convert Sp to `Dp`.



<div class='sourceset sourceset-android'>Android</div>



```kotlin
@JvmDefaultWithCompatibility
actual interface FontScaling
```


Converts `TextUnit` to `Dp` and vice-versa.

Note that the converter can't be cached in the interface itself. FontScaleConverterFactory
already caches the tables, but it still does a a map lookup for each conversion. If you are
implementing this interface, you should cache your own converter for additional speed.


## Properties

<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual val fontScale: Float
```


Current user preference for the scaling factor for fonts.



## Functions



<hr class="docs-overload-divider">


<h2 id="tosp-2">toSp</h2>

```kotlin
actual fun Dp.toSp(): TextUnit
```


Convert `Dp` to Sp. Sp is used for font size, etc.




<hr class="docs-overload-divider">


<h2 id="todp-2">toDp</h2>

```kotlin
actual fun TextUnit.toDp(): Dp
```


Convert Sp to `Dp`.