![如何防止模糊阴影节点在nullfont中写入神秘数字?](https://linux22.com/image/443106/%E5%A6%82%E4%BD%95%E9%98%B2%E6%AD%A2%E6%A8%A1%E7%B3%8A%E9%98%B4%E5%BD%B1%E8%8A%82%E7%82%B9%E5%9C%A8nullfont%E4%B8%AD%E5%86%99%E5%85%A5%E7%A5%9E%E7%A7%98%E6%95%B0%E5%AD%97%EF%BC%9F.png)
我隔离了一个奇怪的字体相关问题,它来自一个blur shadow
tikz 节点,该节点似乎在 nullfont 中写入一些神秘计数器的值。神秘计数器从 17 开始,并随着每个blur shadow
节点递增;非blur shadow
节点似乎不会影响神秘计数器的值。我的日志文件中有一些值似乎等于 17,但是当我包含足够的blur shadow
节点以使神秘计数器达到 29 时,我的日志文件中没有29
任何内容,因此我没有任何关于发生了什么或如何避免它的理论。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
% I get the following warnings when I xelatex this document:
% Missing character: There is no 1 ("31) in font nullfont!
% Missing character: There is no 7 ("37) in font nullfont!
% Missing character: There is no 1 ("31) in font nullfont!
% Missing character: There is no 8 ("38) in font nullfont!
% Missing character: There is no 1 ("31) in font nullfont!
% Missing character: There is no 9 ("39) in font nullfont!
%
% Alternatively, if I uncomment the following line, I see a giant 17, 18, and 19 in the output.
% \font\nullfont=cmr24
\begin{document}
\tikz{\node[draw, fill=white, blur shadow] {A};} % Writes 17 [in nullfont]
\tikz{\node[draw, fill=white, blur shadow] {B};} % Writes 18 [in nullfont]
\tikz{\node[draw, fill=white, blur shadow] {C};} % Writes 19 [in nullfont]
\end{document}
答案1
这是 pgfsys-dvipdfmx.def 中的一个错误。他们混淆了顺序\endcsname + \expandafter
:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\makeatletter
\def\pgf@sys@pdf@install@mask#1{%
\pgfutil@addpdfresource@extgs{%
/pgfsmask\csname pgfsmaskxform@#1\endcsname\space <<
/SMask <<
/S /Luminosity
/G @pgfsmask\csname pgfsmaskxform@#1\endcsname
>> >>}%<<
%\expandafter\let\csname pgfsmask@#1\endcsname\expandafter\csname pgfsmaskxform@#1\endcsname%
\expandafter\let\csname pgfsmask@#1\expandafter\endcsname\csname pgfsmaskxform@#1\endcsname%
}
\makeatother
\begin{document}
\tikz{\node[draw, fill=white, blur shadow] {A};} % Writes 17 [in nullfont]
%
\tikz{\node[draw, fill=white, blur shadow] {B};} % Writes 18 [in nullfont]
%
\tikz{\node[draw, fill=white, blur shadow] {C};} % Writes 19 [in nullfont]
\end{document}