Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special rectangle softpath token are not closed when offset #15

Closed
Qrrbrbirlbel opened this issue Jun 17, 2023 · 1 comment
Closed

Special rectangle softpath token are not closed when offset #15

Qrrbrbirlbel opened this issue Jun 17, 2023 · 1 comment

Comments

@Qrrbrbirlbel
Copy link
Contributor

It appears that the special rectangle softpath tokens don't get offset correctly since they're not closed anymore.

The macros \pgfpathrectangle and \pgfpathrectanglecorners don't appear to be used by TikZ but the rectangle shapes' definitions use it. (Amongst others, they're used by patterns or plotmarks for example but I don't think they're going to be nfold-ed soon.)

Compiling this document:

\documentclass[tikz]{standalone}
\usetikzlibrary{nfold}
\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (1,1) [save path=\PATH]; \show\PATH
\draw[red]\pgfextra\pgfoffsetpath\PATH{3mm}\endpgfextra;
\end{tikzpicture}
\begin{tikzpicture}
\node[draw, minimum size=1cm, outer sep=+0pt, anchor=south west][save path=\PATH]{};
\show\PATH
\draw[red]\pgfextra\pgfoffsetpath\PATH{3mm}\endpgfextra;
\end{tikzpicture}

\begin{tikzpicture}
\pgfpathrectangle{\pgfpointorigin}{\pgfpointxy{1}{1}}
\pgfgetpath\PATH\show\PATH
\pgfusepath{stroke}
\color{red}\pgfoffsetpath\PATH{3mm}\pgfusepath{stroke}
\end{tikzpicture}
\begin{tikzpicture}
\pgfpathrectanglecorners{\pgfpointorigin}{\pgfpointxy{1}{1}}
\pgfgetpath\PATH\show\PATH
\pgfusepath{stroke}
\color{red}\pgfoffsetpath\PATH{3mm}\pgfusepath{stroke}
\end{tikzpicture}
\end{document}

will give us these four softpaths.


Normal rectangle path operation:

\pgfsyssoftpath@movetotoken {0.0pt}{0.0pt}
\pgfsyssoftpath@movetotoken {0.0pt}{0.0pt}
\pgfsyssoftpath@linetotoken {0.0pt}{28.45274pt}
\pgfsyssoftpath@linetotoken {28.45274pt}{28.45274pt}
\pgfsyssoftpath@linetotoken {28.45274pt}{0.0pt}
\pgfsyssoftpath@closepathtoken {0.0pt}{0.0pt}
\pgfsyssoftpath@movetotoken {28.45274pt}{28.45274pt}.

rectangle node shape (uses \pgfpathrectanglecorners)

\pgfsyssoftpath@rectcornertoken {0.0pt}{0.0pt}
\pgfsyssoftpath@rectsizetoken {28.45273pt}{28.45273pt}.

PGF: \pgfpathrectangle (lower left corner + diagonal vector)

\pgfsyssoftpath@rectcornertoken {0.0pt}{0.0pt}
\pgfsyssoftpath@rectsizetoken {28.45274pt}{28.45274pt}.

PGF: \pgfpathrectanglecorners (lower left corner + upper right corner)

pgfsyssoftpath@rectcornertoken {0.0pt}{0.0pt}
\pgfsyssoftpath@rectsizetoken {28.45274pt}{28.45274pt}.

where all but the first render as
nfold-rect-test-1

@jonschz
Copy link
Owner

jonschz commented Jun 21, 2023

Thanks for reporting! I forgot about pgf rectangles in #11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants