texlive 2016 + xelatex:缺少字符,但 fontforge 显示它存在

texlive 2016 + xelatex:缺少字符,但 fontforge 显示它存在

编辑:我误读了 fontforge 的输出。xelatex 是正确的。字形不存在。

我有以下示例文本:

\documentclass[12pt]{article}

\usepackage{fontspec}
\usepackage[english]{babel}

\setmainfont{Times_New_Roman.ttf}[
                Path = {/path/to/local/font/files},
        BoldFont = Times_New_Roman_Bold.ttf,
        ItalicFont = Times_New_Roman_Italic.ttf,
        BoldItalicFont = Times_New_Roman_Bold_Italic.ttf
]

\begin{document}

\symbol{9745}

\end{document}

我确实知道我使用的字体包含 U+2611(十进制 9745)的字形,因为我是在 fontforge 中打开它的。

现在,当我使用 xelatex 处理它时,生成的 PDF 中会出现一个缺少的字符占位符,同时日志中出现以下错误:

Missing character: There is no ☑ in font [/path/to/local/font/files/Times_New_Roman]/OT:mapping=tex-text;!

我不知道是否有我错过的神奇选项,但我认为这应该是有效的,而我所做的所有谷歌搜索都让人们认为字符存在于他们的字体中,但实际上并不存在。

我尝试将字符直接粘贴到 tex 中,以及使用上例中看到的 \symbol。

我可以在日志中看到它已成功加载字体。以下是日志中的内容,以防万一它包含有用的信息:

.................................................
. fontspec info: "no-scripts"
.
. Font Times_New_Roman.ttf does not contain any OpenType `Script' information.
.................................................
\g__fontspec_family_Times_New_Roman.ttf_int=\count121
.................................................
. fontspec info: "defining-font"
.
. Font family 'Times_New_Roman.ttf(0)' created for font 'Times_New_Roman.ttf'
. with options [Ligatures=TeX,Path =
. {/path/to/local/font/files/},BoldFont =
. Times_New_Roman_Bold.ttf,ItalicFont =
. Times_New_Roman_Italic.ttf,BoldItalicFont =
. Times_New_Roman_Bold_Italic.ttf].
.
. This font family consists of the following NFSS series/shapes:
. - 'normal' (m/n) with NFSS spec.:
. <->"[/path/to/local/font/filesTimes_New_Roman]/OT:mapping=tex-text;"
. - 'small caps'  (m/sc) with NFSS spec.: - 'bold' (bx/n) with NFSS spec.:
. <->"[/path/to/local/font/files/Times_New_Roman_Bold]/OT:mapping=tex-text;"
. - 'bold small caps'  (bx/sc) with NFSS spec.: - 'italic' (m/it) with NFSS
. spec.:
. <->"[/path/to/local/font/files/Times_New_Roman_Italic]/OT:mapping=tex-text;"
. - 'italic small caps'  (m/itsc) with NFSS spec.: - 'bold italic' (bx/it)
. with NFSS spec.:
. <->"[/path/to/local/font/files/Times_New_Roman_Bold_Italic]/OT:mapping=tex-text;"
. - 'bold italic small caps'  (bx/itsc) with NFSS spec.:
.................................................

如能得到任何帮助我将非常感激 :)

编辑:我添加了 xelatex -output-driver="xdvipdfmx -vv" test2.tex 的输出

This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016/Debian) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./test2.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def))
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1lmr.fd))
(/usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty
(/usr/share/texmf/tex/latex/tipa/t3enc.def
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1lmss.fd))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/xetex.def))))
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
(/usr/share/texlive/texmf-dist/tex/generic/babel-english/english.ldf
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.def
(/usr/share/texlive/texmf-dist/tex/generic/babel/xebabel.def)))) (./test2.aux)
(/usr/share/texmf/tex/latex/tipa/t3cmr.fd) [1] (./test2.aux) )
<FONTMAP:/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map><FONTMAP:/var/lib/texmf/fonts/map/dvipdfmx/updmap/kanjix.map><FONTMAP:/usr/share/texlive/texmf-dist/fonts/map/dvipdfmx/ckx.map>No dvi filename specified, reading standard input.
stdin -> test2.pdf
DVI Comment:  XeTeX output 2016.12.13:2311
<AGL:texglyphlist.txt><AGL:pdfglyphlist.txt><AGL:glyphlist.txt>[1</home/james/git/seismicat_www/application/../data/templates/[email protected]<NATIVE-FONTMAP:/home/james/git/seismicat_www/application/../data/templates/Times_New_Roman.ttf/0/H/65536/0/0>
fontmap: /home/james/git/seismicat_www/application/../data/templates/Times_New_Roman.ttf/0/H/65536/0/0 -> /home/james/git/seismicat_www/application/../data/templates/Times_New_Roman.ttf(Identity-H)

pdf_font>> Input encoding "Identity-H" requires at least 2 bytes.
pdf_font>> The -m <00> option will be assumed for "/home/james/git/seismicat_www/application/../data/templates/Times_New_Roman.ttf".
(CID:TimesNewRomanPSMT)
pdf_font>> Type0 font "/home/james/git/seismicat_www/application/../data/templates/Times_New_Roman.ttf" cmap_id=<Identity-H,0> opened at font_id=</home/james/git/seismicat_www/application/../data/templates/Times_New_Roman.ttf/0/H/65536/0/0,0>.
>]
otf_cmap>> Creating ToUnicode CMap for "/home/james/git/seismicat_www/application/../data/templates/Times_New_Roman.ttf"...
(CID:/home/james/git/seismicat_www/application/../data/templates/Times_New_Roman.ttf[SXNPZL+TimesNewRomanPSMT][CIDFontType2][2 glyphs (Max CID: 20)][15460 bytes])
Compression saved 7242 bytes
10249 bytes written
(see the transcript file for additional information)
Output written on test2.pdf (1 page).
Transcript written on test2.log.

答案1

您发布的图片

在此处输入图片描述

告诉我们字体在插槽 9745 处没有字形,您可以在此处看到一个红色十字。顶部只是一种用可能的视觉表示来标记插槽的方式。

您可以从另一种字体导入字形:

\newfontface{\mysymbols}{FreeSerif}
\newcommand{\ballotboxwithcheck}{{\mysymbols\symbol{9745}}}

相关内容