.
txt = new TextField(500, 100, “100.00%”);
txt.format.letterSpacing = 10;
txt.format.setTo(Main.font.fontName, 20, 0xFF9933);
txt.autoSize = TextFieldAutoSize.BOTH_DIRECTIONS;
txt.x = -txt.width / 2;
txt.y = 188 - 20;
txt.text = “100.00%”;
this.addChild(txt);
.
txt.format.letterSpacing = 10;
It doesn’t work in HTML5! Flash and Windows display normally.
.
Flash and Windows font spacing support normal
var format = new TextFormat(“Katamotz Ikasi”, 30, 0xFF0000);
var textField = new TextField();
format.letterSpacing = 20;
textField.defaultTextFormat = format;
textField.embedFonts = true;
textField.selectable = false;
The order you do this is important. I’d suggest it’s best to define your TextFormat object, before applying it to your TextField object. Your current code has this in reverse, applying the TextFormatafterwards.
This produces consistent letter spacing in Neko and HTML5 targets in my testing:
var format = new TextFormat(“Katamotz Ikasi”, 30, 0xFF0000);
format.letterSpacing = 20;
var textField = new TextField(200, 100, "100.00%", format);
textField.autoSize = starling.text.TextFieldAutoSize.BOTH_DIRECTIONS;
textField.embedFonts = true;
textField.selectable = false;
I have also replicated this just now, using custom bitmap fonts too, although I needed to use a much higher letterSpacing value, perhaps because of the bitmapFont’s original resolution. openfl test html5