Arabic text breaks in game chat and TTS - so I built a small library to fix it (and un-fix it). Python + C#/Unity.
If you've ever put Arabic into a game's chat or a naive text renderer, you've seen it come out disconnected and backwards. Fixing the display means "baking" the text into final presentation glyphs in visual (reversed) order - which works, but then a text-to-speech engine reads gibberish and search/logging break, because it's no longer real Arabic letters.
arabic-rt does the shaping + bidi like other libraries, but it also does the part most skip: it can un-bake - turn that baked text back into clean logical Arabic. So the display can stay baked while the voice and your data see real letters.
- fix() → renders correctly even on clients that do zero Arabic processing
- unfix() → recovers logical Arabic for TTS / search / logging
- a GAME preset for word-by-word chat readers
- zero dependencies; MPL-2.0
The Python and C# ports produce byte-for-byte identical output, so text baked in Unity round-trips in Python.
Live demo (type Arabic, watch it shape/bake/un-bake): https://huggingface.co/spaces/balswyan/arabic-rt
Python: https://pypi.org/project/arabic-rt/
Source: https://github.com/balswyan/arabic-rt
C#/Unity: https://www.nuget.org/packages/ArabicRt
Source: https://github.com/balswyan/arabic-rt-dotnet
Built it after hitting this in a multiplayer game's chat. Feedback welcome - especially edge cases I haven't covered.
Posted Jun 2, 2026, 1:00 PM UTC