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

Marcin Wisniowski

03/04/2022, 10:05 PM
Is it not possible to load fonts from resources in Compose previews?
s

Siyamed

03/04/2022, 10:49 PM
Is it you are looking for Font(resourceId) or they work on device but not preview?
Cc @Sean McQuillan [G]
m

Marcin Wisniowski

03/05/2022, 12:14 AM
They work on device, but crash on preview with
android.content.res.Resources$NotFoundException: Font resource ID #0x7f090002 could not be retrieved.
I'm using
ResourcesCompat.getFont(context, R.font.roboto_bold
in order to use the font in a Canvas.
I assume the problem is trying to use the context, but what is the solution?
s

Sean McQuillan [G]

05/03/2022, 4:22 PM
Much delayed. Can you please file a bug with a repro case for this, it's a tooling issue that we'll need to fix. Thanks!
44 Views