JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.24k stars 1.11k forks source link

[Android] update Font with new resource value #4864

Closed PhilipDukhov closed 1 month ago

PhilipDukhov commented 1 month ago

Fixes #4863

Before this update, when a new resource value was passed to org.jetbrains.compose.resources.Font composable, it kept the original value.

Test sample code. Res.font here is autogenerated from commonMain/composeResources/font/ folder content.

var flag by remember {
    mutableStateOf(false)
}
Column {
    Text(
        "hey",
        fontFamily = FontFamily(Font(if (flag) Res.font.HelveticaNeueMedium else Res.font.COMICSANS, FontWeight.Normal))
    )
    Switch(checked = flag, onCheckedChange = { flag = it })
}

Release Notes

Fixes - Resources