警告:kpsewhich:忽略未知文件类型“ttf”

警告:kpsewhich:忽略未知文件类型“ttf”

当我使用 kpsewhich 查找系统字体时,如下所示:

/app # kpsewhich --format="ttf" Kaiti.ttf
warning: kpsewhich: Ignoring unknown file type `ttf'.

是否可以使用 kpsewhich 搜索 ttf/otf 字体?

答案1

您可以搜索它们,但只有当它们位于 搜索的 TeX 树之一中时才会被找到kpsewhich。这不包括您的操作系统的系统字体目录。

$ kpsewhich SourceCodePro-Regular.otf
/usr/local/texlive/2023/texmf-dist/fonts/opentype/adobe/sourcecodepro/SourceCodePro-Regular.otf

你可以使用以下方式获取文件类型列表

$ kpsewhich --help-formats
kpathsea version 6.3.5

Recognized Kpathsea format names and their (abbreviations) and suffixes:
gf: gf  [variables: GFFONTS GLYPHFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/gf/$MAKETEX_MODE//]
pk: pk  [variables: PKFONTS TEXPKS GLYPHFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:{$TEXMF/fonts,$VARTEXFONTS}/pk/{$MAKETEX_MODE,modeless}//]
bitmap font (bitmapfont):  [variables: GLYPHFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts]
tfm: .tfm  [variables: TFMFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:{$TEXMF/fonts,$VARTEXFONTS}/tfm//]
afm: .afm  [variables: AFMFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/afm//:$OSFONTDIR//]
base: .base  [variables: MFBASES TEXMFINI]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/web2c{/$engine,}]
bib: .bib  [variables: BIBINPUTS TEXBIB]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/bibtex/bib//]
bst: .bst  [variables: BSTINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/bibtex/{bst,csf}//]
cnf: .cnf  [variables: TEXMFCNF]
  [original path (from compile-time paths.h) = {$SELFAUTOLOC,$SELFAUTOLOC/share/texmf-local/web2c,$SELFAUTOLOC/share/texmf-dist/web2c,$SELFAUTOLOC/share/texmf/web2c,$SELFAUTOLOC/texmf-local/web2c,$SELFAUTOLOC/texmf-dist/web2c,$SELFAUTOLOC/texmf/web2c,$SELFAUTODIR,$SELFAUTODIR/share/texmf-local/web2c,$SELFAUTODIR/share/texmf-dist/web2c,$SELFAUTODIR/share/texmf/web2c,$SELFAUTODIR/texmf-local/web2c,$SELFAUTODIR/texmf-dist/web2c,$SELFAUTODIR/texmf/web2c,$SELFAUTOGRANDPARENT/texmf-local/web2c,$SELFAUTOPARENT,$SELFAUTOPARENT/share/texmf-local/web2c,$SELFAUTOPARENT/share/texmf-dist/web2c,$SELFAUTOPARENT/share/texmf/web2c,$SELFAUTOPARENT/texmf-local/web2c,$SELFAUTOPARENT/texmf-dist/web2c,$SELFAUTOPARENT/texmf/web2c}]
ls-R: ls-R ls-r  [variables: TEXMFDBS]
  [original path (from texmf.cnf) = {!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFLOCAL,!!$TEXMFDIST,$TEXMFARCH}]
fmt: .fmt  [variables: TEXFORMATS TEXMFINI]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/web2c{/$engine,}]
map: .map  [variables: TEXFONTMAPS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/map/{$progname,pdftex,dvips,}//]
mem: .mem  [variables: MPMEMS TEXMFINI]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/web2c{/$engine,}]
mf: .mf  [variables: MFINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/metafont//:{$TEXMF/fonts,$VARTEXFONTS}/source//]
mfpool: .pool  [variables: MFPOOL TEXMFINI]
  [original path (from texmf.cnf) = ${TEXPOOL}]
mft: .mft  [variables: MFTINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/mft//]
mp: .mp  [variables: MPINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/metapost//]
mppool: .pool  [variables: MPPOOL TEXMFINI]
  [original path (from texmf.cnf) = ${TEXPOOL}]
MetaPost support (mpsupport):  [variables: MPSUPPORT]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/metapost/support]
ocp: .ocp  [variables: OCPINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/omega/ocp//]
ofm: .ofm .tfm  [variables: OFMFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:{$TEXMF/fonts,$VARTEXFONTS}/{ofm,tfm}//]
opl: .opl  .pl  [variables: OPLFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:{$TEXMF/fonts,$VARTEXFONTS}/opl//]
otp: .otp  [variables: OTPINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/omega/otp//]
ovf: .ovf .vf  [variables: OVFFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:{$TEXMF/fonts,$VARTEXFONTS}/{ovf,vf}//]
ovp: .ovp  .vpl  [variables: OVPFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:{$TEXMF/fonts,$VARTEXFONTS}/ovp//]
graphic/figure:  .eps .epsi  [variables: TEXPICTS TEXINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/tex/{$progname,generic,latex,}//]
tex: .tex  .sty .cls .fd .aux .bbl .def .clo .ldf  [variables: TEXINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/tex/{$progname,generic,latex,}//]
TeX system documentation (doc):  [variables: TEXDOCS]
  [original path (from texmf.cnf) = $TEXMF/doc//]
texpool: .pool  [variables: TEXPOOL TEXMFINI]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/web2c]
TeX system sources (source):  .dtx .ins  [variables: TEXSOURCES]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/source//]
PostScript header:  .pro  [variables: TEXPSHEADERS PSHEADERS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/{dvips,fonts/{enc,type1,type42,type3}}//]
Troff fonts (trofffont):  [variables: TRFONTS]
  [original path (from texmf.cnf) = /usr{/local,}/share/groff/{current/font,site-font}/devps]
type1 fonts: .pfa .pfb  [variables: T1FONTS T1INPUTS TEXFONTS TEXPSHEADERS PSHEADERS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/type1//:$OSFONTDIR//]
vf: .vf  [variables: VFFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/vf//]
dvips config (dvipsconfig):  [variables: TEXCONFIG]
  [original path (from texmf.cnf) = $TEXMF/dvips//]
ist: .ist  [variables: TEXINDEXSTYLE INDEXSTYLE]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/makeindex//]
truetype fonts: .ttf .ttc .TTF .TTC .dfont  [variables: TTFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/{truetype,opentype}//:$OSFONTDIR//]
type42 fonts: .t42 .T42  [variables: T42FONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/type42//]
web2c files (web2c):  [variables: WEB2C]
  [original path (from texmf.cnf) = $TEXMF/web2c]
other text files (othertext):  [variables: KPSEWHICHINPUTS]
  [original path (from compile-time paths.h) = .:$TEXMF/kpsewhich//]
other binary files (otherbin):  [variables: KPSEWHICHINPUTS]
  [original path (from compile-time paths.h) = .:$TEXMF/kpsewhich//]
misc fonts (miscfont):  [variables: MISCFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/misc//]
web: .web  .ch  [variables: WEBINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/web//]
cweb: .w .web  .ch  [variables: CWEBINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/cweb//]
enc files: .enc  [variables: ENCFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/enc//]
cmap files (cmap):  [variables: CMAPFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/cmap//]
subfont definition files: .sfd  [variables: SFDFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/sfd//]
opentype fonts: .otf .OTF  [variables: OPENTYPEFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/{opentype,truetype}//:$OSFONTDIR//]
pdftex config (pdftexconfig):  [variables: PDFTEXCONFIG]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/pdftex/{$progname,}//]
lig files: .lig  [variables: LIGFONTS TEXFONTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/lig//]
texmfscripts:  [variables: TEXMFSCRIPTS]
  [original path (from texmf.cnf) = $TEXMF/scripts/{$progname,$engine,}//]
lua: .lua .luatex .luc .luctex .texlua .texluc .tlu  [variables: LUAINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/scripts/{$progname,$engine,}/{lua,}//:$TEXMF/tex/{luatex,plain,generic,latex,}//]
font feature files: .fea  [variables: FONTFEATURES]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/fea//]
cid maps: .cid .cidmap  [variables: FONTCIDMAPS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/fonts/cid//]
mlbib: .mlbib .bib  [variables: MLBIBINPUTS BIBINPUTS TEXBIB]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/bibtex/bib/{mlbib,}//]
mlbst: .mlbst .bst  [variables: MLBSTINPUTS BSTINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/bibtex/{mlbst,bst}//]
clua: .dll .so  [variables: CLUAINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$SELFAUTOLOC/lib/{$progname,$engine,}/lua//]
ris: .ris  [variables: RISINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/biber/ris//]
bltxml: .bltxml  [variables: BLTXMLINPUTS]
  [original path (from texmf.cnf) = $TEXMFDOTDIR:$TEXMF/biber/bltxml//]

To see paths after expansion, use --show-path=FMT.

这表明这opentype fonts是我们想要的类型。因此,

$ kpsewhich -format "opentype fonts" SourceCodePro-Regular.otf
/usr/local/texlive/2023/texmf-dist/fonts/opentype/adobe/sourcecodepro/SourceCodePro-Regular.otf

相关内容