Examples of how to embed special fonts in Chinese and English in html

黄舟
Release: 2017-07-22 10:15:47
Original
2536 people have browsed it

English font introduction method:

html code

<!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>
Copy after login

-------------------------- --------------------------Gorgeous dividing line-------------------- ----------------------------------------

The following is the Chinese method

After executing it for the first time, refresh it again and insert an svg in the head. This svg can then be converted into other formats.

Note: Disk path access is not allowed, so you must deploy one. Apache or tomcat, use localhost to access the 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>
Copy after login

The above is the detailed content of Examples of how to embed special fonts in Chinese and English in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!