![如何将默认字体设置为使用 babel 定义的自定义字体系列?](https://linux22.com/image/469204/%E5%A6%82%E4%BD%95%E5%B0%86%E9%BB%98%E8%AE%A4%E5%AD%97%E4%BD%93%E8%AE%BE%E7%BD%AE%E4%B8%BA%E4%BD%BF%E7%94%A8%20babel%20%E5%AE%9A%E4%B9%89%E7%9A%84%E8%87%AA%E5%AE%9A%E4%B9%89%E5%AD%97%E4%BD%93%E7%B3%BB%E5%88%97%EF%BC%9F.png)
我有使用自定义设置加载的自定义字体文件\babelfont
:
\babelfont{assistant}[
Extension = .ttf,
Path = ./fonts/assistant/,
UprightFont=*-Regular,
BoldFont = *-Bold,
ItalicFont = *-Regular,
ItalicFeatures = {FakeSlant=0.3}
]{Assistant}
我想使用具有这些设置的此字体作为rm
我的语言希伯来语的主要字体。我可以复制粘贴定义:
\babelfont[hebrew]{rm}[
Extension = .ttf,
Path = ./fonts/assistant/,
UprightFont=*-Regular,
BoldFont = *-Bold,
ItalicFont = *-Regular,
ItalicFeatures = {FakeSlant=0.3}
]{Assistant}
但感觉不对。无论主字体是什么,我都希望定义自定义字体,这样我就可以始终使用\assistantfamily
和,\assistanttext
以防将来决定使用其他字体。但是,现在我想使用此字体作为主字体。我尝试了和之rm
类的方法,但没有用。如何使用定义为的自定义系列作为主字体?\babelfont[hebrew]{rm}{david}
\babelfont[hebrew]{rm}{\davidfamily}
\babelfont
下面是我使用的代码的一个最小示例:
\documentclass[a4paper, 12pt]{extarticle}
\PassOptionsToPackage{no-math}{fontspec}
\usepackage[bidi=basic, layout=tabular]{babel}
\babelprovide[main, import, alph=letters, Alph=letters]{hebrew}
\babelprovide[import]{english}
% Font setup
\babelfont{assistant}[
Extension = .ttf,
Path = ./fonts/assistant/,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Regular,
ItalicFeatures = {FakeSlant=0.3}
]{Assistant}
% How can I use the previously defined `assistant` family instead of copy-pasting its settings?
\babelfont[hebrew]{rm}[
Extension = .ttf,
Path = ./fonts/assistant/,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Regular,
ItalicFeatures = {FakeSlant=0.3}
]{Assistant}
\begin{document}
שלום לכולם
\[ E = mc^2 \]
\end{document}
以下是文件结构: