I use the external TrueType font in the embedded HTML resource. The font is in assets at the same level as the HTML resource.
The font is loaded using CSS:
@font-face {
font-family: MyExternalFont;
src: url('MyExternalFont.ttf');
}
body {
font-family:MyExternalFont;
}
And the HTML resource is loaded as follows:
WebView w = (WebView) findViewById(R.id.webview);
w.loadUrl("file:///android_asset/index.htm");
This works fine in Android 1.5 , Android 1.6 and Android 2.2 . It does not work in Android 2.1 .
However, when I download the font and use it in TextView, it works on all versions of Android. I do it like this:
final Typeface t = Typeface.createFromAsset(getContext().getAssets(), "MyExternalFont.ttf");
textView.setTypeface(t);
What could be the problem?
(Unfortunately, I cannot download the font because it is a paid font)