Skip to main content
Participant
February 27, 2014
Question

Chinese characters are displayed as blank box on the TextField in Taiwan Android 4.4.2/AIR4.0

  • February 27, 2014
  • 1 reply
  • 669 views

Chinese characters are displayed as blank box on the TextField in Taiwan Android 4.4.2/AIR4.0, such as Nexus7, HTC One,  but in mainland China Nexus7(Android 4.4.2/AIR4.0) showed normal

AIR SDK is 4.0.0.1628.

Hope it can be fixed as soon as possible.

Here is test code:

package

{

          import flash.display.Sprite;

          import flash.display.StageAlign;

          import flash.display.StageScaleMode;

          import flash.text.Font;

          import flash.text.TextField;

          import flash.text.TextFieldAutoSize;

          import flash.text.TextFormat;

 

          public class TestFont extends Sprite

          {

 

                    public function TestFont()

                    {

 

                              stage.scaleMode = StageScaleMode.NO_SCALE;

                              stage.align = StageAlign.TOP_LEFT;

 

                              var sprite:Sprite = new Sprite();

 

                              var value1:String = "简体中文测试";

                              var value2:String = "繁體中文測試";

 

                              var txt11:TextField = createTextField(null, "11 "+value1);

                              txt11.x = 10;

                              txt11.y = 10;

                              sprite.addChild(txt11);

 

                              var txt12:TextField = createTextField(null, "12 "+value2);

                              txt12.x = txt11.x + txt11.width;

                              txt12.y = txt11.y;

                              sprite.addChild(txt12);

                              ///

                              var txt21:TextField = createTextField("STHeitiTC-Medium","21 "+value1);

                              txt21.x = 10;

                              txt21.y = txt11.y + txt11.height;

                              sprite.addChild(txt21);

                              var txt22:TextField = createTextField("MSYH","22 "+value2);

                              txt22.x = txt21.x + txt21.width;

                              txt22.y = txt21.y;

                              sprite.addChild(txt22);

                              var lastY:int = txt22.y + txt22.height;

                              var fonts:Array = Font.enumerateFonts(true);

 

                              var index:int = 0;

                              for each (var font1:Font in fonts)

                              {

                                        index++;

                                        var txtF:TextField = createTextField(font1.fontName, index + "/" + fonts.length + " " + font1.fontName + " "+value1 +" " + value2);

                                        txtF.x = 10;

                                        txtF.y = lastY;

                                        sprite.addChild(txtF);

 

                                        lastY += txtF.height;

                              }

 

                              addChild(sprite);

 

                    }

 

                    public function createTextField(font:String, value:String):TextField{

                              var txt:TextField = new TextField();

                              txt.autoSize = TextFieldAutoSize.LEFT;

 

                              var format:TextFormat = new TextFormat();

                              if(font != null){

                                        format.font = font;

                                        txt.defaultTextFormat = format;

                                        txt.setTextFormat(format);

                              }

 

                              txt.text = value;

                              var dformat:TextFormat = txt.defaultTextFormat;

                              if(dformat != null){

                                        txt.text = value + " |" + dformat.font;

                              }

 

                              if(font != null){

                                        txt.setTextFormat(format);

                              }

 

                              return txt;

                    }

          }

}

This topic has been closed for replies.

1 reply

February 27, 2014

Hi BanyLee,

I tried on Nexus 7 with OS 4.4.2 by changing device locale to Taiwan(zh_TW) but could not replicate the issue.

Thanks,

Ankit

BanyLeeAuthor
Participant
February 28, 2014

I am in mainland China, my Nexus7 can display chinese characters, but my friend in Taiwan, his android4.4.2 display chinese characters as blank.

I don't understand the reason.

By the way, TextFormat.font don't work, whatever I set any fonts, display are the same.

My screenshots:

Taiwan's screenshots: