font-detect-js, 使用Javascript和 Flash 进行字体检测

分享于 

2分钟阅读

GitHub

  繁體 雙語
Font detection using Javascript and Flash
  • 源代码名称:font-detect-js
  • 源代码网址:http://www.github.com/gabriel/font-detect-js
  • font-detect-js源代码文档
  • font-detect-js源代码下载
  • Git URL:
    git://www.github.com/gabriel/font-detect-js.git
    Git Clone代码到本地:
    git clone http://www.github.com/gabriel/font-detect-js
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/gabriel/font-detect-js
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    font-detect-js

    使用 javascript ( jQuery或者 Prototype ) + Flash 检测系统字体。

    查看演示文稿

    font-detect.png

    
    <!-- element for SWF to load into -->
    
    
    <div id="font-detect-swf"></div>
    
    
    
    <script src="javascripts/jquery-1.2.6.pack.js"></script>
    
    
    <script src="javascripts/swfobject.js"></script>
    
    
    <script src="javascripts/font-detect.js"></script> 
    
    
    <script>
    
    
     $(document).ready(function() {
    
    
    
     var onComplete = function(e) {
    
    
    //onComplete can be used to defind a callback function that is called on both success or failure of creating a Flash plugin
    
    
    //see also, https://code.google.com/p/swfobject/wiki/api
    
    
    //onComplete is supported since SWFObject 2.2
    
    
     }
    
    
    
     var fontDetect = new FontDetect("font-detect-swf","flash/FontList.swf", function(fd) { 
    
    
     var fonts = fd.fonts();
    
    
    
    //Do something with fonts, which look like: [ { fontName:'Arial', fontStyle:'regular' fontType:'device' },.. .. ]
    
    
    //for(var i = 0, length = fonts.length; i <length; i++) {
    
    
    //var name = fonts[i].fontName;
    
    
    //}
    
    
     });
    
    
    
     }, onComplete);
    
    
    </script>
    
    
    
    

    在 font-detect.prototype.js 上也有一个Prototype版本


    JAVA  Javascript  FLA  Detect  font  Flash  
    相关文章