Oli*_*ier 5 flash font-face flex4
我开始本地化我的Flash应用程序.我试图看看是否有办法回滚日语等语言的默认操作系统字体,所以我不必嵌入它们.到目前为止我没有在网上找到任何东西.我目前正在使用css来定义字体系列,如:
@font-face
{
fontFamily: "Tuffy Regular";
src:url("/assets/fonts/Tuffy-Regular.ttf");
embedAsCFF: true;
}
Run Code Online (Sandbox Code Playgroud)
有什么建议吗?
谢谢
奥利维尔
在 AS3 中,您可以通过两种方式设置文本样式:使用 TextFormat 和使用 StyleSheet。您想使用样式表: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/StyleSheet.html ?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6
并且您希望使用 fontFamily 属性来指定所需的字体系列。
这是一个工作示例:
package {
import flash.display.Sprite;
import flash.text.StyleSheet;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class Main extends Sprite {
public function Main() {
var style:StyleSheet = new StyleSheet();
var heading:Object = new Object();
heading.fontWeight = "bold";
heading.color = "#FF0000";
heading.fontFamily = "Trebuchet MS, Arial, Helvetica, sans-serif";
var body:Object = new Object();
body.fontStyle = "italic";
body.fontFamily = "Courier New, Courier, monospace";
style.setStyle(".heading", heading);
style.setStyle("body", body);
//style.setStyle("fontFamily",
var label:TextField = new TextField();
label.styleSheet = style;
label.htmlText = "<body><span class='heading'>Hello </span>World...</body>";
addChild(label);
}
}
Run Code Online (Sandbox Code Playgroud)
}
| 归档时间: |
|
| 查看次数: |
860 次 |
| 最近记录: |