Openfl, Starling BitmapFont text encoding

#1

Hi,

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.

0 Likes

#2

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)

0 Likes

#3

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 https://haxe.org/blog/unicode/.
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.

0 Likes

#4

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

0 Likes