Hi What is the best approach to use `FontFamily`...
# webassembly
a
Hi What is the best approach to use
FontFamily
and
Font
for web (wasm) , The following snippet was actually trying to fetch the fonts every single time it was called, (ofc crashed with memory issues)
Copy code
@Composable
fun DmSans() = FontFamily(
    Font(Res.font.dmsans_regular, weight = FontWeight.W400),
    Font(Res.font.dmsans_medium, weight = FontWeight.W600),
)
d
You could use MaterialTheme and pass your fonts there. Or create an own Theme/Composition local to provide the fonts to the composables. https://developer.android.com/develop/ui/compose/designsystems/custom?hl=de#implementing-fully-custom
👀 1
So you load the fonts only once
a
Thank you @Daniel Weidensdörfer ! Composition provider solved it , now loads once and smooth
👍 3