如果您的主字體不支持某種語言,則可以在自定義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;
}
}
我需要所有我的嵌入字體不支持字符(中國,日本等)的備用字體。 – destroytoday 2010-09-12 17:01:07