加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

在Flash应用程序中使用操作系统字体而不嵌入它

发布时间:2020-12-15 07:28:22 所属栏目:百科 来源:网络整理
导读:我开始本地化我的Flash应用程序. 我试图看看是否有办法回滚日语等语言的默认操作系统字体,所以我不必嵌入它们. 到目前为止我没有在网上找到任何东西. 我目前正在使用css来定义字体系列,如: @font-face{ fontFamily: "Tuffy Regular"; src:url("/assets/font
我开始本地化我的Flash应用程序.
我试图看看是否有办法回滚日语等语言的默认操作系统字体,所以我不必嵌入它们.
到目前为止我没有在网上找到任何东西.
我目前正在使用css来定义字体系列,如:

@font-face
{
   fontFamily: "Tuffy Regular";
   src:url("/assets/fonts/Tuffy-Regular.ttf");
   embedAsCFF: true;
}

有什么建议吗?

谢谢

奥利维尔

解决方法

在AS3中,您可以使用TextFormat和StyleSheet以2种方式设置文本样式.
您想使用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);
    }
}

}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读