@@ -589,7 +589,7 @@ Copyright and Licence
589589% \changes{v2.4.15}{2019/03/23}{同步 \LaTeXiii{} 2019/03/05。}
590590% \changes{v2.5.1}{2020/05/02}{\pkg{zhconv} 更名为 \pkg{ctex-zhconv}。}
591591%
592- % \CheckSum{6905 }
592+ % \CheckSum{6916 }
593593%
594594% \CharacterTable
595595% {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
@@ -12238,29 +12238,47 @@ Copyright and Licence
1223812238% \end{macrocode}
1223912239%
1224012240% \begin{macro}{\@@_if_font_exists:nTF}
12241- % 检测字体是否为 \TeX\ Tree 字体,\cs{@@_write_family:nn} 会根据结果调用
12242- % |kpathsea| 查文件或 |fontconfig| 查名称。
12241+ % 优先搜索字体是否为 \TeX\ Tree 字体或是否存在于当前路径下\footnote{^^A
12242+ % 事实上 \path{TEXINPUTS} 也会被一并优先搜索。},
12243+ % 如果不存在,\cs{@@_write_family:nn} 会根据结果在 |shell| 中调用 |kpathsea| 查文件
12244+ % 或 |fontconfig| 查名称\footnote{^^A
12245+ % 如果用户把字体目录加入到了 \path{TEXINPUTS} 中,
12246+ % \cs{file_if_exist_p:n} 可能找到一个 \XeTeX\ |"[basename]"| 加载不了的文件,
12247+ % 因为 \XeTeX\ 搜索字体专属路径 \path{OPENTYPEFONTS}/\path{TTFONTS},
12248+ % 不搜索 \path{TEXINPUTS})。
12249+ % }。
1224312250% \begin{macrocode}
1224412251\prg _new_protected_conditional:Nnn \@@ _if_font_exists:n { TF }
1224512252 {
12246- \sys _get_shell:nnN { kpsewhich ~ #1.otf } { \endlinechar =-1 }
12247- \l _@@_if_font_exists_otf_tl
12248- \sys _get_shell:nnN { kpsewhich ~ #1.ttf } { \endlinechar =-1 }
12249- \l _@@_if_font_exists_ttf_tl
12253+ \tl _clear:N \l _@@_if_otf_exists_tl
12254+ \tl _clear:N \l _@@_if_ttf_exists_tl
12255+ \bool _case:nF
12256+ {
12257+ { \file _if_exist_p:n { #1.otf } }
12258+ { \tl _set:Nn \l _@@_if_otf_exists_tl {#1} }
12259+ { \file _if_exist_p:n { #1.ttf } }
12260+ { \tl _set:Nn \l _@@_if_ttf_exists_tl {#1} }
12261+ }
12262+ {
12263+ \sys _get_shell:nnN { kpsewhich ~ #1.otf } { \endlinechar =-1 }
12264+ \l _@@_if_otf_exists_tl
12265+ \sys _get_shell:nnN { kpsewhich ~ #1.ttf } { \endlinechar =-1 }
12266+ \l _@@_if_ttf_exists_tl
12267+ }
1225012268 \bool _lazy_and:nnTF
12251- { \tl _if_blank_p:V \l _@@_if_font_exists_otf_tl }
12252- { \tl _if_blank_p:V \l _@@_if_font_exists_ttf_tl }
12269+ { \tl _if_blank_p:V \l _@@_if_otf_exists_tl }
12270+ { \tl _if_blank_p:V \l _@@_if_ttf_exists_tl }
1225312271 { \prg _return_false: } { \prg _return_true: }
1225412272 }
1225512273% \end{macrocode}
1225612274% \end{macro}
1225712275%
1225812276% \begin{variable}
12259- % {\l_@@_if_font_exists_otf_tl , \l_@@_if_font_exists_ttf_tl }
12277+ % {\l_@@_if_otf_exists_tl , \l_@@_if_ttf_exists_tl }
1226012278% 用于存储 |shell| 输出的 |kpsewhich| 结果。
1226112279% \begin{macrocode}
12262- \tl _new :N \l _@@_if_font_exists_otf_tl
12263- \tl _new :N \l _@@_if_font_exists_ttf_tl
12280+ \tl _clear_new :N \l _@@_if_otf_exists_tl
12281+ \tl _clear_new :N \l _@@_if_ttf_exists_tl
1226412282% \end{macrocode}
1226512283% \end{variable}
1226612284%
0 commit comments