Created
July 30, 2021 07:57
-
-
Save AsadLeo14/0d5043978f8a91052b80abf407225099 to your computer and use it in GitHub Desktop.
Access custom font from assets in Jetpack Compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@OptIn(ExperimentalTextApi::class) | |
@Composable | |
fun fontFamily() = FontFamily( | |
Font(LocalContext.current.assets,"myfont.ttf") | |
) | |
@Composable | |
fun typography() = Typography( | |
h1 = TextStyle( | |
fontFamily = fontFamily(), | |
fontWeight = FontWeight.Bold, | |
fontSize = 30.sp | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment