In Jetpack Compose, you can set your specific font by editing the type
file:
val MyFont= FontFamily(
Font(R.font.myfont, FontWeight.Normal)
)
// Set of Material typography styles to start with
val Typography = Typography(
body1 = TextStyle(
fontFamily = MyFont,
fontWeight = FontWeight.Normal,
fontSize = 16.sp
),
button = TextStyle(
fontFamily = MyFont,
fontWeight = FontWeight.SemiBold,
fontSize = 14.sp
),
defaultFontFamily = MyFont
)
But my problem is that I have multiple locales, and I want to set the specific font for each one.
Before using Compose, my approach was to create a style.xml
file in each language values folder
and edit the style.xml
in a way that changes the font family. but this approach won't work when using Compose.
So how can I have a different font family for each locale?