【问题标题】:android : html loaded without fontandroid:没有字体加载的html
【发布时间】:2012-03-25 18:03:06
【问题描述】:

我的 html 文件在 webView 中加载但仍然没有字体
我的字体有 Unicode 字符
我在 android 2.2 上工作

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

我的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>

【问题讨论】:

    标签: android css android-webview android-fonts


    【解决方案1】:

    将字体复制到资产文件夹中的目录中,例如“fonts”并使用它来代替:

    <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>
    

    【讨论】:

    • @Ahmed 你会检查 AQF_P007_HA.ttf 之类的错误
    • ttf 与 linux/android 中的 TTF 不同。您是否检查了整个字体名称的字母大小写?
    • 非常感谢,这确实是我的问题,但我不知道这个
    猜你喜欢
    • 1970-01-01
    • 2013-07-14
    • 2017-07-29
    • 1970-01-01
    • 2017-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多