0

i have added html and css file in assets folder of android project directory and i want a font to be loaded from new font support i.e. font/somefont.ttf

i have tried adding different ways but none worked like as explained here Use custom font from res/font with WebView in Android

@font-face {
  font-family: jost;
  font-weight: normal;
  src: url("file:///android_res/font/jost_400_book.ttf");
}

it should give apply font but i get get this exception in console

java.lang.ClassNotFoundException: Didn't find class "com.turningpoint.turningpoint.staging.R$font"

and no font is loadded.

2 Answers2

0

check your font folder android_res/font/ exist

src: url("file:///android_res/font/jost_400_book.ttf");

use this

src: url("file:///android_asset/fonts/MyFont.otf")
Chanaka Weerasinghe
  • 5,404
  • 2
  • 26
  • 39
0

I have added and html and css file in assets folder of android project directory

But I'm not seeing that you are pointing assets folder, you are pointing android_res can you try this one? :

src: url('file:///android_asset/font/jost_400_book.ttf');
Skizo-ozᴉʞS ツ
  • 19,464
  • 18
  • 81
  • 148