Skip to main content
Inspiring
January 13, 2011
Question

Does AS3 support Unicode font?

  • January 13, 2011
  • 1 reply
  • 1656 views

I want to use Unicode font,such as GBK,to show some text,like follows:

var_tf:TextFormat=new TextFormat();
_tf.font="黑体";
_tf.size=20;
_tf.bold=true;
_tf.color=0xFFFFFF;

var _txt:TextField=new TextField();       
_txt.wordWrap=false;
_txt.width=300;
_txt.x=100;
_txt.y=50;
_txt.appendText("你好");
_txt.setTextFormat(_tf);

addChild(_txt);

When I run above code,I find the text style is not what I want,the font style don't change!  Doesn't  ActionScript3 support unicode font? How to realize unicode font?

Thanks

This topic has been closed for replies.

1 reply

Kenneth Kawamoto
Community Expert
Community Expert
January 13, 2011

Flash of course supports unicode since version 6

I don't have the font "黑体" but using a Chinese font I have on my Mac, this works just fine:

...

           var textfield:TextField = new TextField();
            with(textfield){
                defaultTextFormat = new TextFormat("Heiti SC Medium", 20, 0);
                text = "你好";
            }
            addChild(textfield);

...