# SDL2\_ttf bi-directional text

**URL:** <https://discourse.libsdl.org/t/sdl2-ttf-bi-directional-text/43653>\
**Category:** SDL Development\
**Created:** [May 3, 2023, 10:34am UTC](https://discourse.libsdl.org/t/sdl2-ttf-bi-directional-text/43653 "2023-05-03T10:34:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rtrussell](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/rtrussell/32/4768_2.png) [@rtrussell](https://discourse.libsdl.org/u/rtrussell)\
**Post date:** [May 3, 2023, 10:34am UTC](https://discourse.libsdl.org/t/sdl2-ttf-bi-directional-text/43653/1 "2023-05-03T10:34:02Z")

</div>

I know how to use `TTF_SetFontScriptName()` and `TTF_SetFontDirection()` to render complex scripts and/or bi-directional text, but that requires you to specify explicitly the script and direction you want for a particular string.

What I want to do (and this can’t be an unusual requirement) is to reproduce the functionality of all modern text editors in **automatically** switching script and direction according to the text being rendered.

This is how, for example, the Uniscribe library in Windows works, or entering text into an edit box created in Javascript, or into Facebook etc. The script and direction don’t have to be specified explicitly, they are determined from the text itself.

But I can’t see how to do this using SDL2\_ttf. Am I missing something?

---

<div class="post-metadata">

**Author:** ![eri0o](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/eri0o/32/4277_2.png) [@eri0o](https://discourse.libsdl.org/u/eri0o)\
**Post date:** [May 6, 2023, 7:05pm UTC](https://discourse.libsdl.org/t/sdl2-ttf-bi-directional-text/43653/2 "2023-05-06T19:05:43Z")

</div>

Here is the corresponding issue: [Add Bidi support · Issue #135 · libsdl-org/SDL\_ttf · GitHub](https://github.com/libsdl-org/SDL_ttf/issues/135)
