Debian Codegraph @

texmf-dist/doc/latex/spotxcolor/test-pdfmanagement.tex

raw
1 %#!pdflatex --synctex=1 test-pdfmanagement
2 % =====================================================================
3 % test-pdfmanagement.tex — Issue #2 reproduction & compatibility test
4 % =====================================================================
5 % This file tests spotxcolor with pdfmanagement active.
6 %
7 % pdfmanagement (part of l3backend/l3pdf) takes over PDF resource
8 % management. Direct \pdfpageresources access (or \special{pdf:put})
9 % causes conflicts when pdfmanagement is active.
10 %
11 % v1.5 of spotxcolor should detect pdfmanagement and switch to the
12 % \pdfmanagement_add:nnn API automatically.
13 %
14 % Expected behavior:
15 % - Compiles without error on pdflatex and lualatex
16 % - Spot colors render correctly in text and TikZ
17 % - No "pdfmanagement is active" warnings from l3backend
18 % - PDF structure contains proper /ColorSpace entries
19 % =====================================================================
20
21 \DocumentMetadata{} % Activates pdfmanagement (l3pdf)
22
23 \documentclass{article}\listfiles\pagestyle{empty}
24
25 \usepackage[table]{xcolor}
26 \usepackage{tikz}
27 \usetikzlibrary{patterns.meta}
28 \usepackage{tcolorbox}
29 \tcbuselibrary{skins}
30
31 \usepackage{spotxcolor}
32 \definespotcolor{DIC161s}{DIC 161s*}{0, 0.64, 1, 0} % Vermilion
33 \definespotcolor{DIC256s}{DIC 256s*}{0.9, 0, 0.4, 0} % Green
34 \definespotcolor{DIC200s}{DIC 200s*}{0.5, 0.8, 0, 0} % Purple
35
36 \newcommand\onelineskip{\par\vspace{\baselineskip}\par}
37
38 \begin{document}
39
40 \sffamily\bfseries
41
42 \section{pdfmanagement Active --- Basic Tests}
43
44 \subsection*{Text Color}
45
46 \textcolor{DIC161s}{DIC 161s (Vermilion) --- 100\%}\par
47 \textcolor{DIC256s}{DIC 256s (Green) --- 100\%}\par
48 \textcolor{DIC200s}{DIC 200s (Purple) --- 100\%}
49
50 \onelineskip
51
52 \textcolor{DIC161s!50}{DIC 161s --- 50\%}\par
53 \textcolor{DIC256s!50}{DIC 256s --- 50\%}\par
54 \textcolor{DIC200s!50}{DIC 200s --- 50\%}
55
56 \subsection*{Page Color}
57
58 \clearpage
59 \pagecolor{DIC161s!20}
60
61 This page has a 20\% DIC 161s background (via pdfmanagement pathway).
62
63 \clearpage
64 \nopagecolor
65
66 \section{pdfmanagement Active --- TikZ Tests}
67
68 \subsection*{Simple Shapes (Three Colors)}
69
70 \begin{tikzpicture}
71 \fill[DIC161s] (0,0) circle (1.2);
72 \fill[DIC256s!50] (3,0) circle (1.2);
73 \draw[DIC200s, ultra thick, fill=DIC200s!15, rounded corners]
74 (5.5,-1.2) rectangle (8.5,1.2);
75 \node[DIC200s] at (7,0) {\textsf{200s}};
76 \end{tikzpicture}
77
78 \onelineskip
79
80 \subsection*{Pattern Fills (Three Colors)}
81
82 \begin{tikzpicture}
83 \draw[DIC161s, ultra thick,
84 pattern={Lines[angle=45, distance=6pt, line width=1.5pt]},
85 pattern color=DIC161s!60]
86 (0,0) rectangle (3, 2)
87 node[pos=0.5, fill=white, inner sep=2pt, font=\sffamily\small, text=DIC161s] {161s};
88
89 \draw[DIC256s, ultra thick,
90 pattern={Lines[angle=-45, distance=6pt, line width=1.5pt]},
91 pattern color=DIC256s!60]
92 (4,0) rectangle (7, 2)
93 node[pos=0.5, fill=white, inner sep=2pt, font=\sffamily\small, text=DIC256s] {256s};
94
95 \draw[DIC200s, ultra thick,
96 pattern={Dots[distance=3mm, radius=1mm]},
97 pattern color=DIC200s!50]
98 (8,0) rectangle (11, 2)
99 node[pos=0.5, fill=white, inner sep=2pt, font=\sffamily\small, text=DIC200s] {200s};
100 \end{tikzpicture}
101
102 \onelineskip
103
104 \subsection*{Multiply Blend Mode}
105
106 \begin{tikzpicture}
107 \fill[gray!10] (-1.5,-2) rectangle (4.5,3);
108 \begin{scope}[blend mode=multiply]
109 \fill[DIC161s] (90:1) circle (1.3);
110 \fill[DIC256s] (210:1) circle (1.3);
111 \fill[DIC200s] (330:1) circle (1.3);
112 \end{scope}
113 \node[font=\sffamily\small] at (1.5, 2.8) {Multiply blend (pdfmanagement active)};
114 \end{tikzpicture}
115
116 \section{pdfmanagement Active --- tcolorbox}
117
118 \begin{tcolorbox}[
119 enhanced,
120 colframe=DIC256s,
121 colback=DIC256s!5,
122 coltitle=white,
123 colbacktitle=DIC256s!80,
124 fonttitle=\sffamily\bfseries\Large,
125 title={pdfmanagement + spotxcolor},
126 drop fuzzy shadow=DIC256s!30
127 ]
128 If this box renders correctly with green frame, title, and shadow,
129 then \textsf{spotxcolor} is working with pdfmanagement active.
130
131 \onelineskip
132
133 \textcolor{DIC161s}{\textbf{Vermilion}},
134 \textcolor{DIC256s}{\textbf{Green}},
135 \textcolor{DIC200s}{\textbf{Purple}} ---
136 all three spot colors in one box.
137 \end{tcolorbox}
138
139 \section{pdfmanagement Active --- l3color Interface}
140
141 \begingroup
142 \ExplSyntaxOn
143 \color_select:n{DIC161s}
144 This~text~uses~\texttt{\string\color_select:n\{DIC161s\}}~(l3color~API).
145 \ExplSyntaxOff
146 \endgroup
147
148 \onelineskip
149
150 \begingroup
151 \ExplSyntaxOn
152 \color_select:n{DIC256s!50}
153 This~text~uses~\texttt{\string\color_select:n\{DIC256s!50\}}~at~50\%~tint.
154 \ExplSyntaxOff
155 \endgroup
156
157 \end{document}