Embedding fonts in iPad

风流意气都作罢 提交于 2019-12-06 08:34:31

Boy, have I got a great answer for you! I had the same problem and this worked like a charm.

You have to use the Google API loader. Here's the code I put into my header tag.

<!-- Google API Loader -->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>

<script type="text/javascript">
    //load jQuery
    google.load("jquery", "1.7.1");

    //Google Fonts
    google.load("webfont", "1");

    google.setOnLoadCallback(function() {
        WebFont.load({
            google: {
              families: [ 'Lobster+Two:700italic,700,400italic,400', 'Alegreya:400,400italic,700' ]
            }
        });
    });
    </script>

Here is some info about the API loader: https://developers.google.com/loader/?hl=ja#intro

And some info about using it with Google Fonts: https://developers.google.com/webfonts/docs/webfont_loader

The problem is the woff format. Google know that and he return you a different css when you use Safari in PC or in iPad. The correct CSS is:

@font-face {
 font-family: 'Monofett';
 font-style: normal;
 font-weight: normal;
 src: local('Monofett'), url('./BezoWS-9nng_g31KmAteQ3YhjbSpvc47ee6xR_80Hnw.ttf') format('truetype');
}

Here is an cwTeXHei version , for support google web fonts on iPhone browser

@font-face {
  font-family: 'cwTeXHei';
  font-style: normal;
  font-weight: normal;
  src: local('cwTeXHei'), url('./fonts/cwTeXHei-zhonly.ttf') format('truetype');
}

the url will begin at css folder.
This works on ios 10 safari
thanks Brais Gabin.

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