Question: I'm learning to use Android Jetpack Compose.
Now I have a **Regular.otf** font file in **assets/font**. I want to use it in Text.

```
java.lang.RuntimeException: Font asset not found /commonui/src/main/assets/font/Regular.otf
    at android.graphics.Typeface.createFromFile(Typeface.java:998)
    at android.graphics.Typeface.createFromFile(Typeface.java:1012)

```

I tried some methods but none of them solved.

```
    val fontFamily = FontFamily(
        typeface = Typeface.createFromFile("commonui/src/main/assets/font/Regular.otf")
    )
    Text(
        text = "Font",
        style = TextStyle(fontFamily = fontFamily)
    )

```

Answer: 
replace line with this

typeface = Typeface.createFromAsset(getAssets(),"font/Regular.otf")

Happy Coding!
You need to rename your font to lower cases as per google recommendations.

Further you can set font using:

```
  myTextView.typeface = ResourcesCompat.getFont(this, R.font.regular)

```

For more details refer to :  

<https://johncodeos.com/how-to-add-custom-fonts-in-your-android-app-using-kotlin/>