LibGDX RTL font rendering?

I am creating an application that should support two languages, English, and Hebrew.

The problem is that Hebrew is Right-To-Left western language and English is Left-To-Right language, and LibGDX does not support RTL fonts.

I have created the bitmap for the font and everything works


But when I write in hebrew, it will write the words reversed. I have a solution for this when I write solely in hebrew, just reverse the words using a StringBuilder, but that’s a cheap-fix. But what if I want to implemnet a chat, or character name?


From what I can see the easiest solution is to use Heiro. If you look at this thread Hiero Rendering Arabic fonts Right to Left where there is recent provision to accomodate RTL

enter image description here

From there it becomes increasingly difficult. There are quite a few questions about this issue (one example Showing non-western language from right to left in libgdx (Android)) and fewer solutions.

You have the option of creating a library of glyphs of strings for commonly used words or expression, though this is a painstaking process to set up and there is an overhead in terms of time when using chat, as there is with your string reversal.

This discussion in the libgdx github Support for complex font rendering (Chinese, Arabic, …). goes into these and more options including work done to support Windows sridharsundaram/complexscriptlayout, which, although that is not Android, may be worth investigating for further development ideas.

On the positive side, there are an increasing number of recent developments in this front, so RTL and bidi formats should become increasingly easier for developers using libgdx.

Of interest is this support issue Right-To-Left Text Rendering Support #787 as there are breadcrumb trails of people with the same issue developing resources.