% engine=luatex 

% OpenType features needed for Arabic
\definefontfeature
  [arab]
  [mode=node,language=dflt,script=arab,
   init=yes,medi=yes,fina=yes,isol=yes,
   liga=yes,dlig=yes,rlig=yes,clig=yes,
   mark=yes,mkmk=yes,kern=yes,curs=yes]

\font\Arab = arabtype*arab

\setcharactermirroring[1]

\hoffset=0pt

% For inner paragraph control within an LR paragraph

\definestartstop
  [arabictext]
  [commands=%
    {\textdir TRT%
    \Arab}]

\def\ArabicText#1{\startarabictext#1\stoparabictext}

% For separate Arabic-script paragraphs

\def\ArabicDirPar{\textdir TRT\pardir TRT}

\definestartstop
  [arab]
  [commands=%
    {\Arab%
     \ArabicDirPar}]

\showframe[text]

\starttext
\startarab
سلام (قوس) وقوس <قوس> و [قوس]

وهذا قوس حول نص غير عربي \textdir TLT (hello) \textdir TRT ثم عربي 

\stoparab

\blank

Here is some mixed {\em Arabic-} (\ArabicText{عربي}) and
Latin-script. As you can see, Aleph does a very good job mixing
{\em LR} (\ArabicText{يسار-يمين}) and {\em RL}
(\ArabicText{يمين-يسار}) texts. \ArabicText{و
هنا جملة منقطعة في وسط قرينة
لاتينية}. Aleph even does a great job breaking Arabic
phrases across lines.

(bracket) and <bracket> and [bracket]

\stoptext
