Skip to content

خط Khatt v0.1.0 — the Arabic FIGlet

Latest

Choose a tag to compare

@DrEssam97 DrEssam97 released this 11 Jul 21:15

The first release of خَطّ (Khatt) — Arabic text as ASCII/Unicode-block art, with real shaping. FIGlet can't do Arabic: positional forms, mandatory ligatures, and right-to-left cursive joining all break its one-character-one-glyph model. Khatt shapes text with HarfBuzz, rasterizes it with real Arabic fonts, and maps the ink onto character ramps.

         ▓▓
         ██▓
         ██▒
         ▓█
         ▒█░
         ░█▒                       ▓██▓
          █▓                       ▓██▒
          █▓
          ██      ░░▒▒
          ▓▓   ▒▓██████▒   ▒█████▓▒░
          ▓▒░███▓▒▒▓████  ▓█▓▓▓███████▓▓▒░░░░ ░░
          ██▓░      ░██▒          ▒████████████▒
        ▒█▓░ ░░▒▒▓████░       ░▒▓▓███▓▓▒░░░░░▒░
▒███████████████████████████████▓▒░
  ▓███████████▓▓▒▒▒▓▓███████▓▒░

«خط» in the blocks style, straight from khatt "خط" -w 48.

Highlights

  • Correct Arabic shaping via HarfBuzz + python-bidi: positional forms, the mandatory لا ligature, tashkeel handling, and mixed Arabic/Latin/digit text in proper visual order.
  • Three styles: blocks (░▒▓█), ascii (density ramp), braille (2×4 dots per cell for 8× effective resolution) — all with a contrast threshold.
  • Four bundled OFL fonts: Amiri, Cairo, Noto Naskh Arabic, Rubik.
  • Three ways to use it: Python API (khatt.render(...)), a khatt CLI (UTF-8-safe on Windows), and a single-file Gradio app deployable unchanged to a Hugging Face Space.
  • 83 tests, 98% coverage, golden-file snapshots, CI green on Python 3.10–3.13 × Ubuntu/Windows.

Install (from source, PyPI pending)

git clone https://github.com/DrEssam97/khatt.git && cd khatt
uv sync
uv run khatt "مرحبا"

Full details in the CHANGELOG.