Glifo não impresso

Glifo não impresso

Quero criar um documento PDF bonito a partir da fonte TeX. O arquivo TeX é principalmente texto ASCII com poucos símbolos não-ASCII (setas em esquemas, marcadores personalizados marcando itens de lista, hieróglifos no nome do contribuidor na seção de créditos, etc.).

A fonte TeX é, por sua vez, construída pela Sphinx a partir das primeiras fontes.

Os símbolos não ASCII não são impressos no PDF de saída porque não há glifos para eles na fonte usada em todo o documento por padrão.

Então, eu criei um script de shell que verifica o diretório de instalação do TeX Live em busca de arquivos .pfb, .otf e .ttf e para cada fonte encontrada ele cria um documento TeX como este:

\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}

Ele fornece uma saída como esta (copie aqui:dgjkj.pfb_U80A5.jpg): insira a descrição da imagem aqui

Remover o comentário do loop multido fornecerá a lista de todos os glifos na fonte.

Encontrei fontes com glifos para todos os símbolos Unicode necessários, mas tenho problemas com o símbolo U279C ("Seta para a direita com ponta arredondada e pesada"). Foi encontrado no arquivo de fonte fonts/type1/urw/zapfding/uzdr.pfb (a mensagem "Glifo para 279C existe em uzdr.pfb (slot 168)" é impressa durante a compilação), mas a construção do PDF falha com erro, a saída completa é o seguinte:

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.

O log completo pode ser encontrado aqui:find_glyph_pfb_uzdr.log.

Então, a questão é: o que devo fazer para imprimir esse glifo?

Upd: o documento TeX com falha:

\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}

informação relacionada