我正在try 将字体添加到我的应用程序中,但当我在Type.kt
文件中声明字体时,我发现以下错误
必须初始化变量"iranSansFontFamily"
为什么会出现此错误?
代码如下:
val CustomTypography = Typography(
bodyLarge = TextStyle(
fontFamily = iranSansFontFamily,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
)
val iranSansFontFamily = FontFamily(
Font(R.font.iransans_farsi_medium, FontWeight.Medium),
Font(R.font.iransans_farsi_bold, FontWeight.Bold)
)