3

i want use my custom font with WebViewb
my html file loaded in webView but still without font
my font has Unicode characters
i work on android 2.2

mWebView.loadUrl("file:///android_asset/P_007.html");       

my css:

<STYLE type="text/css">
 @font-face {
    font-family: AQF_P007_HA;
    src: url("AQF_P007_HA.TTF");    
}
body {
    font-family: AQF_P007_HA;    
    font-style:normal;
    font-weight: normal;
    color: black;    
    font-size: medium;
    mso-font-charset: 0
}
</STYLE>
Ahmed Al Khashab
  • 373
  • 1
  • 9
  • 19

2 Answers2

5

A solution is document here: How to use custom font with WebView

is this similar to what you tried to use in your html file? With the url relative to your assets folder in this case?

@font-face {
   font-family: 'AQF_P001_HA';
   src: url('AQF_P001_HA.TTF');
}

body {font-family: 'AQF_P001_HA';}
Community
  • 1
  • 1
blad
  • 665
  • 5
  • 8
0

my problem was MyFont.TTF but it must be MyFont.ttf
ttf is different from TTF in linux/android.
:-)
android : html loaded without font

Community
  • 1
  • 1
Ahmed Al Khashab
  • 373
  • 1
  • 9
  • 19