Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to get local font list using JSFL?

New Here ,
Apr 22, 2014 Apr 22, 2014

怎么使用JSFL获取本地的字体列表啊,查看了文档并未找到相关的API,我知道AS3可以.

TOPICS
Exchange extensions
823
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 24, 2014 Apr 24, 2014

Um, what? Maybe "Find Font Locations" is what you're looking for, but I can't understand your question.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 03, 2014 May 03, 2014

Thank you for your reply.But it is not the correct answer.

My solution:

*******************AS 3.0********************

var locFontList:String = getFontList();

function getFontList() : String

{

  var allFonts : Array = Font.enumerateFonts(true);

  allFonts.sortOn("fontName",Array.CASEINSENSITIVE);

  var resut : Array = [];

  for(var i : uint = 0 ; i < allFonts.length ; i++)

  {

  var child : String = allFonts.fontName;

  resut.push(child);

  }

  var fontList = resut.toString();

  fontList = Escape(fontList);

  return fontList;

}

function transmitFontList() : String

{

  return locFontList;

}

ExternalInterface.addCallback("callMySWF", transmitFontList);

function Escape(strS:String):String

{

      var iCount:Number;

      var strD:String;

      var strChar:String;

      var iChar:Number;

      var arrHex:Array=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");

      strD="";

      for(iCount=0;iCount<strS.length;iCount++)

      {

            strChar=strS.charAt(iCount);

            if(strChar==" ")

                  strD+=" ";

            else if(("A"<=strChar && strChar<="Z") || ("a"<=strChar && strChar<="z") || ("0"<=strChar && strChar<="9"))

                  strD+=strChar;

            else if (strChar=="-" || strChar=="_" || strChar=="." || strChar=="*" || strChar=="+" || strChar=="/")

                  strD+=strChar;     

            else if(strChar.charCodeAt(0)<0x007f)

            {

                  strD+="%";

                  iChar=strChar.charCodeAt(0);  

                  strD+=arrHex[iChar>>>4];

                  strD+=arrHex[iChar & 0x000f];

            }    

            else

            {          

                  strD+="%u";

                  iChar=strChar.charCodeAt(0);

                  strD+=arrHex[iChar>>>12];

                  strD+=arrHex[(iChar & 0x0f00)>>>8];

                  strD+=arrHex[(iChar & 0x00f0)>>>4];

                  strD+=arrHex[iChar & 0x000f];

            }

      }

      return strD;

}

************************END AS 3.0*********************

***********************JSFL******************************

var fonts = unescape(callMyPanel("replaceFont"));

fonts = fonts.replace("\"","");

var fontArr = fonts.split(",");

fontArr.sort();

function callMyPanel(panelName)

{

  if(fl.swfPanels.length > 0)

  {

  for(x = 0; x < fl.swfPanels.length; x++)

  {

  if(fl.swfPanels.name == panelName)

  {

     var s = fl.swfPanels.call("callMySWF");

     return s;

  }

  }

  }

  else

  fl.trace("no panels");

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 05, 2014 May 05, 2014
LATEST

Well, given that you didn't even ask a question in a language I can read, all I could do was guess what you want.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines