Rendering RTL languages with dear IMGUI?

Hi Omar, Thank you very much for such a beautifull piece of code that is the Dear Imgui library!

I’m trying to use this library to render some texts in my game which works great for English language but as I plan to translate my game later to Persian language I thought to check it with you, if there is such a thing planned? or how hard would it be to go about implementing it myself If I want? because right now the library doesn’t seem to handle the RTL languages. right now the direction is wrong as well as the characters are all rendered separately instead of connected.

update: just found the relevant issue on the github issues, seems like you have a point and yeah its probably not in the spirit of IMGUI to support fullblown internationalization. so nvm and feel free to delete this topic.

Hi Ali,
I’ve had your problem and wrote an extension on Dear ImGui that supports the Persian Language using HarfBuzz for shaping and FriBidi for Bi-Di Texts.
I’m Actually researching now to start writing it from scratch with max efficiency and performance because as in the issue is mentioned shaping the text with bi-di overhead has CPU costs.
Good Luck :slight_smile:

1 Like

Hi Erfan, nice to see that you have managed to do it, I’m curious to see your implementation and also please tell me how worse was the performance with bidirectional text shaping support?

Well, I’m if you’re curious to see the code, I’m going to put it on GitHub(probably in two weeks) as Part of a UI Tool that I’m writing over Dear ImGui.

I can tell you the main challenges after displaying text is text boxes and selecting the text and maybe wrapping the text and justifying the text.

I’m open to suggestions and helps from others :slight_smile:

1 Like

I see, definitely it can get quite challenging when taking into account the editing and formating part.
will take a look once you have put it in Github and who knows, maybe I contributed with something as well :stuck_out_tongue:
thanks.