我使用以下方法制作了自定义图标字体Fontself 制作者,在拉丁字符的插槽中只包含几个图标。对于这个 MWE,我制作了一个字体鸭脸(从我的服务器下载) 仅包含一个空格字符和D
一个鸭子字母*。
% !TeX program = xelatex
\documentclass{scrartcl}
\usepackage{fontspec}
\newfontfamily\iconfont{Duck Face}
\begin{document}
\Huge
D
\par
\iconfont
D
\par
\end{document}
然而编译失败
Error 11 (driver return code) generating output;
file bfs-test.pdf may not be valid.
SyncTeX written on bfs-test.synctex.gz.
Transcript written on bfs-test.log.
但 LOG 中没有进一步的(可理解的)错误消息。自定义字体有什么问题?或者 XeTeX 只能加载包含一定范围字符的字体?
答案1
FontForge 的fontlint
报告:
A point in D is outside the font bounding box data.
ERROR 2 Self-intersecting glyph
ERROR 5 Missing points at extrema
ERROR 34 Bad 'CFF ' table
ERROR 80 Missing BlueValues entry in PostScript Private dictionary
FAIL DuckFace.otf
幸运的是,FontForge 可以修复和报告许多错误。我经常通过单击File
和来修复字体Generate Fonts
,从而以不同的名称制作(修复的)副本。在这种情况下,FontForge 建议使用名称DuckFaceRegular.otf
,并且新生成的字体可与 xetex 和 luatex 一起使用:
\documentclass{scrartcl}
\usepackage{fontspec}
\newfontface\iconfont{DuckFaceRegular.otf}
\begin{document}
\Huge
D
\iconfont
D
\end{document}
奇怪的是,fontlint
新生成的字体报告了大多数相同的错误和一些新错误,但由于我不明白的原因,它们对于文件编译不再是致命的.tex
:
The advance width of space (290) does not match the font's advanceWidthMax (579) and this is a fixed pitch font
A point in D is outside the font bounding box data.
The advance width of uni00A0 (290) does not match the font's advanceWidthMax (579) and this is a fixed pitch font
ERROR 2 Self-intersecting glyph
ERROR 5 Missing points at extrema
ERROR 34 Bad 'CFF ' table
FAIL DuckFaceRegular.otf
答案2
xelatex --no-pdf file
运行没有问题,但是当使用
xdvipdfmx -vvv
转换生成的 xdv 文件时,您会看到分段错误和如下所示的日志,该日志在放弃之前会给出有关字体文件中错误的几个警告:
<FONTMAP:/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map><FONTMAP:/usr/local/texlive/2018/texmf-var/fonts/map/dvipdfmx/updmap/kanjix.map><FONTMAP:/usr/local/texlive/2018/texmf-dist/fonts/map/dvipdfmx/ckx.map>aa739 -> aa739.pdf
DVI File Info
Unit: 25400000 / 473628672
Magnification: 1000
Media Height: 42967693
Media Width: 28548252
Stack Depth: 5
Page count: 1
DVI Comment: XeTeX output 2018.07.05:1902
DVI file font info
TeX Font: ./DuckFace.otf loaded at ID= 29, size=24.79pt (scaled 248.8%)
TeX Font: /usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman17-regular.otf loaded at ID= 28, size=24.79pt (scaled 248.8%)
TeX Font: /usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf loaded at ID= 14, size=10.91pt (scaled 109.5%)
<AGL:texglyphlist.txt><AGL:pdfglyphlist.txt><AGL:glyphlist.txt>[1</usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/[email protected]<NATIVE-FONTMAP:/usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman17-regular.otf/0/H/65536/0/0>
fontmap: /usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman17-regular.otf/0/H/65536/0/0 -> /usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman17-regular.otf(Identity-H)
pdf_font>> Input encoding "Identity-H" requires at least 2 bytes.
pdf_font>> The -m <00> option will be assumed for "/usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman17-regular.otf".
(CID:LMRoman17-Regular)
pdf_font>> Type0 font "/usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman17-regular.otf" cmap_id=<Identity-H,0> opened at font_id=</usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman17-regular.otf/0/H/65536/0/0,0>.
><./[email protected]<NATIVE-FONTMAP:./DuckFace.otf/0/H/65536/0/0>
fontmap: ./DuckFace.otf/0/H/65536/0/0 -> ./DuckFace.otf(Identity-H)
pdf_font>> Input encoding "Identity-H" requires at least 2 bytes.
pdf_font>> The -m <00> option will be assumed for "./DuckFace.otf".
(CID:DuckFaceRegular)
pdf_font>> Type0 font "./DuckFace.otf" cmap_id=<Identity-H,0> opened at font_id=<./DuckFace.otf/0/H/65536/0/0,1>.
></usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/[email protected]<NATIVE-FONTMAP:/usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf/0/H/65536/0/0>
fontmap: /usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf/0/H/65536/0/0 -> /usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf(Identity-H)
pdf_font>> Input encoding "Identity-H" requires at least 2 bytes.
pdf_font>> The -m <00> option will be assumed for "/usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf".
(CID:LMRoman10-Regular)
pdf_font>> Type0 font "/usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf" cmap_id=<Identity-H,0> opened at font_id=</usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf/0/H/65536/0/0,2>.
>]
otf_cmap>> Creating ToUnicode CMap for "/usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman17-regular.otf"...
otf_cmap>> Creating ToUnicode CMap for "./DuckFace.otf"...
otf_cmap>> Creating ToUnicode CMap for "/usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf"...
(CID:/usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman17-regular.otf[NRPACS+LMRoman17-Regular][CIDFontType0][2 glyphs][578 bytes])(CID:./DuckFace.otf[ARUFOD+DuckFaceRegular][CIDFontType0]