2010-09-10 88 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