Localization/Arabic
This article describes how to set up Arabic language environment.
Applications
- Locale article explains how to set up system or user locale.
- Bidirectional text article lists Bidi support status in applications.
-
Keyboard layout: set it by
setxkbmap ara,us
. Check the article for more info. - Ayaspell offers spellchecking extensions. Can be installed system-wide by hunspell-arAUR.
- Aspell: install aspell-arAUR
- Dict: For Arabic dictionaries install dict-freedict-eng-araAUR, dict-freedict-ara-engAUR.
- Islamic tools: for Hijri date conversion.
- LibreOffice: set up Bidi support. If you are not using a system-wide Arabic dictionary, Ayaspell extension can be installed from Tools > Language > More Dictionaries Online > Arabic. For language pack, install libreoffice-still-ar for the stable branch and libreoffice-fresh-ar for Libreoffice fresh.
- tesseract: for OCR detection, the default data package tesseract-data-ara is mostly inaccurate. Try tesseract-data-best-araAUR see [1].
- Thunderbird: install thunderbird-i18n-ar for language pack.
- Firefox: install firefox-i18n-ar for language pack.
- dwm: see Dwm#Arabic Letter-shaping
Shell and Terminal
- st: see St#Arabic shaping support
- mlterm: see Mlterm#Render Arabic script in Xft and Mlterm#Arabic script rendering when using fixed width fonts
- bash: enables by default "combining characters" (1) feature, which merges diacritics with previous character.
-
zsh: to properly display diacritics add
setopt COMBINING_CHARS
to your.zshrc
.
Vim
- See Vim#Bidirectional support for setting up Bidi support.
- Since Vim does not map Arabic characters given by input method, motion commands do not work. A possible workaround is to set keymap within Vim without changing X11 keymap. This can be done
set keymap=arabic
, then switching between layouts viaCtrl-^
, or by manually set langmap invimrc
:
set langmap=ضصثقفغعهخحجد;qwertyuiop[],شسيبل;asdfg,اتنمكط;hjkl\;',ئءؤرلا;zxcvb,ىةوزظ;nm،./,لآB,آN,'M,؟?,ِA,ٍS,لأG,أH,ـJ,،K,ًW,ُE,ٌR,لإT,إY,÷I,×O,؛P
Fonts
Check Font configuration/Examples#Arabic for setting up font configuration. Persian fonts like vazirmatn-fontsAUR also include support for Arabic letters. A list of Persian fonts can be checked from Fonts#Persian.
Multi-script fonts:
- noto-fonts - Google Noto fonts includes Noto Kufi Arabic, Noto Sans Arabic, and Noto Kufi Arabic. Use noto-fonts-arAUR for installing these only.
- ttf-ibm-plex
- ttf-dejavu - Includes the monospace DejaVu Sans Mono' font.
-
ttf-arabeyes-fontsAUR — Collection of free Arabic fonts that includes:
- KACST fonts
- Thuluth script font
- Thabit: monospace font
- Decorative: AlArabiya, AlBattar, AlHor, and others.
Sans-Serif:
Monospace:
- vazir-code-fontsAUR - Persian font with good monospace support for Arabic.
- otf-kawkab-monoAUR
- ttf-amiri-typewriterAUR - Typewriter Naskh font based on Amiri
Bitmap:
Naskh (~Serif):
- ttf-scheherazade-new — Unicode Arabic font from SIL (Alternative for Traditional Arabic font)
- ttf-amiriAUR — A classical Arabic typeface in Naskh style pioneered by Amiria Press. Its Latin characters are based on Crimson (otf-crimson) [2] [3]
- ttf-qurancomplex-fontsAUR — Fonts by King Fahd Glorious Quran Printing Complex in al-Madinah al-Munawwarah
- ttf-sil-lateefAUR — Unicode Arabic font from SIL
- ttf-aref-ruqaaAUR - Ruq'ah typeface.
- ttf-cairoAUR
- ttf-mada-variableAUR
- ttf-raqqAUR - A manuscript Kufic typeface.
- ttf-reem-kufiAUR
- otf-qahiriAUR
Kashida support
- LibreOffice: automatically applied for Arabic text in "Justified" paragraphs.
-
LaTeX: by using
justification = kashida
option in Babel package. The following is a sample document:
\documentclass{article} \usepackage[ english, bidi=basic, ]{babel} \babelprovide[ import, main, justification = kashida, transforms = kashida.plain ]{arabic} \babelfont[arabic]{rm}{FreeSerif} \begin{document} قِفَا نَبْكِ مِنْ ذِكْرَى حَبِيبٍ ومَنْزِلِ، بِسِقْطِ اللِّوَى بَيْنَ الدَّخُول فَحَوْمَلِ. فَتُوْضِحَ فَالمِقْراةِ لمْ يَعْفُ رَسْمُها، لِمَا نَسَجَتْهَا مِنْ جَنُوبٍ وشَمْألِ. تَرَى بَعَرَ الأرْآمِ فِي عَرَصَاتِهَا، وَقِيْعَانِهَا كَأنَّهُ حَبُّ فُلْفُلِ. كَأنِّي غَدَاةَ البَيْنِ يَوْمَ تَحَمَّلُوا، لَدَى سَمُرَاتِ الحَيِّ نَاقِفُ حَنْظَلِ. وُقُوْفًا بِهَا صَحْبِي عَليَّ مَطِيَّهُمُ، يَقُوْلُوْنَ: لا تَهْلِكْ أَسًى وَتَجَمَّلِ. وإِنَّ شِفائِيَ عَبْرَةٌ مُهْرَاقَةٌ، فَهَلْ عِنْدَ رَسْمٍ دَارِسٍ مِنْ مُعَوَّلِ؟. كَدَأْبِكَ مِنْ أُمِّ الحُوَيْرِثِ قَبْلَهَا، وَجَارَتِهَا أُمِّ الرَّبَابِ بِمَأْسَلِ. إِذَا قَامَتَا تَضَوَّعَ المِسْكُ مِنْهُمَا، نَسِيْمَ الصَّبَا جَاءَتْ بِرَيَّا القَرَنْفُلِ. فَفَاضَتْ دُمُوْعُ العَيْنِ مِنِّي صَبَابَةً، عَلَى النَّحْرِ حَتَّى بَلَّ دَمْعِيَ مِحْمَلِي. \end{document}
Tips and tricks
- Disable URL encoding for links containing Arabic characters. See Character encoding#URL encoding.
Troubleshooting
Common issues may be solved by checking Locale#Troubleshooting and Character encoding#Troubleshooting first. For problems related to letter-shaping or text direction, check Bidi.
XKB Lam Alif problem
X keyboard layout sends Arabic ligature glyphs as a single glyph. For example, Laa+Alif ligature "لا" (U+0644, U+0627) is sent as "ﻻ" (U+FEFB), and similarly for (ﻷ، ﻵ، ﻹ). This is due to a known limitation in xkb which does not allow mapping a key to more than one character. To solve this problem, run a supported input method. The input method workaround takes advantage of Compose Sequences. For a technical reading on this, check [4]. These are confirmed to work:
- IBus: supported since v1.5.28.
- ibus-typing-booster: supported since 2.19.0
For a more lightweight option, you can use Xim. Add the following to your environment variables:
XIM=none XIM_PROGRAM=/bin/true XIM_ARGS= GTK_IM_MODULE=xim QT_IM_MODULE=xim SHORT_DESC="X compose table"
Alternatively, you can use IM config wrapper script: im-config -n xim
.
Since QT-based programs do not have this issue, it is enough to add export GTK_IM_MODULE=xim
to ~/.xsessionrc
or ~/.xprofile
. The issue is also fixed for GTK4.
AltGr
key. The default compose table is located in /usr/share/X11/xkb/symbols/ara
.Fix Arabic legibility when using Noto Fonts
If Arabic characters are rendered an in an unexpected font (e.g: Nastaliq, Urdu font, etc.), see Font configuration/Examples#Excluding Arabic script from other languages.