如何防止模糊阴影节点在nullfont中写入神秘数字?

如何防止模糊阴影节点在nullfont中写入神秘数字?

我隔离了一个奇怪的字体相关问题,它来自一个blur shadowtikz 节点,该节点似乎在 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}

我开了一个问题https://github.com/pgf-tikz/pgf/issues/1088

相关内容