This is how I define my fonts until now:
val 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 ...]
)