-
Notifications
You must be signed in to change notification settings - Fork 110
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
pattern=Lines[...] renders very differently depending on the PDF viewer #1180
Comments
I am not sure about the PGF's part in this but note that not all viewers fully implement the PDF spec. Or alternatively they implement different versions of PDF. On top of that, certain apps emphasize/test/QA of certain functions more than the other so this is a very typical problem in PDF ecosystem and not necessarily the innocent PDFTeX. There are many criticisms about PDF features that are prone to be misused by bad actors especially trying to be more interactive which I do agree partially. Hence some features are even not supported by certain apps. If you need portability, you must use Adobe. That is the only fully PDF compliant app by definition. |
Duplicate of #850 |
For the FireFox case, I think it's caused by the beneath Currently in pgf-tikz, patterns like Below is an example defining pattern \documentclass[margin=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns.meta}
\makeatletter
% a new pattern LinesX based on Lines but has bbox coordinates all non-negative
% - Lines creates `/Bbox [-a -b a b]` and drawing `-a 0 m a 0 l`
% - LinesX creates `/Bbox [0 0 2a ab]` and drawing `0 0 m 2a 0 l 0 2b m 2a ab l`
\pgfdeclarepattern{
name=LinesX,
parameters={
\pgfkeysvalueof{/pgf/pattern keys/distance},
\pgfkeysvalueof{/pgf/pattern keys/angle},
\pgfkeysvalueof{/pgf/pattern keys/xshift},
\pgfkeysvalueof{/pgf/pattern keys/yshift},
\pgfkeysvalueof{/pgf/pattern keys/line width},
},
bottom left={%
\pgfpointorigin
},
top right={%
\pgfpoint
{\pgfkeysvalueof{/pgf/pattern keys/distance}}%
{\pgfkeysvalueof{/pgf/pattern keys/distance}}},
tile size={%
\pgfpoint
{\pgfkeysvalueof{/pgf/pattern keys/distance}}%
{\pgfkeysvalueof{/pgf/pattern keys/distance}}},
tile transformation={%
\pgftransformshift{%
\pgfpoint
{\pgfkeysvalueof{/pgf/pattern keys/xshift}}%
{\pgfkeysvalueof{/pgf/pattern keys/yshift}}}%
\pgftransformrotate{\pgfkeysvalueof{/pgf/pattern keys/angle}}},
defaults={
distance/.initial=3pt,
angle/.initial=0,
xshift/.initial=0pt,
yshift/.initial=0pt,
line width/.initial=\the\pgflinewidth,
},
code={%
\pgfsetlinewidth{\pgfkeysvalueof{/pgf/pattern keys/line width}}%
% half line at the bottom (y=0pt), due to clipping
\pgfpathmoveto{\pgfpointorigin}%
\pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/pgf/pattern keys/distance}}{0pt}}%
% half line at the top (y=/pgf/pattern keys/distance)
\pgfpathmoveto{\pgfpoint{0pt}{\pgfkeysvalueof{/pgf/pattern keys/distance}}}%
\pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/pgf/pattern keys/distance}}{\pgfkeysvalueof{/pgf/pattern keys/distance}}}%
\pgfusepath{stroke}%
},
}
\makeatother
\begin{document}
\begin{tikzpicture}[pattern color=blue]
\draw[pattern={Lines}] (0,0) rectangle (1,1);
\draw[pattern={LinesX}] (1.2,0) rectangle +(1,1);
\end{tikzpicture}
\end{document} |
This should soon be rendered correctly in Firefox, as mozilla/pdf.js#16038 was fixed. |
Brief outline of the bug
When using
pattern=Lines[...]
to fill a node, I get significantly different results depending on the PDF viewer. Here are screenshots of renderings of the PDF from the MWE, compiled with pdfLaTeX, and annotated by the PDF viewer that rendered them:Firefox and Inkscape draw dashed lines:
In its preview window, Inkscape draws continuous lines:
Foxit-reader draw almost continuous lines with alignment problems:
Ghostscript fails to align the lines:
The award of worst rendering goes to LibreOffice draw:
Finally, xreader and evince draw what I was expecting:
I'm not sure this is a bug of PGF/TikZ, but considering the renderings diversity, there is at least a portability issue.
Minimal working example (MWE)
The text was updated successfully, but these errors were encountered: