https://kotlinlang.org logo
#compose-android
Title
# compose-android
d

dazza5000

12/13/2023, 5:43 PM
Can anyone help me determine why configuring roboto flex using jetpack compose typography API's renders differently than roboto using GenericFontFamily access?
Copy code
Row {
                MaterialTheme(
                    typography = robotoTypography(),
                ) {
                    Column {
                        Text("b",
                            style = MaterialTheme.typography.headlineLarge.copy(
//                                fontSynthesis = FontSynthesis.None
                            ),
                            maxLines = 1
                        )
                    }
                }

                MaterialTheme {
                    Column {
                        Text("b",
                            style = MaterialTheme.typography.headlineLarge.copy(
//                                fontSynthesis = FontSynthesis.None
                            ),
                            maxLines = 1
                        )
                    }
                }


            }
another sample
Here is another one that has two custom fonts and the default/generic font

https://github.com/dazza5000/fontsforever/blob/master/three_font_variant.png

Screenshot_20231213_230546.png
Setting includeFontPadding to false results in a more consistent rendering as seen below
I found a solution for this and posted it here https://stackoverflow.com/a/77704556/3268303
It looks like this will no longer be relevant in upcoming versions of compose material 3 libs
2 Views