【问题标题】:android : i want use my custom font with WebViewbandroid:我想使用我的自定义字体和 WebViewb
【发布时间】:2011-11-25 04:47:28
【问题描述】:

我想在 WebViewb 中使用我的自定义字体
我的 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 fonts android-webview android-fonts


【解决方案1】:

我的问题是 MyFont.TTF,但它必须是 MyFont.ttf
ttf 与 linux/android 中的 TTF 不同。
:-)
android : html loaded without font

【讨论】:

    【解决方案2】:

    解决方案在此处记录: How to use custom font with WebView

    这是否类似于您尝试在 html 文件中使用的内容? 在这种情况下,使用相对于您的资产文件夹的 url?

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

    【讨论】:

    • “失败”? “失败”是什么意思?请提供有关您尝试时发生的情况的更多信息。
    猜你喜欢
    • 2022-11-23
    • 2012-02-14
    • 2021-03-14
    • 1970-01-01
    • 2020-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-02
    相关资源
    最近更新 更多