0

While using Jetpack Compose Text() I am not able to change the fontWeight more than FontWeight.W600 and FontWeight.W500. Others than these two none gets applied like FontWeight.W700, FontWeight.Bold , FontWeight(550) etc. I was trying to create text with too dark but not able to achieve at all. Note: I am using Roboto font from google downloadable font and material theme 3.

One example of text code:-

Text(
   modifier = Modifier.padding(top = 4.dp),
   text = "This should be too bold",
   style = MaterialTheme.typography.titleSmall,
   fontWeight = FontWeight.Black,
)
Jeevan Rupacha
  • 3,055
  • 1
  • 15
  • 29

1 Answers1

1

From official Android Compose documentation:

@Composable
fun BoldText() {
    Text("Hello World", fontWeight = FontWeight.Bold)
}

If you need additional styles (from Material Design 3 documentation):

Text(
   text = "Hello World",
   style = MaterialTheme.typography.displayLarge,
   color = MaterialTheme.colorScheme.primary,
)

You can also try downloading the font from Google Fonts by manually selecting the style Black 900:

enter image description here

Mikhail
  • 2,612
  • 3
  • 22
  • 37