[SOLVED] Flickering Unicode TextField

I code on Window 8, I love OpenFL so far. I test my program with “openfl test neko”, but every time I use TextField.appendText with Unicode text, the text starts flickering. I wrote the same program in Allegro 5, had no problems with my C++ program.
I want to rewrite this program in Haxe.

In my program I used a custom font:

  • but I can confirm, it happens with regular fonts, like Arial

Affected writing systems:

  • Cyrillic
  • Chinese
  • Japanese

I have to use a custom font for my program, because it uses Asian font, you can download here
http://font.cutegirl.jp/wp-content/uploads/2015/08/jk-go-m-1.zip (from freejapanesefont.com)

I changed the font to Arial, I didn’t have to use the custom font to have that annoying flickering effect.

“小型機墜落で4人死亡 警察が本格的に原因捜査へ OpenFL includes FlashDevelop project files when you use the openfl create command for convenience”

Working code, with standard packages, in Arial, no additional font:

package;

import openfl.Assets;
import openfl.display.Bitmap;
import openfl.display.Sprite;
import openfl.display.Stage;
import openfl.ui.Mouse;
import unifill.Unifill;

import haxe.Timer;
import openfl.display.FPS;
import openfl.events.Event;
import openfl.system.System;
import openfl.text.TextField;
import openfl.text.TextFormat;

import Sys;

// OpenFL includes FlashDevelop project files when you use the "openfl create" command for convenience.
// openfl test neko
class Main extends Sprite {
  public function new () {
    
    super ();
    
    //var fps = new FPS_Mem();
    //addChild( fps );

    var vn = new VN( this );
    vn.type( "小型機墜落で4人死亡 警察が本格的に原因捜査へ OpenFL includes FlashDevelop project files when you use the openfl create command for convenience");

    //var bitmap = Assets.getBitmapData( "assets/Chie/Dress 3.png" );
    //var chie = new Bitmap( bitmap );
    //var chie_sprite = new Sprite();
    //chie_sprite.addChild( chie );

    // make it visible on the display list
    //addChild( chie_sprite );

    //sprite_middle( chie_sprite );
  }
  
  private function sprite_middle( a_spite:Sprite ) {
    var scale = stage.stageHeight /a_spite.height;
    a_spite.x = stage.stageWidth /2 - a_spite.width /2 *scale;
    a_spite.y = stage.stageHeight - a_spite.height *scale;
    a_spite.scaleX = scale;
    a_spite.scaleY = scale;
  }
}

class VN {
  private var i_frame:Int;
  private var i_text:Int;
  private var now:Float;
  private var n_text:Int;
  private var parent:Sprite;
  private var stage:Stage;
  private var text:String;
  private var textbox:TextField;

  /**
   * @constructor
   */
  public function new( a_parent:Sprite ) {
    parent = a_parent;
    stage = a_parent.stage;
    i_frame = 0;
    now = Timer.stamp();

    //var textformat =
    //  new TextFormat( Assets.getFont( "assets/jk_gothic_m.ttf" ).fontName, 24 );
    var textformat =
      new TextFormat( "Arial", 24 );

    textbox = new TextField();
    textbox.wordWrap = true;
    textbox.x = 0;
    textbox.y = stage.stageHeight /5 *4;
    textbox.width = stage.stageWidth;
    textbox.height = stage.stageHeight /5;
    textbox.textColor = 0x000000;
    textbox.defaultTextFormat = textformat;
    textbox.selectable = false;
    textbox.addEventListener( Event.ENTER_FRAME, this.event_enterframe );
    a_parent.addChild( textbox );

    Mouse.hide();
  }

  private function event_enterframe( _ ) {
    //i_frame = ( i_frame +1 ) %3;

    // wait, then type
    if (
      //Timer.stamp()- now > 5
      i_frame == 0
    ) {
      i_text += 1;
      if (
           i_text > -1
        && i_text < n_text
      )
        textbox.appendText( Unifill.uCharAt( text, i_text ) );
    };

    var i = parent.getChildIndex( textbox );
    if ( parent.numChildren -1 != i )
    parent.swapChildrenAt(
      parent.getChildIndex( textbox ),
      parent.numChildren -1
    );
  }

  public function displayable() {
    return textbox;
  }

  public function type( a_text:String ) {
    // wait _ frames
    i_text = -10;
    n_text = Unifill.uLength( a_text );
    text = a_text;
    //textbox.appendText( a_text );
  }
}