android : html loaded without font

戏子无情 提交于 2019-12-08 04:09:38

问题


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>

回答1:


copy font to a directory in asset folder like "fonts" and use this instead:

<STYLE type="text/css">
 @font-face {
    font-family: AQF_P007_HA;
    src: url('file:///android_asset/fonts/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>


来源:https://stackoverflow.com/questions/9859032/android-html-loaded-without-font

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!