Maison  >  Article  >  interface Web  >  Exemples de comment intégrer des polices spéciales en chinois et en anglais en HTML

Exemples de comment intégrer des polices spéciales en chinois et en anglais en HTML

黄舟
黄舟original
2017-07-22 10:15:472528parcourir

Méthode d'introduction de la police anglaise :

code HTML

<!DOCTYPE html>
<html>
<head>
</head>
<style>
    @font-face {
        font-family: &#39;fontNameRegular&#39;; /* 字体名称,可自己定义 */
        src: url(&#39;LIGHRG.eot&#39;);
        src: local(&#39;fontName Regular&#39;),
        local(&#39;Lightningvolt&#39;),
        url(&#39;LIGHRG.woff&#39;) format(&#39;woff&#39;),
        url(&#39;LIGHRG.ttf&#39;) format(&#39;truetype&#39;),
        url(&#39;LIGHRG.svg#LIGHRG&#39;) format(&#39;svg&#39;);
    }
    /* 将Lightningvolt替换成字体库名 */
    /* 将LIGHRG替换成你自己的字体文件名 */
    p {font: 50px fontNameRegular, Arial, sans-serif; }
</style>
<body>
<p>
    sadasdasdasdasdasdasdasd
</p>
</body>
</html>

------------------------- -------------------------------Magnifique ligne de démarcation---------------- -- -----------------------------------------

Ce qui suit est la méthode chinoise

Après l'avoir exécuté pour la première fois, actualisez-la à nouveau et insérez un svg dans la tête. Ce svg peut ensuite être converti dans d'autres formats

Remarque : chemin du disque. l'accès n'est pas autorisé, alors assurez-vous de déployer un Apache ou Tomcat et d'utiliser localhost pour accéder à la page

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
</head>
<body>
<p class="minijianyaya">
    我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
    度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达我们ahi速度额短袜打速度埃索达埃索达
</p>
</body>
<script type="text/javascript" src="http://www.youziku.com/UserDownFile/jquery.min.js"></script>
<script type="text/javascript" src="http://www.youziku.com/UserDownFile/jquery.md5.js"></script>
<script type="text/javascript">
    function youziku19540() {
        var resultStr = $(".minijianyaya").text();
        var md5 = "";
        resultStr = Trim(resultStr);
        resultStr = SelectWord(resultStr);
        md5 = $.md5("9cddc9570e5e4a5d93d076e34bd55782"+"minijianyaya" + resultStr);
        $.getJSON("http://www.youziku.com/webfont/CSSPOST?jsoncallback=?", { "id": md5, "guid": "9cddc9570e5e4a5d93d076e34bd55782", "type": "5" }, 
        function (json) {
            if (json.result == 0) {/*alert("需要生成");*/
                $.post("http://www.youziku.com/webfont/PostCorsCreateFont", { "name": "minijianyaya", "gid": "9cddc9570e5e4a5d93d076e34bd55782", "type": "5", 
                "text": resultStr }, function (json) {
                    if (json == "0") { /*alert("参数不对");*/
                    } else if (json == "2") {/*alert("超过每日生成字体数的上限");*/
                    } else if (json == "3") { /*alert("当前正在生成请稍后");*/
                    } else {/*alert("正在生成");*/
                    }
                });
            }
            else {/*alert("下载css文件");*/
                loadExtentFile("http://www.youziku.com/webfont/css?id=" + md5 + "&guid=" + "9cddc9570e5e4a5d93d076e34bd55782" + "&type=5");
            }
        });
    }
    (function youziku() {
        if (window.location.href.toString().substring(0, 7) == "file://") {
            alert("你当前是通过双击打开html文件,进行本地测试的,这样看不到字体效果,一定要通过本地建立的虚拟网站或发布到外网进行测试。详见有字库的使用说明。");
        }else{
            youziku19540();
        }
    })()
</script>
</html>

Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn