tikz 错误地渲染了 svg 路径

tikz 错误地渲染了 svg 路径

我有一条自相交路径,无法通过svg.path tikz库正确呈现。

我在代码中是否存在错误设置tikz

SVG 是在 Inkscape 中创建的。

以下 MWE 为方便起见写出了 SVG,并使用库tikz来渲染路径svg.path

它看起来应该是这样的(由 Chrome 呈现):

svg 输出

tikz呈现如下:

tikz 渲染

平均能量损失

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{svg.path}
\begin{filecontents*}[overwrite]{\jobname.svg}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   width="214.798pt"
   version="1.1"
   viewBox="0 0 214.798 40.4164"
   height="40.4164pt"
   id="svg1"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <path
     d="m 90.2532,20.89279 c 0,2.632 1.4,4.032 4.032,4.032 h 3.136 c 2.632,0 4.032,-1.4 4.032,-4.032 v -14.336 c 0,-2.632 -1.4,-4.032 -4.032,-4.032 h -3.136 c -2.632,0 -4.032,1.4 -4.032,4.032 z m 4.844,0.42 c -0.728,0 -1.12,-0.364 -1.12,-1.12 v -12.936 c 0,-0.728 0.392,-1.12 1.12,-1.12 h 1.624 c 0.728,0 1.12,0.392 1.12,1.12 v 12.936 c 0,0.756 -0.392,1.12 -1.12,1.12 z"
     id="path1"
     style="fill:#000000;stroke:none;" />
</svg>
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
  \fill svg {m 90.2532,20.89279 c 0,2.632 1.4,4.032 4.032,4.032 h 3.136 c
    2.632,0 4.032,-1.4 4.032,-4.032 v -14.336 c 0,-2.632 -1.4,-4.032
    -4.032,-4.032 h -3.136 c -2.632,0 -4.032,1.4 -4.032,4.032 z m 4.844,0.42 c
    -0.728,0 -1.12,-0.364 -1.12,-1.12 v -12.936 c 0,-0.728 0.392,-1.12
    1.12,-1.12 h 1.624 c 0.728,0 1.12,0.392 1.12,1.12 v 12.936 c 0,0.756
  -0.392,1.12 -1.12,1.12 z};
\end{tikzpicture}
\end{document}

相关内容