建议(根据文档)在quran
包中使用 Amiri 或 Scheherazade 字体,但在这种情况下我想尝试不同的字体侯赛尼·纳斯塔利克.考虑此代码。
\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}
结果:
我们可以看到,Hussaini Nastaleeq 字体的华丽括号无法正确显示。为了解决这个问题,我做了以下解决方法。
\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}
结果:
它起作用了,但我想知道有没有更好的方法来做到这一点?
答案1
\qt@no
您可以修补保存阿亚编号并使用字体作为括号的命令Amiri
(阿亚编号也带有Amiri
字体)。
\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}
更新日期:2018/07/18 从XeTeX 中特定字符的字体选择
\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}