Closed xerosugar closed 8 years ago
Please provide some code that reproduces the issue and list your library versions.
var formatBlue = new FlxTextFormat(0xff269fff);
txt.setFormat(null, 43, 0xff000000, FlxTextAlign.LEFT);
txt.applyMarkup("If there’s one piece of knowledge that you _absolutely_ must bring with you, it's this!", [new FlxTextFormatMarkerPair(formatBlue, "_")]);
add(txt);
libs:
Reduced it a bit:
package;
import flixel.FlxState;
import flixel.text.FlxText;
import flixel.util.FlxColor;
class PlayState extends FlxState
{
override public function create():Void
{
var text = new FlxText();
text.applyMarkup("’ _absolutely_ must",
[new FlxTextFormatMarkerPair(new FlxTextFormat(FlxColor.CYAN), "_")]);
add(text);
}
}
Two observations:
’
character.This working correctly implies that it's probably not an OpenFL issue:
package;
import flixel.FlxG;
import flixel.FlxState;
import flixel.util.FlxColor;
import openfl.text.TextField;
import openfl.text.TextFormat;
class PlayState extends FlxState
{
override public function create():Void
{
bgColor = FlxColor.WHITE;
var text = new TextField();
text.text = "’ shifted right";
text.setTextFormat(new TextFormat(null, null, 0xff0000), 2, 9);
FlxG.stage.addChild(text);
}
}
This traces 1 on Flash and 3 on neko / cpp:
trace("’".length);
I think we need to use haxe.Utf8
here like in FlxBitmapText
.
Should be working now.
thank you for that very quick turnaround, you're on fire! :fire:
For example, if I work with the following string: "you absolutely must do this" and use '_' as markers the string that gets the applied format is: "solutely m". Expected string is: "absolutely"