Pen-stroke order to write letters of the Arabic alphabet?

Is there a way in LaTeX to typeset the correct pen-stroke order to write letters of the Arabic alphabet?

Example:

Typesetting in XeLaTeX with package polyglossia.

UPDATE 1: General note: The writing of Arabic letters, both in it's initial, beginning, middel and last position, have a specific rules for the correct pen-stroke (writing).

• Can you please clarify what do you mean by 'correct pen-stroke order'? – Niranjan Jul 21 '19 at 6:43
• Tex deals with letters as boxes and do not know nothing on their shapes, I think you can use tikz or metapost to draw letters and add those arrows. – Salim Bou Jul 21 '19 at 7:01
• @SalimBou, can you ref or show a MWE with tikz ? – imdk4242 Jul 21 '19 at 8:10
• how did you get the images shown in the question, you could include those into latex. – David Carlisle Jul 21 '19 at 10:12

Here an example for the first letter jim use the same way for other letters, the idea is to add a grid to facilitate placing arrows on the contour of letter based on this answer https://tex.stackexchange.com/a/9562/54817

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{polyglossia}
\setdefaultlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}

\def\mygrid{
\begingroup
\draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
\foreach \x in {1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
\foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
\endgroup
}

\begin{document}

\begin{center}
\begin{tikzpicture}
\node(jim)[anchor=south west,font=\bfseries\Huge]{ج};
}
\begin{scope}[x={(jim.south east)},y={(jim.north west)},>=stealth]
%\mygrid
\draw[very thick,red,->](0.3,0.9)node[left]{1} to[out=20,in=200] (0.7,0.9);
\draw[very thick,red,->](0.2,0.6)node[above]{2} to[out=220,in=120] (0.2,0.2);
\draw[very thick,red,<-](0.65,0.5) -- +(0.15,0.1)node[above right]{3};
\end{scope}
\end{tikzpicture}
\end{center}

\end{document}