3

It's recommended (from the documentation) to use Amiri or Scheherazade font for the quran package, but I want to try different font in this case Hussaini Nastaleeq. Consider this code.

\documentclass[b5paper,11pt]{memoir}
\usepackage[left=1.8cm,right=1.8cm,top=3cm]{geometry}
\usepackage{fontspec}
\usepackage{arabxetex}
\usepackage[uthmani]{quran}

\newcommand{\Amiri}{\newfontfamily\arabicfont[Language=Arabic,Script=Arabic]{Amiri}}
\newcommand{\Huss}{\newfontfamily\arabicfont[Language=Arabic,Script=Arabic]{Hussaini Nastaleeq}}

\begin{document}
\noindent
Amiri:
\medskip
\begin{arab}
\noindent\quransurah*[1]
\end{arab}

\medskip\medskip
\noindent
Hussaini Nastaleeq:
\medskip
\Huss
\begin{arab}
\noindent\quransurah*[1]
\end{arab}
\end{document}

Result:

enter image description here

As we can see, the ornate parentheses are not properly shown for the Hussaini Nastaleeq font. In order to overcome this problem, I made the following workaround.

\documentclass[b5paper,11pt]{memoir}
\usepackage[left=1.8cm,right=1.8cm,top=3cm]{geometry}
\usepackage{fontspec}
\usepackage{arabxetex}
\usepackage[uthmani]{quran}
\usepackage{bidi}

\newcommand{\Amiri}{\newfontfamily\arabicfont[Language=Arabic,Script=Arabic]{Amiri}}
\newcommand{\Huss}{\newfontfamily\arabicfont[Language=Arabic,Script=Arabic]{Hussaini Nastaleeq}}
\newcommand{\HNMrk}[1]{\Amiri\textarab{\symbol{"FD3F}}\Huss\textarab{#1}\Amiri\textarab{\symbol{"FD3E}}\Huss}
\newcommand{\AHN}[2]{\Huss\textarab{\ToggleAyahNumber\quranayah[#1][#2]}\HNMrk{#2}}

\begin{document}
\noindent
Amiri:
\medskip
\begin{arab}
\noindent\quransurah*[1]
\end{arab}

\medskip\medskip
\noindent
Hussaini Nastaleeq:
\medskip

\setRTL
\noindent\AHN{1}{1}\AHN{1}{2}\AHN{1}{3}\AHN{1}{4}\AHN{1}{5}\\\AHN{1}{6}\AHN{1}{7}
\end{document}

Result:

enter image description here

It worked but I wonder, is there a better way to do this?

  • 1
    You can probably use \DeclareUnicodeCharacter with the codepoints FD3E and FD3F to define a replacement character for the ornate parentheses. – Marijn Jul 14 '18 at 16:16
2

You can patch the command \qt@no which hold ayah number and use Amiri font for parentheses (the ayah numbre is also with Amiri font).

\documentclass[b5paper,11pt]{memoir}
\usepackage[left=1.8cm,right=1.8cm,top=3cm]{geometry}
\usepackage{arabxetex}
\usepackage[uthmani]{quran}


\newfontfamily\Amiri[Script=Arabic]{Amiri}
\newfontfamily\Huss[Script=Arabic]{Hussaini Nastaleeq}

\begin{document}
\noindent
Amiri:
\medskip
\begin{arab}
\noindent\Amiri\quransurah*[1]
\end{arab}

\medskip\medskip
\noindent
Hussaini Nastaleeq:
\medskip

\makeatletter
\def\qt@no#1{\begingroup\Amiri #1\endgroup}
\makeatother

\begin{arab}
\noindent\Huss\quransurah*[1]
\end{arab}

\end{document}

Update 18/07/2018 from Font selection in XeTeX for specific characters

\documentclass[b5paper,11pt]{memoir}
\usepackage[left=1.8cm,right=1.8cm,top=3cm]{geometry}
\usepackage{arabxetex}
\usepackage[uthmani]{quran}

\newfontfamily\Amiri[Script=Arabic]{Amiri}
\newfontfamily\Huss[Script=Arabic]{Hussaini Nastaleeq}
\let\arabicfont\Amiri


\def\AmiriOrnOn{%
\XeTeXinterchartokenstate=1 % activate 
\chardef\CharBound=4095     % The boundary of text string

\newXeTeXintercharclass\CharNumbers 
\XeTeXcharclass`٠=\CharNumbers
\XeTeXcharclass`١=\CharNumbers
\XeTeXcharclass`٢=\CharNumbers
\XeTeXcharclass`٣=\CharNumbers
\XeTeXcharclass`٤=\CharNumbers
\XeTeXcharclass`٥=\CharNumbers
\XeTeXcharclass`٦=\CharNumbers
\XeTeXcharclass`٧=\CharNumbers
\XeTeXcharclass`٨=\CharNumbers
\XeTeXcharclass`٩=\CharNumbers

\newXeTeXintercharclass\rightpcharclass
\newXeTeXintercharclass\leftpcharclass

\XeTeXcharclass"FD3F=\rightpcharclass
\XeTeXcharclass"FD3E=\leftpcharclass

\newtoks\TokSetfont
\TokSetfont={\begingroup\Amiri}
\XeTeXinterchartoks\CharBound\rightpcharclass=\TokSetfont
\XeTeXinterchartoks\rightpcharclass\CharNumbers={\endgroup}

\XeTeXinterchartoks\CharNumbers\leftpcharclass=\TokSetfont
\XeTeXinterchartoks\leftpcharclass\CharBound={\endgroup}
}

\def\AmiriOrnOff{\XeTeXinterchartokenstate=0} % deactivate


\begin{document}
\noindent
Amiri:
\medskip
\begin{arab}
\noindent\Amiri\quransurah*[1]
\end{arab}


\bigskip
\noindent
Hussaini Nastaleeq: % only  parentheses (of ayah number) from amiri  
\medskip

\AmiriOrnOn

\begin{arab}
\noindent\Huss\quransurah*[1]
\end{arab}

\AmiriOrnOff


\end{document}

enter image description here

  • This is nice, but retaining the font for the ayah number is crucial – Sukan Jul 17 '18 at 16:05
  • You need to add \begingroup\Amiri before \char"FD3F and \char"FD3E and to add \endgroup after them – Salim Bou Jul 18 '18 at 10:45
  • I will update my answer If I have enough time. – Salim Bou Jul 18 '18 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.