lime icon indicating copy to clipboard operation
lime copied to clipboard

WIP: Trying to fix support for unicode text for native targets

Open restorer opened this issue 4 years ago • 2 comments

WORK IN PROGRESS, DO NOT MERGE

Currently, it seems that support for non-ASCII text is broken when using the latest versions of Haxe 4, Lime, and OpenFl.

  • Haxe - 4.0.5
  • Lime - latest from develop branch
  • OpenFl - 8.9.6
  • hxcpp - 4.0.64
  • Target - mac or android, probably windows, linux and ios are affected too

Before fix

[just lime] TextRendering sample from lime-samples (mac): Screen Shot 2020-04-06 at 10 04 02

[openfl + lime] Some random game (android): photo_2020-04-06_13-18-53

I tried to figure this out and found out that HxString may contain data with different encodings. I tried to change c_str() to hxs_utf8() in the HarfbuzzBindings.cpp, and I thought it might help (at least if I print them using printf(), the console will show the correct lines). However, there's something else I haven't found yet.

After fix

[just lime] TextRendering sample from lime-samples (mac): Screen Shot 2020-04-06 at 13 10 50

I don't know Arabic or Chinese, but the Russian text I added is cut in the middle. The correct text should be: Съешь же ещё этих мягких французских булок да выпей чаю..

[openfl + lime] Some random game (android): photo_2020-04-06_13-24-58

OpenFl gives a more weird result. It removes all spaces and cuts off individual words. For example instead of Узнай больше it renders Узнбол (Узн + бол)

restorer avatar Apr 06 '20 10:04 restorer

Be careful, because at least half of these issues are openfl-related. Even the Mac rendering may be openfl (look at PR 2300).

MSGhero avatar Apr 06 '20 12:04 MSGhero