升级我的 texlive 后,xepersian 21.9 无法加载旧版本 21.7 可以毫无问题地加载的字体。
我的代码是:
\documentclass{article}
\usepackage{xepersian}
\settextfont[Scale=1.44]{Amiri}
\setlatintextfont[Scale=1.44]{Psychedelia HM}
\pagestyle{empty}
\begin{document}
فانت سایکیدلیا اچام. \lr{Psychedelia HM font.}
\end{document}
我得到的错误是:
(c:/texlive/2018/texmf-dist/tex/xelatex/xepersian/loadingorder
-xepersian.def)
(c:/texlive/2018/texmf-dist/tex/xelatex/xepersian/footnote-xep
ersian.def)
(c:/texlive/2018/texmf-dist/tex/xelatex/xepersian/article-xepe
rsian.def) (./fontspec-xepersian.def))
! Package xepersian Error: The font "Psychedelia HM" cannot be loaded by the
(xepersian) xepersian package.
For immediate help type H <return>.
...
l.5 \pagestyle
{empty}
? h
Select another font and rerun "xelatex".
?
如果这是 xepersian 21.9 中的一个错误,我该如何修复它?
请注意,该文件./fontspec-xepersian.def
与 xepersian 的配置文件之一完全相同
c:/texlive/2018/texmf-dist/tex/xelatex/xepersian/fontspec-xepersian.def
。我将该文件复制到我的工作目录中以修复该问题,但无法修复。其内容fontspec-xepersian.def
如下:
%%
%% This is file `fontspec-xepersian.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xepersian.dtx (with options: `table,fontspec-xepersian.def')
%%
%% __________________________________________________
%% Copyright (c) 2008--2018 Vafa Khalighi <[email protected]>
%%
%% It may be distributed and/or modified under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%%
%% This work is “author-maintained” (as per LPPL maintenance status)
%% by Vafa Khalighi.
%%
%%
%% \CheckSum{10904}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
\ProvidesFile{fontspec-xepersian.def}[2018/11/26 v0.2 fontspec changes]
\ExplSyntaxOn
\cs_new:Npn \__xepersian_error:nx { \msg_error:nnx {xepersian} }
\char_set_catcode_space:n {32}
\cs_new:Nn \__xepersian_msg_new:nnnn
{ \msg_new:nnxx {#1} {#2} { \tl_trim_spaces:n {#3} } { \tl_trim_spaces:n {#4} } }
\__xepersian_msg_new:nnnn {xepersian} {font-cannot-be-loaded}
{
The font "#1" cannot be loaded by the xepersian package.
}
{
Select another font and rerun "xelatex".
}
\char_set_catcode_ignore:n {32}
\prg_new_conditional:Nnn \__xepersian_font_if_cannot_be_loaded:Nn {p,TF,T,F}
{
\str_if_in:NnTF { #1 } { #2 }
{
\prg_return_true:
}
{
\prg_return_false:
}
}
\cs_undefine:N \__fontspec_load_font:
\cs_new:Nn \__fontspec_load_font:
{
\__fontspec_primitive_font_set:Nnn \l_fontspec_font
{ \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt}
\__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} }
\__xepersian_font_if_cannot_be_loaded:NnT \l__fontspec_fontname_up_tl { HM }
{
\__xepersian_error:nx {font-cannot-be-loaded} {\l__fontspec_fontname_up_tl}
\cs_gset_eq:NN \l__fontspec_fontname_up_tl \tex_nullfont:D
}
\__fontspec_set_font_type:N \l_fontspec_font
\__fontspec_primitive_font_gset:Nnn \l_fontspec_font
{ \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt}
\l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly
}
\cs_undefine:N \__fontspec_load_fontname:n
\cs_new:Nn \__fontspec_load_fontname:n
{
\__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1}
\prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist
{ \clist_clear:N \l__fontspec_fontopts_clist }
\keys_set_groups:nnV {fontspec/fontname} {getfontname} \l__fontspec_fontopts_clist
\__fontspec_primitive_font_set:Nnn \l_fontspec_font { \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} {} } {\f@size pt}
\__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} }
\__xepersian_font_if_cannot_be_loaded:NnT #1 { HM }
{
\__xepersian_error:nx {font-cannot-be-loaded} {#1}
\cs_gset_eq:NN \l_fontspec_font \tex_nullfont:D
}
}
\ExplSyntaxOff
\endinput
%%
%% End of file `fontspec-xepersian.def'.
答案1
不幸的是,该包明确禁止加载名称包含字符串的字体HM
您可以使用
\usepackage[fontsloadable]{xepersian}
HM
禁用此功能,或者制作该包的本地副本并用其他任何东西替换两个实例都是合理的,例如ZZZZZ
禁用该功能。