Hi guys. I have a question regarding fonts and lin...
# compose
g
Hi guys. I have a question regarding fonts and line heights. So if a Text composable has both lineHeight and font specified then lineHeight does not have effect. Is it expected or something wrong with font?
Copy code
@Composable
@Preview
fun App() {
    MaterialTheme {

        Column(
            modifier = Modifier.fillMaxWidth(),
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            Text(
                text = "Click me!",
                modifier = Modifier.border(2.dp, Color.Red),
                lineHeight = 44.sp // This does works
            )
            Text(
                text = "Click me!",
                modifier = Modifier.border(2.dp, Color.Red),
                lineHeight = 44.sp,
                style =  TextStyle(
                    fontFamily = FontFamily(Font(Res.font.Inter_VariableFont_opsz_wght)),
//                    fontSize = 12.sp,
                    lineHeight = 44.sp, // This does not work
                )
            )
            Text(
                text = "Click me!",
                modifier = Modifier.border(2.dp, Color.Red),
                lineHeight = 44.sp,
                style =  TextStyle(
                    fontFamily = FontFamily(Font(Res.font.Inter_24pt_Regular)),
                    fontSize = 22.sp,
                    lineHeight = 44.sp,
                )
            )
            Text("Click me! Click me! Click me!")
            Text("Click me!")
        }

    }
}
Im using CMP 1.6.11, got the project from kmp.jetbrains.com
nevermind guys. fixed it by
Copy code
lineHeightStyle = LineHeightStyle(
                            LineHeightStyle.Alignment.Center,
                            trim = LineHeightStyle.Trim.None
                        )
❤️ 1