Openfl, Starling BitmapFont text encoding


On cpp targets using Haxe 4, chars encoded in 2 bytes dont work in bitmap fonts.
it seems to come from current implementation of text.charCodeAt for this target.

I tested replacing it with UTF8.charCodeAt in starling.text.BitmapFont which make it work.

Does anyone know a better solution which does not involve to change the framework’s code ?

Thank you in advance.

Did this work in Haxe 3? Perhaps we could add #if (haxe_ver >= "4.0.0") and use UTF8 there (we can add this to Starling official)

I did not test it however the behaviour sould be the same in haxe 3.

I think it’s more an issue off difference of implementation between target, as mentioned in this recent blog post
I notice that for targets such as cpp ther are multiple drawbacks.
For example “ô”.toUpperCase() will return “ô” in CPP but wil return “Ô” in JS or AS3.

I’m not shure where is the googd place to find solutions, contribute for this particular point.

I think that code directly in the Haxe Starling project to resolve any issues you have would be a good starting point – then we could work later to push any relevant changes further into lower-level libraries