https://kotlinlang.org logo
#compose
Title
# compose
m

Mark

10/17/2023, 6:03 AM
Should these two be equivalent?
Copy code
val fontFamily = FontFamily(Font(filename, LocalContext.current.assets))
and
Copy code
val typeface = android.graphics.Typeface.createFromAsset(LocalContext.current.assets, filename)!!
val fontFamily = FontFamily(typeface)
Because I’m finding that
fontWeight = FontWeight.Bold
works with the first, but not the second.
FontSynthesis.All
makes no difference in both cases. EDIT: I see the first one does this under the hood, so I guess that explains it:
Copy code
Typeface.Builder(assetManager, path)
            .setFontVariationSettings(variationSettings.toVariationSettings(context))
            .build()