search

Home  >  Q&A  >  body text

java - android webview 在线网页 如何加载本地字体库?

测试网页:
http://1.testmyhtml.applinzi....

网页源码:

<html>

<head>
    <meta charset="utf-8">
    <title>
        测试页面
    </title>
    <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">

    <style>
        
        @font-face {
            font-family: 'MyCustomFont';
            src: url('file:///android_asset/fonts/dfgb_k.ttf');
        }
        p{
            font-family:"MyCustomFont";  
            font-size: x-large;
        }
        
        body {
            margin: 0;
        }
    </style>
</head>

<body>
    <p>我是网页字体我是网页字体我是网页字体我是网页字体我是网页字体我是网页字体我是网页字体</p>
</body>

</html>

直接通过url('file:///android_asset/fonts/dfgb_k.ttf');这种方式加载是不可以

如果是本地网页是可以的,但是怎么解决在线网页呢?

巴扎黑巴扎黑2806 days ago836

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 10:02:16

    Reference: http://blog.csdn.net/u0137181...

    reply
    0
  • Cancelreply