Does anyone have insight into how to properly defi...
# compose-android
d
Does anyone have insight into how to properly define variable fonts in a FontFamily? I'm having a weird issue when using variable fonts. If I define the font like this it seems to work:
Copy code
private val proximaVara = FontFamily(
    Font(
        R.font.proximavara,
        variationSettings = FontVariation.Settings(
            FontVariation.weight(FontWeight.Normal.weight),
        )
    ),
)
but if I define it like this it doesn't seem to work
Copy code
private val proximaVara = FontFamily(
    Font(
        R.font.proximavara,
//        variationSettings = FontVariation.Settings(
//            FontVariation.weight(FontWeight.Normal.weight),
//        )
    ),
)
They look functionally equivalent when I drill into the functions, but they are rendered completely different as you can see in the screenshots - @David Corrado fyi for reference here is the entire type class (it's the default app implementation in the AS app wizard)
Copy code
private val proximaVara = FontFamily(
    Font(
        R.font.proximavara,
//        variationSettings = FontVariation.Settings(
//            FontVariation.weight(FontWeight.Normal.weight),
//        )
    ),
)

// Set of Material typography styles to start with
val Typography = Typography(
    bodyLarge = TextStyle(
        fontFamily = proximaVara,
        fontWeight = FontWeight.Normal,
        fontSize = 16.sp,
        lineHeight = 24.sp,
        letterSpacing = 0.5.sp
    )
    /* Other default text styles to override
    titleLarge = TextStyle(
        fontFamily = FontFamily.Default,
        fontWeight = FontWeight.Normal,
        fontSize = 22.sp,
        lineHeight = 28.sp,
        letterSpacing = 0.sp
    ),
    labelSmall = TextStyle(
        fontFamily = FontFamily.Default,
        fontWeight = FontWeight.Medium,
        fontSize = 11.sp,
        lineHeight = 16.sp,
        letterSpacing = 0.5.sp
    )
    */
)