Bidirectional text
From Wikipedia:Bidirectional text, is text that contains two text directionalities, right-to-left (RTL) and left-to-right (LTR).
Concepts
- Text direction
- in text editing, setting text direction changes how the program interacts with typed text including changes in text navigation, text selection, and text insertion.
- Text alignment
- text alignment only changes how text is displayed and styled.
- Fake Bidi
- a fake locale displaying completely reversed English sentences to mimic a RTL context. This helps developers who do not speak a RTL language to deal with RTL issues. For example:
This English sentence contains SDROW CIBARA EMOS and ends with English words.
- Poor man's bidi mode
- automatic visual text order right-to-left input in normal terminal.
- Logical navigation
- words are traversed as they are read.
- Visual navigation
- words are traversed as they are displayed. This GIF demonstrates the difference between the two.
Logical navigation is the correct way of navigation that programs should implement to fully support Bidi. Despite that, it would be preferable to have a switch between the two.
- Unicode support
- In Unicode-supported text editors, text direction can be controlled by inserting special formatting characters in front of it: Wikipedia:RLM (U+200F), Wikipedia:LRM (U+200E), which is a workaround for text editors not supporting switching text direction.
- Bidirectional Algorithm
- is the set of rules applied to display text in the correct order.
Some implementations:
- fribidi-gitAUR is an open source implementations of Bidi Algorithm.
- SheenBidi: Improved Unicode Implementation in C.
- python-bidiAUR is a python library for related functions.
Support
In order for a program to fully support Bidi text, it must have:
- Letter rendering (RTL)
- correctly apply letter shaping and ligatures. See W:harfbuzz and Complete Text Layout.
- Force switch text alignment (Bidi)
- E.g: Firefox
Ctrl+Shift+X
shortcut. - Logical navigation
- in a RTL text, with RTL text alignment, arrow keys should not cause reversed navigation.
Browsers
App | Date | RTL | Bidi | Nav | Notes |
---|---|---|---|---|---|
chromium | 2022-08-28 | Yes | No | Yes | Chromium is the engine of ElectronJS. Fixing this should resolve Electron Apps too. |
firefox | 2022-09-01 | Yes | No | No | |
qtwebbrowser | 2022-11-01 | Yes | No | ||
webkit | 2022-11-01 | Yes | No | ||
epiphany | 2023-08-27 | Yes | No |
Editors
App | Date | RTL | Bidi | Nav | Notes |
---|---|---|---|---|---|
AbiWord | 2007-12-06 | Yes | |||
emacs | 2019-06-31 | Yes | No | With extension. See also: emacs bidi editing. | |
ghostwriter | 2023-08-27 | Yes | No | ||
kate | 2016-06-20 | Yes | No | ||
LibreOffice | Yes | Yes | Yes | Enabled from Complex Text Layout in settings. | |
marktextAUR | 2020-02-20 | No | |||
neovim | 2014-04-17 | No | No | see :set arabic | |
texworks | 2009-03-01 | Yes | No | ||
vim | 2015-08-19 | No | No | see :set arabic |
Terminal
App | Date | RTL | Bidi | Nav | Notes |
---|---|---|---|---|---|
alacritty | 2017-07-15 | No | |||
dvtm | 2019-10-12 | No | |||
gedit | Yes | No | For Gedit <= 2.1, workaround by extension. | ||
irssi | 2019-10-12 | No | |||
kitty | 2019-11-01 | No | |||
konsole | Yes | No | |||
libvte | Yes | No | including libvte-based like Gnome, sakura, xfce4... | ||
mltermAUR | Yes | No | |||
neatvi-gitAUR | 2019-07-04 | No | |||
pymux | 2019-10-12 | No | |||
qterminal | Yes | No | |||
radare2 | 2015-02-03 | No | |||
tmux | 2019-10-12 | No | won't fix | ||
wezterm | 2021-05-11 | No | |||
xstAUR | 2018-10-26 | No |
Other
App | Date | RTL | Bidi | Nav | Notes |
---|---|---|---|---|---|
groff | 2005-12-02 | No | No | – | |
Wikipedia:HTML | Yes | Yes | Yes | ||
latex | Yes | Yes | – | Using LuaTeX or XeLaTeX with polyglossia | |
wine | 2002-04-21 | Yes | No | ||
electronjs | 2023-08-26 | No |
Troubleshooting
Verify UTF-8 Encoding is properly configured first. Make sure you install the fonts corresponding to your language: Arabic, Persian, Hebrew. For some terminals, (bicon-gitAUR) is required to properly display Arabic and Hebrew text.