```Fatal Exception: java.lang.IllegalStateException Cannot create Typeface from ResourceFont(resId=2...
a
Copy code
Fatal Exception: java.lang.IllegalStateException
Cannot create Typeface from ResourceFont(resId=2131296258, weight=FontWeight(weight=600), style=Normal)
I’m using a custom font. This is working fine on Android 11 but crashing on Android 10. Any idea why?
2
I’m using
Copy code
val IbmPlexSansFontFamily = FontFamily(
    Font(R.font.ibm_plex_regular),
    Font(R.font.ibm_plex_medium, FontWeight.Medium),
    Font(R.font.ibm_plex_semi_bold, FontWeight.SemiBold),
)
Copy code
Fatal Exception: java.lang.IllegalStateException
Cannot create Typeface from ResourceFont(resId=2131296258, weight=FontWeight(weight=600), style=Normal)
keyboard_arrow_up
androidx.compose.ui.text.platform.TypefaceAdapter.create (TypefaceAdapter.java:243)
androidx.compose.ui.text.platform.TypefaceAdapter.create (TypefaceAdapter.java:143)
androidx.compose.ui.text.platform.extensions.TextPaintExtensions_androidKt.createTypeface (TextPaintExtensions_androidKt.java:123)
androidx.compose.ui.text.platform.extensions.TextPaintExtensions_androidKt.applySpanStyle (TextPaintExtensions_androidKt.java:53)
androidx.compose.ui.text.platform.AndroidParagraphIntrinsics.<init> (AndroidParagraphIntrinsics.java:66)
androidx.compose.ui.text.platform.AndroidParagraphIntrinsics_androidKt.ActualParagraphIntrinsics (AndroidParagraphIntrinsics_androidKt.java:128)
androidx.compose.ui.text.ParagraphIntrinsicsKt.ParagraphIntrinsics (ParagraphIntrinsicsKt.java:54)
androidx.compose.ui.text.MultiParagraphIntrinsics.<init> (MultiParagraphIntrinsics.java:76)
androidx.compose.foundation.text.TextDelegate.layoutIntrinsics (TextDelegate.java:126)
androidx.compose.foundation.text.TextDelegate.layoutText-K40F9xA (TextDelegate.java:150)
androidx.compose.foundation.text.TextDelegate.layout-NN6Ew-U (TextDelegate.java:227)
androidx.compose.foundation.text.TextController$measurePolicy$1.measure-3p2s80s (TextController.java:256)
androidx.compose.ui.node.InnerPlaceable.performMeasure-BRTryo0 (InnerPlaceable.java:45)
a
Looks like something we should investigate. Please file it on the issue tracker with the info above
cc @Siyamed
s
looks like we didnt rethrow the expeptions in the source code, but that message only.
please create a ticket
looks like we didnt rethrow the expeptions in the source code, but that message only.
Let me rephare this: since the exception is ignored and not provided to the compose, looking at the exception I do not understand why it fails. If it worked on Android 11, but does not work on Android 10, there is almost no possibility that we can fix it on Compose.
The only action we can do is to include why the font loading is failed. Still a ticket would be good to have a discussion with other team members.
k
Is it related to use the downloadable font on the phone that doesn't have GMS?
r
Facing the same issue on beta06 and it has been working fine up until beta05. Created the issue --> https://issuetracker.google.com/issues/187627758
s
any update on this?