androidx.compose.ui.unit

FontScaling

Interface · from org.jetbrains.compose.ui:ui-unit:1.12.2

No hand-written docs yet.

Converts TextUnit to Dp and vice-versa.

interface FontScaling

Kinds of FontScaling

Anywhere a FontScaling is expected, you can pass any of these.

How to get one

Or create one of the kinds listed above.

Properties

fontScale

val fontScale: Float

Current user preference for the scaling factor for fonts.

Functions

toSp

fun Dp.toSp(): TextUnit

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

toDp

fun TextUnit.toDp(): Dp

Convert Sp to Dp.

Library docs

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.