我正在尝试在 wsl 中从 pdflatex 切换到 xelatex,但还没有找到解决字体查找问题的方法。
kpathsea: Running mktextfm P22Virgi
/usr/share/texlive/texmf-dist/web2c/mktexnam: Could not map source abbreviation P for P22Virgi.
/usr/share/texlive/texmf-dist/web2c/mktexnam: Need to update /usr/share/texlive/texmf-dist/fonts/map/fontname/special.map?
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input P22Virgi
This is METAFONT, Version 2.7182818 (TeX Live 2019/Debian) (preloaded base=mf)
kpathsea: Running mktexmf P22Virgi
! I can't find file `P22Virgi'.
<*> ...ljfour; mag:=1; nonstopmode; input P22Virgi
Please type another input file name
! Emergency stop.
<*> ...ljfour; mag:=1; nonstopmode; input P22Virgi
Transcript written on mfput.log.
grep: P22Virgi.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input P22Virgi' failed to make P22Virgi.tfm.
kpathsea: Appending font creation commands to missfont.log.
! Package fontspec Error: The font "P22Virgi" cannot be found.
For immediate help type H <return>.
...
l.7
? H
A font might not be found for many reasons.
Check the spelling, where the font is installed etc. etc.
When in doubt, ask someone for help!
?
和:
hsmyers@BigIron:~/c-dev/tex/tab$ cat ~/.config/fontconfig/fonts.conf
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<dir>/mnt/c/Windows/Fonts/</dir>
</fontconfig>
hsmyers@BigIron:~/c-dev/tex/tab$
在 fc-cache 之后:
hsmyers@BigIron:~/c-dev/tex/tab$ ll /mnt/c/Windows/Fonts/P22Vir*
-rwxrwxrwx 1 hsmyers hsmyers 88643 Feb 24 2005 /mnt/c/Windows/Fonts/P22Virgi.PFB*
-rwxrwxrwx 1 hsmyers hsmyers 1137 Feb 24 2005 /mnt/c/Windows/Fonts/P22Virgi.pfm*
-rwxrwxrwx 1 hsmyers hsmyers 144120 Feb 24 2005 /mnt/c/Windows/Fonts/P22Virgi.ttf*
hsmyers@BigIron:~/c-dev/tex/tab$
在最小示例文件“test.tex”上:
\documentclass{article}
\usepackage{fontspec,lipsum}
\defaultfontfeatures{Ligatures=TeX}
% \setromanfont{/mnt/c/Windows/Fonts/P22Virgi.ttf}%
\setromanfont{P22Virgi}%
\begin{document}
\end{document}
请注意,尝试了完整路径(尽管进行了 font.conf 操作)但失败了。'Path = ' 版本也失败了。我在 Windows 中使用过 xelatex,但这是在 wsl(Ubuntu)下的第一次尝试。我已经安装了 texlive,使用 pdflatex 没有任何问题,但更喜欢字体友好的 xelatex,因此进行了这次尝试。