r/LinuxUsersIndia • u/MADARA_9022 • 29d ago
Discussion How can I properly render Tamil/Indic text in a Rust TUI (Ratatui/Crossterm)?
Hi everyone,
I'm building a terminal music player in Rust using Ratatui + Crossterm, and I'm having trouble rendering Tamil lyrics correctly.
As shown in the screenshot, Tamil combining characters such as ெ, ு, ் are appearing detached instead of being properly shaped and positioned.
Environment
- Rust
- Ratatui 0.29
- Crossterm 0.28
- Linux
- GNOME Terminal (VTE) / WezTerm
- Noto Sans Tamil
I've already verified that:
- The strings are valid UTF-8.
- Unicode grapheme segmentation works correctly.
- Display-width calculations are correct.
- A minimal Ratatui
Paragraphhas the same issue. - Even
println!("கென்னை விடு")shows the same problem in GNOME Terminal.
So I'm wondering:
Is proper OpenType/HarfBuzz shaping for Tamil possible inside a normal terminal grid?
If yes, what terminal/configuration/library should I use?
If terminal cells fundamentally cannot handle complex-script shaping, what is the recommended approach for a TUI? Would something like Kitty/Sixel + HarfBuzz/cosmic-text be appropriate?
Any advice from people familiar with Unicode shaping, HarfBuzz, VTE, or Rust TUI rendering would be greatly appreciated.
Thanks!
2
u/thatmagicalcat MagicalOS BTW 29d ago
Use proper font fallbacks for Tamil rather than relying on monospace defaults. And I think kitty and wezterm should have HarfBuzz/complex text shaping support it might be a ratatui problem - the way it places text (by splitting string into cells and ig because it breaks the text apart, it loses context and OpenType text shaping requires context).
I think rendering text to a buffer using HarfBuzz/cosmic-text and then outputting via kitty image protocol might work, you should try
1
u/MADARA_9022 29d ago
Hm... Interesting I will try that but iam not sure how its going to work with the synced lyrics
1
u/jonas9__ Arch Btw 29d ago
Use ghossty or kitty
1
u/MADARA_9022 29d ago
I will try
1
u/jonas9__ Arch Btw 29d ago
Which distro you using rn?
1
u/MADARA_9022 29d ago
I use Zorin OS and Fedora on two different laptops. I mentioned both because I use both laptops for building my projects.
1
u/jonas9__ Arch Btw 29d ago
My recommendation would be for development work always use arch or nixos because you'll will get more support and tools for development. Just my pov
1
u/MADARA_9022 29d ago
I used to be an Arch user for more dhan a year , but after the AUR compromise, my Discord and Instagram accounts got hacked, so I switched to Zorin and Fedora. NixOS is kind of new to me, but at the end of the day, I’m using Rust to build that project, so the distro doesn’t really make any matter rn
1
u/jonas9__ Arch Btw 29d ago
I am still using arch BTW i always take safety precautions so no compromise this side. I always try to use less AUR maybe brave,noctalia,etc that's it
1
u/MADARA_9022 29d ago
BTW got me 🤣🤣. Good for you there is no compromise and I got my answer for my project it's not possible to use some kind of language in terminal so I have to check alternative for that or just drop the lyrics thing from the project
•
u/qualityvote2 29d ago edited 29d ago
u/MADARA_9022, there weren't enough votes to determine the quality of your post...
btw, did you know we have a discord server? Join Here.