Arabic text in a Windows terminal

Terminals are built on a grid of equal cells, which suits Latin text and fights Arabic. Najm shows Arabic and Hebrew right to left on that grid, and one config line gives them a monospace font.

What works today

  • Works: Arabic and Hebrew read right to left in command output and at the prompt, with joined letters. Numbers and Latin words inside a line keep their own order. The cursor, selection, search and links follow what you see.
  • Line direction: a line that starts with Arabic or Hebrew aligns right. One that starts with Latin, such as a prompt, stays left, and any Arabic inside it still reads correctly.
  • Limits: full-screen apps such as vim stay left to right, because they place every cell themselves. The line you are composing with an IME stays in typing order until you commit it. Lam-alef is one form in two cells, so a blank cell sits on its left.
  • Turn it off: set bidi = false.

Set the font in three steps

  1. Install the current Cascadia Code release. The copy that ships with Windows has no Arabic.
  2. Add this line to %LOCALAPPDATA%\najm\config.ghostty:
font-codepoint-map = U+0600-U+06FF,U+0750-U+077F,U+08A0-U+08FF,U+FB50-U+FDFF,U+FE70-U+FEFF=Cascadia Code NF
  1. Press Ctrl+Shift+, to reload the config.

Why the font line matters

The default terminal fonts have no Arabic, so Windows draws it in Segoe UI. That font is proportional, so it sits unevenly in the grid. The line above sends every Arabic block to a monospace font that has them, and the text lines up.

To see which font each letter comes from, run:

najm +show-face --string="مرحبا"

Read this page in Arabic

Najm's site has an Arabic version.

Questions

Does Najm display Arabic right to left?

Yes, in command output and at the prompt, with joined letters. Full-screen apps such as vim stay left to right, because they place every cell themselves.

Why does Arabic look uneven in my terminal?

Most terminal fonts have no Arabic, so Windows draws it in a proportional font that sits unevenly in the cell grid. Map the Arabic blocks to a monospace font that has them.

Which font should I use for Arabic?

The current release of Cascadia Code from Microsoft's GitHub has Arabic. The copy that ships with Windows does not, so install the release.

Try Najm on your machine

Free and open source. It installs beside your current terminal.