我已经询问的“定制信件”有问题二 问题以下 MWE 说明了这个问题:
\documentclass[border=4]{standalone}
\usepackage{accsupp,xcolor,fontspec,tikz}
\usetikzlibrary{calc,fadings}
\setmainfont{FreeSerif}
\pgfkeys{/SS/xX/thickness/.initial=0.125ex,/SS/xX/thickness/.value required}
\pgfkeys{/SS/xX/shift/.initial={(0ex,0ex)},/SS/xX/shift/.value required}
\pgfkeys{/SS/xX/size/.initial=0.25ex,/SS/xX/size/.value required}
\newcommand*\nulx[1][]{\BeginAccSupp{method=escape,unicode,ActualText={x⃘}}%
\begin{tikzpicture}[outer sep=auto]\pgfqkeys{/SS/xX}{#1}
\begin{tikzfadingfrompicture}[name=x circle fading,outer sep=auto]
\node[inner sep=0pt,outer sep=0pt,white,fill=white] (letter) {x};
\draw[line width=\pgfkeysvalueof{/SS/xX/thickness},white,fill=black] (0,0) circle (\pgfkeysvalueof{/SS/xX/size});
\end{tikzfadingfrompicture}
\begin{scope}[outer sep=auto]
\node[inner sep=0pt,outer sep=0pt,scope fading=x circle fading,fit fading=false,fading transform={shift=\pgfkeysvalueof{/SS/xX/shift}}] (letter) {x};
\draw[line width=\pgfkeysvalueof{/SS/xX/thickness},.] let \p{shift} = \pgfkeysvalueof{/SS/xX/shift} in ($ (letter.center) + (\x{shift},\y{shift}) $) circle (\pgfkeysvalueof{/SS/xX/size});
\end{scope}
\end{tikzpicture}%
\EndAccSupp{}}
\begin{document}
\textit{x \nulx}
\end{document}
如您所见,“自定义字母”的末端被“切断”,这看起来很糟糕,而且通常不受欢迎。我怎样才能让 TikZ 识别字母的整个范围,而不仅仅是中间部分?
答案1
inner sep
用inner xsep
和替换inner ysep
,保留和 并根据自己的喜好inner ysep=0pt
提高。inner xsep