グリフが印刷されない

グリフが印刷されない

TeX ソースから見栄えの良い PDF ドキュメントを作成したいと考えています。TeX ファイルは主に ASCII テキストで、非 ASCII シンボル (スキーム内の矢印、リスト項目を示すカスタム箇条書き、クレジット セクションの貢献者名の象形文字など) はほとんどありません。

TeX ソースは、Sphinx によって最初のソースから構築されます。

非 ASCII 記号は、デフォルトでドキュメント全体で使用されるフォントにそれらのグリフがないため、出力 PDF には印刷されません。

そこで、TeX Live インストール ディレクトリをスキャンして .pfb、.otf、.ttf ファイルを探し、見つかったフォントごとに次のような TeX ドキュメントを作成するシェル スクリプトを作成しました。

\documentclass{article}
\usepackage[english]{babel}
\usepackage{fontspec}
\usepackage{multido}

\font\testedfont="[/usr/share/texlive/texmf-dist/fonts/type1/wadalab/dgj/dgjkj.pfb]"

\font\basictextfont="cmr10"

\title{Find glyph for Unicode 80A5 in dgjkj.pfb}
\begin{document}

\newcounter{glyphslotnum}
\newcommand\findglyphslotnum{}

\newcounter{totalglyphnum}
\newcommand\findtotalglyphnum{}

Test glyphs

{\basictextfont{Font filename: dgjkj.pfb}}

\testedfont
\renewcommand\findglyphslotnum{\the\XeTeXcharglyph"80A5}
\setcounter{glyphslotnum}{\findglyphslotnum}
\renewcommand\findtotalglyphnum{\the\XeTeXcountglyphs\testedfont}
\setcounter{totalglyphnum}{\findtotalglyphnum}

%\multido{\i=0+1}{\value{totalglyphnum}\relax}{
%{\basictextfont\i:\,}{\testedfont\XeTeXglyph\i}
%}

\basictextfont
dgjkj.pfb: total \number\value{totalglyphnum} glyphs

\ifnum\value{glyphslotnum}>0{\message{Glyph for 80A5 exists in dgjkj.pfb (slot \number\value{glyphslotnum})}Glyph for Unicode 80A5 exists in dgjkj.pfb at slot \number\value{glyphslotnum}.

It looks like [{\testedfont\XeTeXglyph\value{glyphslotnum}}] (by $\backslash$XeTeXglyph) 
or [{\testedfont{\char"80A5}}] (by $\backslash$char) 
or [{\testedfont{\symbol{"80A5}}}] (by $\backslash$symbol)
}\fi

\end{document}

次のような出力が得られます(ここにコピーしてください:dgjkj.pfb_U80A5.jpg): ここに画像の説明を入力してください

multido loop のコメントを解除すると、フォント内のすべてのグリフのリストが表示されます。

必要なすべての Unicode シンボルのグリフを含むフォントを見つけましたが、シンボル U279C (「太い丸い先端の右向き矢印」) で問題が発生しています。これはフォント ファイル fonts/type1/urw/zapfding/uzdr.pfb で見つかりました (コンパイル時に「279C のグリフは uzdr.pfb (スロット 168) に存在します」というメッセージが出力されます) が、PDF のビルドがエラーで失敗します。完全な出力は次のとおりです。

This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2018) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./find_glyph_pfb_uzdr.tex
LaTeX2e <2017-04-15>
Babel <3.17> 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/size10.clo))
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
(/usr/share/texlive/texmf-dist/tex/generic/babel/switch.def)
(/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/switch.def)
(/usr/share/texlive/texmf-dist/tex/generic/babel/xebabel.def
(/usr/share/texlive/texmf-dist/tex/generic/babel/txtbabel.def)))))
(/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/base/tuenc.def))
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/share/texlive/texmf-dist/tex/latex/multido/multido.sty
(/usr/share/texlive/texmf-dist/tex/generic/multido/multido.tex
 v1.42, 2010/05/14 <tvz>))
No file find_glyph_pfb_uzdr.aux.
Glyph for 279C exists in uzdr.pfb (slot 168) [1] (./find_glyph_pfb_uzdr.aux)
xdvipdfmx:fatal: pdf_ref_obj(): passed invalid object.

Output file removed.
 )
Error 256 (driver return code) generating output;
file find_glyph_pfb_uzdr.pdf may not be valid.
Transcript written on find_glyph_pfb_uzdr.log.

完全なログはここにあります:ログファイル

それで、質問は、そのグリフを印刷するにはどうすればいいかということです。

更新: 失敗した TeX ドキュメント:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{fontspec}
\usepackage{multido}

\font\testedfont="[/usr/share/texlive/texmf-dist/fonts/type1/urw/zapfding/uzdr.pfb]"

\font\basictextfont="cmr10"

\title{Find glyph for Unicode 279C in uzdr.pfb}
\begin{document}

\newcounter{glyphslotnum}
\newcommand\findglyphslotnum{}

\newcounter{totalglyphnum}
\newcommand\findtotalglyphnum{}

Test glyphs

{\basictextfont{Font filename: uzdr.pfb}}

\testedfont
\renewcommand\findglyphslotnum{\the\XeTeXcharglyph"279C}
\setcounter{glyphslotnum}{\findglyphslotnum}
\renewcommand\findtotalglyphnum{\the\XeTeXcountglyphs\testedfont}
\setcounter{totalglyphnum}{\findtotalglyphnum}

%\multido{\i=0+1}{\value{totalglyphnum}\relax}{
%{\basictextfont\i:\,}{\testedfont\XeTeXglyph\i}
%}

\basictextfont
uzdr.pfb: total \number\value{totalglyphnum} glyphs

\ifnum\value{glyphslotnum}>0{\message{Glyph for 279C exists in uzdr.pfb (slot \number\value{glyphslotnum})}Glyph for Unicode 279C exists in uzdr.pfb at slot \number\value{glyphslotnum}.

It looks like [{\testedfont\XeTeXglyph\value{glyphslotnum}}] (by $\backslash$XeTeXglyph) 
or [{\testedfont{\char"279C}}] (by $\backslash$char) 
or [{\testedfont{\symbol{"279C}}}] (by $\backslash$symbol)
}\fi

\end{document}

関連情報