Stefan Oltmann
03/11/2024, 11:46 AMTypography
?
https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-images-resources.html#fonts shows how we handle a Font, but there is no explanation how this works with Typography.
🧵Stefan Oltmann
03/11/2024, 11:49 AMval roboto: FontFamily = FontFamily(
Font(
resource = "font/roboto_regular_hinted.ttf",
weight = FontWeight.Normal,
style = FontStyle.Normal
),
Font(
resource = "font/roboto_bold_hinted.ttf",
weight = FontWeight.Bold,
style = FontStyle.Normal
),
Font(
resource = "font/roboto_italic_hinted.ttf",
weight = FontWeight.Normal,
style = FontStyle.Italic
)
)
And this is how I use Typography:
val titleFontSize: TextUnit = 32.sp
val largeFontSize: TextUnit = 20.sp
val mediumFontSize: TextUnit = 16.sp
val smallerFontSize: TextUnit = 14.sp
val smallFontSize: TextUnit = 12.sp
val materialTypography = Typography(
headlineLarge = TextStyle(
fontFamily = roboto,
fontWeight = FontWeight.SemiBold,
fontSize = titleFontSize,
// lineHeight = 40.sp,
letterSpacing = 0.sp
),
headlineMedium = TextStyle(
fontFamily = roboto,
fontWeight = FontWeight.SemiBold,
fontSize = 28.sp,
// lineHeight = 36.sp,
letterSpacing = 0.sp
),
headlineSmall = TextStyle(
fontFamily = roboto,
fontWeight = FontWeight.SemiBold,
fontSize = 24.sp,
// lineHeight = 32.sp,
letterSpacing = 0.sp
),
[... snip ...]
)
Stefan Oltmann
03/11/2024, 11:49 AMStefan Oltmann
03/11/2024, 11:50 AMStefan Oltmann
03/11/2024, 11:51 AMFont
to be @Composable
?Stefan Oltmann
03/12/2024, 6:46 AMMarcin Wisniowski
03/15/2024, 10:04 AMMarcin Wisniowski
03/15/2024, 10:05 AM