Arabic and Hebrew

From Wiki
Revision as of 16:57, 19 June 2008 by Khaled (talk | contribs) (→‎arabic.tex: not needd any more)
Jump to navigation Jump to search

TODO: overview page for the use of middle-eastern scripts (See: To-Do List)


Examples

arabic.tex

To use a specific font just put it under the current directory where you run context, and replace ScheherazadeRegOT with your font file name. Then run 'context arabic.tex' .

% 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]

% ScheherazadeRegOT is the font file name (without extension) replace it with your preferred font 
\font\Arab = ScheherazadeRegOT*arab

\hoffset=0pt

% For inner paragraph control within an LR paragraph

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

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

% For global Arabic script

\def\ArabicDirGlobal{%
\pagedir TRT\bodydir TRT\textdir TRT\pardir TRT}

\def\Arabic{\ArabicDirGlobal\Arab}

% For separate Arabic-script paragraphs

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

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

\showframe[text]

\starttext

\startarab

اللَّهُمَّ صَلِّ عَلَى مُحَمَّدٍ وَ
آلِ مُحَمَّدٍ وَ ارْزُقْنِي
الْيَقِينَ وَ حُسْنَ الظَّنِّ بِكَ
وَ أَثْبِتْ رَجَاءَكَ فِي قَلْبِي
وَ اقْطَعْ رَجَائِي عَمَّنْ سِوَاكَ
حَتَّى لَا أَرْجُوَ غَيْرَكَ وَ لَا
أَثِقَ إِلَّا بِك‏

\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.

\stoptext