As a mobile app developer, you always want to style text appropriately. Let’s check how to make a text italic in Android using Jetpack Compose.
The TextStyle and FontStyle help to make the Text composable italic.
@Composable
fun TextExample() {
Text(text = "Italic Text Example",
fontSize = 24.sp,
style = TextStyle(fontStyle = FontStyle.Italic)
)
}
Following is the output.

Following is the complete code for reference.
package com.example.myapplication
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.sp
import com.example.myapplication.ui.theme.MyApplicationTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyApplicationTheme {
Surface(
color = MaterialTheme.colors.background,
modifier = Modifier.fillMaxSize()
) {
TextExample()
}
}
}
}
}
@Composable
fun TextExample() {
Text(text = "Italic Text Example",
fontSize = 24.sp,
style = TextStyle(fontStyle = FontStyle.Italic)
)
}
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
MyApplicationTheme {
TextExample()
}
}
If you want to make text bold then see this blog post.
I hope this Jetpack Compose Text Italic tutorial is helpful for you.