When displaying “1.19.0 [1]” using drawText(“1.19.0 [1]”, …) in JUCE 8, it appears as “1.19.0] 1]” like this:
My environments are Windows 11 and MacOS Sonoma 14.1.1, and both experience a similar issue. The JUCE version is 8 (commit hash 61a03097ec9e01693c87ac71935e97b9714cff1a at the 8.0.0 tag).
This issue can be reproduced with the following steps:
Open examples\DemoRunner\Builds\VisualStudio2022\DemoRunner.sln, build, and run it.
From “Browse Demos,” select “GUI,” then “CodeEditorDemo.h,” and input “1.19.0 [1]” in the code editor.
It will be rendered as “1.19.0] 1]”.
I have determined that Graphics::ConfiguredArrangement::arrangement already contains glyphs in the incorrect order when rendered, but I could not identify the root cause.
I think I’ve identified the cause of the problem. In the implementation of the Unicode Bidi Algorithm, when classifying characters within brackets, according to UAX #9: Unicode Bidirectional Algorithm
Note that EN and AN should be treated as a strong R type when searching within the brackets.
It seems that the implementation of this part in JUCE is incomplete.
This seems to fix the drawing issue at first glance but still some inconsistencies “1/8 (3)” if we delete the last “)” the other one will invert.
This will also happen when writing “1/8 (3” will output “1/8) 3”.
May I ask if you can also reproduce this one?
Ended up just forcing TextDirection::ltr on getEmbeddingDirection and resolveNeutralTypes
Thanks for submitting this. I originally had a case for dealing with numbers but it would fail certain specification tests. It looks like I was doing it in the wrong place.
Thank you for your reply.
I have two apps on the Microsoft Store that use JUCE. Before JUCE 8, I had to bundle large font files with my apps to render non-Latin text, but that’s no longer necessary.
Although there are some minor issues like this one, overall, I’m very satisfied with JUCE 8
I hope this issue will be fixed in future releases.