| 1 |
%% |
| 2 |
%% This is file `xespotcolor.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% xespotcolor.dtx (with options: `xespotcolor') |
| 8 |
%% |
| 9 |
%% (c) Copyright 2014-2021 Apostolos Syropoulos |
| 10 |
%% This program can be redistributed and/or modified under the |
| 11 |
%% terms of the LaTeX Project Public License Distributed from |
| 12 |
%% http://www.latex-project.org/lppl.txt; either |
| 13 |
%% version 1.3c of the License, or any later version. |
| 14 |
%% |
| 15 |
%% This work has the LPPL maintenance status `maintained'. |
| 16 |
%% |
| 17 |
%% Please report errors or suggestions for improvement to |
| 18 |
%% |
| 19 |
%% Apostolos Syropoulos ([email protected]) |
| 20 |
%% |
| 21 |
%% |
| 22 |
%% \CharacterTable |
| 23 |
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 24 |
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 25 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 26 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 27 |
%% Dollar \$ Percent \% Ampersand \& |
| 28 |
%% Acute accent \' Left paren \( Right paren \) |
| 29 |
%% Asterisk \* Plus \+ Comma \, |
| 30 |
%% Minus \- Point \. Solidus \/ |
| 31 |
%% Colon \: Semicolon \; Less than \< |
| 32 |
%% Equals \= Greater than \> Question mark \? |
| 33 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 34 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 35 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 36 |
%% Right brace \} Tilde \~} |
| 37 |
%% |
| 38 |
\ProvidesFile{xesporcolor.sty} |
| 39 |
[2021/03/01 v2.1 Package `xespotcolor.sty'] |
| 40 |
\NeedsTeXFormat{LaTeX2e} |
| 41 |
\ProvidesPackage{xespotcolor} |
| 42 |
[2021/03/01 v.2.1, Package for adding Spot Color support to LaTeX/XeLaTeX.] |
| 43 |
\RequirePackage{iftex} |
| 44 |
\@ifpackageloaded{xcolor}{\let\use@xcolor\relax}{} |
| 45 |
\DeclareOption{hks}{\let\use@hks\relax} |
| 46 |
\DeclareOption{pantone}{\let\use@pantone\relax} |
| 47 |
\DeclareOption{xcolor}{\let\use@xcolor\relax} |
| 48 |
\ProcessOptions |
| 49 |
\ifx\use@xcolor\undefined |
| 50 |
\ifxetex |
| 51 |
\@ifpackageloaded{graphics}{}{\RequirePackage[xetex]{graphics}} |
| 52 |
\@ifpackageloaded{color}{}\RequirePackage[xetex]{color} |
| 53 |
\else |
| 54 |
\@ifpackageloaded{graphics}{}{\RequirePackage[dvipdfmx]{graphics}} |
| 55 |
\@ifpackageloaded{color}{}\RequirePackage{color} |
| 56 |
\fi |
| 57 |
\else |
| 58 |
\ifxetex |
| 59 |
\@ifpackageloaded{graphics}{}{\RequirePackage[xetex]{graphics}} |
| 60 |
\@ifpackageloaded{xcolor}{}{\RequirePackage[xetex]{xcolor}} |
| 61 |
\else |
| 62 |
\@ifpackageloaded{graphics}{}{\RequirePackage[dvipdfmx]{graphics}} |
| 63 |
\@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}} |
| 64 |
\fi\fi |
| 65 |
\@ifpackageloaded{tikz}{\global\pgf@sys@pdf@colorspaces@existsfalse}{} |
| 66 |
\@ifpackageloaded{tcolorbox}{\global\pgf@sys@pdf@colorspaces@existsfalse}{} |
| 67 |
\def\NewSpotColorSpace#1{% |
| 68 |
\expandafter\newtoks\csname #1\endcsname% |
| 69 |
\csname #1\endcsname{}% |
| 70 |
} |
| 71 |
\catcode`\#=12% |
| 72 |
\def\SpotSpace{#20} |
| 73 |
\catcode`\#=6% |
| 74 |
\gdef\csgrab#1#2{#2\expandafter{\the#2 #1}}% |
| 75 |
\newcount\colorprofilecnt |
| 76 |
\newtoks\mycolorprofilename |
| 77 |
\def\AddSpotColor#1#2#3#4{% |
| 78 |
\mycolorprofilename={@mycolorprofile\the\colorprofilecnt}% |
| 79 |
\edef\mycolorprofile{\the\mycolorprofilename |
| 80 |
<</C0[0 0 0 0]/FunctionType 2/C1[#4]/Domain[0 1]/N 1>>}% |
| 81 |
\edef\mycolor{[/Separation/#3 /DeviceCMYK \the\mycolorprofilename]}% |
| 82 |
\edef\tempcs{/#2 \mycolor}% |
| 83 |
\expandafter\csgrab\expandafter{\tempcs}{\csname #1\endcsname}% |
| 84 |
\special{pdf:obj \mycolorprofile}% |
| 85 |
\special{pdf:obj @myowncolor\the\colorprofilecnt \mycolor}% |
| 86 |
\advance\colorprofilecnt by1% |
| 87 |
} |
| 88 |
\def\SetPageColorResource#1{% |
| 89 |
\AddToHook{shipout/background}{\put(1in,-1in){% |
| 90 |
\special{pdf:put @resources <</ColorSpace <<#1>>>>}}}% |
| 91 |
}% |
| 92 |
\def\SetPageColorSpace#1{% |
| 93 |
\expandafter\SetPageColorResource\expandafter{\the\csname #1\endcsname}% |
| 94 |
}% |
| 95 |
\def\SpotColor#1#2{% |
| 96 |
\special{pdf:literal /#1 cs /#1 CS #2 sc #2 SC}% |
| 97 |
\aftergroup\reset@color% |
| 98 |
}% |
| 99 |
\ifx\use@xcolor\undefined |
| 100 |
\def\color@spotcolor#1#2{\c@lor@@spotcolor#2\@@#1} |
| 101 |
\def\c@lor@@spotcolor#1,#2\@@#3{% |
| 102 |
\c@lor@arg{#2}% |
| 103 |
\edef#3{spot #1 #2}% |
| 104 |
} |
| 105 |
\else |
| 106 |
\XC@sdef\XC@mod@spotcolor{spotcolor} |
| 107 |
\def\@@xespotcolordef@xspc#1,#2\@@{spot #1 #2} |
| 108 |
\let\o@XC@definec@lor@xspc\XC@definec@lor |
| 109 |
\def\XC@definec@lor[#1]#2[#3]#4#5% |
| 110 |
{% |
| 111 |
\expandafter\ifx\csname XC@mod@#4\endcsname\XC@mod@spotcolor |
| 112 |
\expandafter\xdef\csname\string\color @#2\endcsname |
| 113 |
{\noexpand\xcolor@{}{\@@xespotcolordef@xspc#5\@@}{spotcolor}{#5}}% |
| 114 |
\else |
| 115 |
\o@XC@definec@lor@xspc[#1]{#2}[#3]{#4}{#5}% |
| 116 |
\fi |
| 117 |
}% |
| 118 |
\gdef\pgfsys@color@spotcolor@stroke#1#2{\special{pdf:literal /#1 CS #2 SC}} |
| 119 |
\gdef\pgfsys@color@spotcolor@fill#1#2{\special{pdf:literal /#1 cs #2 sc}} |
| 120 |
\gdef\pgfsys@color@spotcolor#1#2{\pgfsys@color@spotcolor@stroke{#1}{#2}% |
| 121 |
\pgfsys@color@spotcolor@fill{#1}{#2}} |
| 122 |
\fi |
| 123 |
\ifx\use@hks\undefined\else\input{spotcolorhks}\fi |
| 124 |
\ifx\use@pantone\undefined\else\input{spotcolorpantone}\fi |
| 125 |
\endinput |
| 126 |
%% |
| 127 |
%% End of file `xespotcolor.sty'. |