10 fontspec文档中otfinfo命令的使用疑惑?

发布于 2025-01-22 19:33:44

fontspec宏包的文档中有:
image.png

使用otfinfo -h可知:

'Otfinfo' reports information about an OpenType font to standard output.
Options specify what information to print.

Usage: C:\texlive\2024\bin\windows\otfinfo.exe [-sfzpg | OPTIONS] [OTFFILES...]

Query options:
  -s, --scripts                Report font's supported scripts.
  -f, --features               Report font's GSUB/GPOS features.
  -z, --optical-size           Report font's optical size information.
  -p, --postscript-name        Report font's PostScript name.
  -a, --family                 Report font's family name.
  -v, --font-version           Report font's version information.
  -i, --info                   Report font's names and designer/vendor info.
  -g, --glyphs                 Report font's glyph names.
  -t, --tables                 Report font's OpenType tables.
  -u, --unicode                Report font's supported Unicode code points.
      --variable               Report variable font information.
  -T, --dump-table NAME        Output font's 'NAME' table.

Other options:
      --script=SCRIPT[.LANG]   Set script used for --features [latn].
  -V, --verbose                Print progress information to standard error.
  -h, --help                   Print this message and exit.
  -q, --quiet                  Do not generate any error messages.
      --version                Print version number and exit.

Report bugs to <ekohler@gmail.com>.

我不太理解的是示例命令

otfinfo -i `kpsewhich lmroman10-regular.otf`

我在终端的默认路径下使用提示:

otfinfo -i kpsewhich lmroman10-regular.otf
C:\texlive\2024\bin\windows\otfinfo.exe: kpsewhich: No such file or directory
C:\texlive\2024\bin\windows\otfinfo.exe: lmroman10-regular.otf: No such file or directory

然而如果我先运行kpsewhich lmroman10-regular.otf,可以得到:

c:/texlive/2024/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf

然后使用 otfinfo -i c:/texlive/2024/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf则一切正常:

Family:              LM Roman 10
Subfamily:           Regular
Full name:           LMRoman10-Regular
PostScript name:     LMRoman10-Regular
Preferred family:    Latin Modern Roman
Preferred subfamily: 10 Regular
Mac font menu name:  LM Roman 10 Regular
Version:             Version 2.004;PS 2.004;hotconv 1.0.49;makeotf.lib2.0.14853
Unique ID:           2.004;UKWN;LMRoman10-Regular
Trademark:           Please refer to the Copyright section for the font trademark attribution notices.
Copyright:           Copyright 2003, 2009 B. Jackowski and J. M. Nowacki (on behalf of TeX users groups). This work is released under the GUST Font License --  see http://tug.org/fonts/licenses/GUST-FONT-LICENSE.txt for details.
Vendor ID:           UKWN
Permissions:         Unknown (12)

我有两个问题:

  1. 上面的otfinfo -i `kpsewhich lmroman10-regular.otf` 食用姿势哪里不对?
  2. otfinfo理应只能用于.otf(opentype)文件,那么对于.ttf,.woff.ttc字体文件是否有类似的命令获取这个Preferred family?

查看更多

关注者
0
被浏览
111
1 个回答
Sagittarius Rover
我要成为Typst糕手/(ㄒoㄒ)/~~

感谢switwu @u42963 老师 提供的介绍

image.png

其中 `<command>` 的语法为命令替换,仅在macOS以及*nix系统下可用,windowsPowershell不支持该语法,但git bash支持。

image.png

感谢Eureka老师的补充,powershell$(<command>)syntax有效:

otfinfo -i $(kpsewhich lmroman10-regular.otf)
Family:              LM Roman 10
Subfamily:           Regular
Full name:           LMRoman10-Regular
PostScript name:     LMRoman10-Regular
Preferred family:    Latin Modern Roman
Preferred subfamily: 10 Regular
Mac font menu name:  LM Roman 10 Regular
Version:             Version 2.004;PS 2.004;hotconv 1.0.49;makeotf.lib2.0.14853
Unique ID:           2.004;UKWN;LMRoman10-Regular
Trademark:           Please refer to the Copyright section for the font trademark attribution notices.
Copyright:           Copyright 2003, 2009 B. Jackowski and J. M. Nowacki (on behalf of TeX users groups). This work is released under the GUST Font License --  see http://tug.org/fonts/licenses/GUST-FONT-LICENSE.txt for details.
Vendor ID:           UKWN
Permissions:         Unknown (12)

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览