There are font API methods used one or two

Source: Internet
Author: User

There is a font is the world's first Chinese web font (online fonts) service platform, the official website written a little bull X

Need to register account before you can use, free font Limited, a page can not exceed 500 words, more than 500 fonts will not add font style for the label, compared to the pit dad!

After trying to use two methods, I share some of my experiences with them.

    • Only one font can be loaded
<script src= "Https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js" type= "Text/javascript" charset= "Utf-8" > </script><!--There is only one font that needs to load this js--><script type= "Text/javascript" src= "/HTTP/ Cdn.webfont.youziku.com/wwwroot/js/wf/youziku.client.min.js "></script>
$(function() {Onlyonefont ();                        }); //returns only one font            functionOnlyonefont () {varGETURL = ' Http://service.youziku.com/webFont/getFontFace '; varentity ={url:geturl, AccessKey:' 69C8434454F842F28B46712F1B080C4A ', //This key can be used to return different font names depending on the key, but when using the page, only the ' source simplified ' effect is displayed, and the Content of the problem is not known where :' Test 5555 ', Tag:'. Only-font '                }; $youzikuClient. Getfontface (Entity,function(data) {Console.log (' Get to the font: ' +data.                                        FontFamily); varfontFamily =data.                    FontFamily; $('. Only-font '). css ({' Font-family ': fontFamily,' Font-size ': ' 24 ',                        ' Color ': ' #555 ',                        ' Margin-top ': ' 50px ',                        ' Margin-left ': ' 100px '                    }); })            }
    • Lu mode (You can set fonts for different labels at the same time)
// need to load two JS files <script src= "https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js" type= "Text/javascript" charset= "Utf-8" ></script><!--lo-teach mode--<script type= "Text/javascript" src= "/http Cdn.webfont.youziku.com/wwwroot/js/wf/youziku.api.min.js "></script><script type=" Text/javascript " Src= "Https://cdn.webfont.youziku.com/wwwroot/js/wf/youziku.lib.min.js" ></script>

            // can set multiple fonts            at the same time function Lujiaomode () {                $youziku. Load (". Test", "69c8434454f842f28b46712f1b080c4a", "winmantun23001");                $youziku. Load (". Text2", "13e841f53229490490392b9a9c90ea6e", "Hdjxyt");                $youziku. Draw ();            }

Also need to use in the again groping, welcome to exchange! There is no more information to share online!

There are font API methods used one or two

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.