2010-09-10 51 views
3

我在我的AIR/AS3應用程序中缺少對大多數國際字符的支持。使用TextField和樣式表與font-family屬性,我認爲我將只需要做到這一點:使用帶有AS3 TextField的嵌入字體時,是否可以使用非嵌入式後備字體?

font-family: Interstate-Regular, _sans;

這工作如果TextField.embedFonts = false;但隨後州際公路經常不嵌入了沒有用戶它在他們的系統上。隨着TextField.embedFonts = true;文本甚至不顯示。有沒有嵌入Interstate-Regular的方法,仍然使用_sans作爲後備系統字體而不嵌入它?

回答

0

如果您的主字體不支持某種語言,則可以在自定義FontManagement類中實現一個開關,然後恢復爲非嵌入字體。爲了達到這個目的,你可以使用這個FontManagement類作爲格式化TextField的集中點。這可以通過創建一個公共靜態函數來實現,該函數將返回具有相關格式的TextField。

 
//where you need to format a TextField 
var params:Object = {color:0xffffff , size:12, supported:false , etc...}; 
var tf:Texfield = FontManagement.formatTextField(tf , params); 

public class FontManagement 
{ 
    //A basic example 
    public static function formatTextField(tf:TextField , params:Object):TextField 
    { 
     //since this is a static function , the Boolean is passed as an argument 
     //but there are other ways to set it, depending on where in your app 
     //the language is identified 
     if(params.supported) 
      tf.embedFonts = true; 
     else 
      tf.embedFonts = false; 

     //here the rest of your formatting code 
     return tf; 
    } 
} 
+0

我需要所有我的嵌入字體不支持字符(中國,日本等)的備用字體。 – destroytoday 2010-09-12 17:01:07