# Changing catcode of Arabic vowel

I'm using XeLaTeX and Khaled Hosny's Amiri font for writing Arabic, the vowel tanwin fath is place above the letter alif (second word in sixth line in the output belw). This makes for a tall glyph that increases the height between baselines. For aesthetic reasons I do not want to increase \baselineskip to compensate for this. Instead I have made a macro to lower the vowel sign and place it next to the letter (second word in fifth row).

This all works pretty well. My problem is that I want want to map this with a \catcode command to make an automatic solution, which I can't figure out how to do. If I map it directly, using \catcode with a back tick, I get an error message saying that it is inaccessible.

\documentclass{article}
\usepackage{polyglossia}
\newfontfamily\arabicfont[Script=Arabic
,Scale=MatchUppercase
,RawFeature={+ss01,+ss02}
% ss01 = mode dot in baa down when clashing.
% ss02 = mim-alif ligatures
% ss05 = kasra below letter, not below shadda
]{Amiri}

\setmainlanguage{arabic}
\def\lowan{\raisebox{-.8ex}{%
\hspace{-.1em}%
ً%
}}

\begin{document}
\begin{minipage}{28mm}
يجوز الوقوف بالساكون عند تتابع الأعلام في مثل «~سافر محمد على حسين~» مع حذف «~ابن~»
تيسيرا\lowan{} % <-- Macro
على القراء والكتاب ،
وتخلصاً % <--- To be changed with catcode
من صعوبة الإعراب~.
\end{minipage}
\end{document}


(Odd spacing in punctuation is intentional.)

• Not an answer to your question, but I consider it to be more grammatically correct and aesthetically pleasing to place the tanwīn over the letter it actually affects (like one does with dammatan and kasratan) instead of the Alef. – Khaled Hosny Jan 30 '15 at 16:33
• If I understand you correctly this would mean adding fatḥatān in ṣāḍ in تخلصا in the example. That would have the effect I am looking for. However, if I do this in Amiri the ṣāḍ does not connect with the following alif. In the book that is quoted in the example the fatḥatān is (are?) above, i.e. after the alif. Both variants are quite common, arent't they? – Andreas Jan 30 '15 at 18:32
• Yes, above the ṣāḍ and it should connect, otherwise there is a bug somewhere. Both are common, though placing it above the alif stems mainly from the metal type days as it was more convenient to make one sort for the fatḥatān and the alif. – Khaled Hosny Jan 30 '15 at 19:14
• @Haled Hosny I think it must be the expansion on the macro in \newunicodechar that breaks the connection. If I remove the redefinition of tanwin fath and place it instead after the modified character (not after alif) as you suggested, letters do connect and tanwin appears before the alif. It is still place very high though, above the following alif. – Andreas Feb 2 '15 at 9:15

I'd say that adding \usepackage{newunicodechar} and

\newunicodechar{ً}{\lowan}


should do.

\documentclass{article}
\usepackage{polyglossia}
\usepackage{newunicodechar}
\newfontfamily\arabicfont[Script=Arabic
,Scale=MatchUppercase
,RawFeature={+ss01,+ss02}
% ss01 = mode dot in baa down when clashing.
% ss02 = mim-alif ligatures
% ss05 = kasra below letter, not below shadda
]{Amiri}

\setmainlanguage{arabic}
\def\lowan{\raisebox{-.8ex}{%
\hspace{-.1em}%
ً%
}}
\newunicodechar{ً}{\lowan}

\begin{document}
\begin{minipage}{28mm}
يجوز الوقوف بالساكون عند تتابع الأعلام في مثل «~سافر محمد على حسين~» مع حذف «~ابن~»
تيسيرا\lowan{} % <-- Macro
على القراء والكتاب ،
وتخلصاً % <--- To be changed with catcode
من صعوبة الإعراب~.
\end{minipage}
\end{document}