<div dir="ltr">In LaTeX, if you use the code in a document like<br><br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
<meta name="qrichtext" content="1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;">\documentclass{article}</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">\pagedir TRT \bodydir TRT \pardir TRT \textdir TRT</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">\directlua {</p>
<p style="margin: 0px; text-indent: 0px;">    dofile(kpse.find_file(&quot;luatex-fonts.lua&quot;,&quot;tex&quot;))</p>
<p style="margin: 0px; text-indent: 0px;">}</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">\font\body=file:XBZar.ttf:mode=node;script=arab;language=ara;+init;+medi;+fina;+liga;+rlig;+mark;+mkmk at 14pt</p>
<p style="margin: 0px; text-indent: 0px;">\def\normalfont{\body}</p>
<p style="margin: 0px; text-indent: 0px;">\AtBeginDocument{\body}</p>
<p style="margin: 0px; text-indent: 0px;">\begin{document}</p>
<p style="margin: 0px; text-indent: 0px;">این یک آزمایش است که در حال وقوع است.</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">\section{مقدمه}</p>
<p style="margin: 0px; text-indent: 0px;">\end{document}</p><p style="margin: 0px; text-indent: 0px;">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">
Then when you have \section in it, LuaTeX gives error and that is</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;"><br><meta name="qrichtext" content="1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
p, li { white-space: pre-wrap; }
</style><br></p><p style="margin: 0px; text-indent: 0px;">! LuaTeX error /home/vafa/texmf/tex/luatex-fonts/font-def.lua:337: attempt to c</p>
<p style="margin: 0px; text-indent: 0px;">all field &#39;read_from_afm&#39; (a nil value).</p>
<p style="margin: 0px; text-indent: 0px;">&lt;to be read again&gt; </p>
<p style="margin: 0px; text-indent: 0px;">                   relax </p>
<p style="margin: 0px; text-indent: 0px;">l.16 \section{مقدمه}</p>
<p style="margin: 0px; text-indent: 0px;">                         </p>
<p style="margin: 0px; text-indent: 0px;">? <br></p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">but if you write just normal texts without using any CS, then there is no error.</p>
<p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">I will write an interface for handling fonts in LaTeX very soon provided these kind of issues can be fade away.</p>
<p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;"><br></p><p></p><br></div>