diff options
author | Karl Berry <karl@freefriends.org> | 2021-02-23 22:38:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-02-23 22:38:24 +0000 |
commit | 96be5ed7ba5ce4406ca538c4b0d18edeec9d7aab (patch) | |
tree | f903bef02645eac80be0107658487813b3ebc6a7 /Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty | |
parent | 7389bb9fb813a0f5e8654431dacfcb81d1f116e4 (diff) |
pdfmanagement-testphase (23feb21)
git-svn-id: svn://tug.org/texlive/trunk@57862 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty b/Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty new file mode 100644 index 00000000000..f1f2b6c81ba --- /dev/null +++ b/Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty @@ -0,0 +1,183 @@ +%% +%% This is file `pdfmanagement-firstaid.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% pdfmanagement-firstaid.dtx (with options: `package') +%% +%% Copyright (C) 2019-2021 The LaTeX Project +%% +%% It may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License (LPPL), either version 1.3c of +%% this license or (at your option) any later version. The latest +%% version of this license is in the file: +%% +%% https://www.latex-project.org/lppl.txt +%% +%% This file is part of the "LaTeX PDF management testphase bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% File: pdfmanagement-firstaid.dtx +\ProvidesExplPackage {pdfmanagement-firstaid} {2021-02-22} {0.95a} + {LaTeX PDF management testphase bundle / firstaid-patches} + +\clist_map_inline:nn {pgf,transparent,hyperxmp,pdflscape,xcolor,color} + { + \bool_new:c { g__pdfmanagement_firstaid_#1_bool } + \bool_gset_true:c { g__pdfmanagement_firstaid_#1_bool } + } +\clist_map_inline:Nn \g__pdfmanagement_firstaidoff_clist + { + \bool_if_exist:cT { g__pdfmanagement_firstaid_#1_bool } + { + \bool_gset_false:c { g__pdfmanagement_firstaid_#1_bool } + } + } +\msg_new:nnn { pdfmanagement } { firstaid } + { loading~pdfmanagement~firstaid~code~for~#1 } +\@ifundefined{color_set:nn}{ +\RequirePackage{l3color}}{} +\bool_if:NT \g__pdfmanagement_firstaid_color_bool + { + \declare@file@substitution{color.sty}{color-ltx.sty} + } +\@ifundefined{color_set:nn}{ +\RequirePackage{l3color}}{} +\bool_if:NT \g__pdfmanagement_firstaid_xcolor_bool + { + \AddToHook{package/after/xcolor} + {\RequirePackage{xcolor-patches-tmp-ltx}\XC@@names} + } + +\bool_if:NT \g__pdfmanagement_firstaid_pgf_bool + { + \msg_info:nnn{pdfmanagement }{firstaid}{pgf} + \AddToHook{file/after/pgfrcs.sty} + { + \cs_set_eq:NN + \__pdfmanagement_pgfori_pgfutil@setuppdfresources + \pgfutil@setuppdfresources + \def\pgfutil@setuppdfresources + { + \pdfmanagement_if_active:TF + { + \__pdfmanagement_pgf_sys_setuppdfresources_plain: + } + { + \__pdfmanagement_pgfori_pgfutil@setuppdfresources + } + } + } + } +\cs_new_protected:Npn \__pdfmanagement_pgf_sys_setuppdfresources_plain: + { + %objects are already created ... + \def\pgf@sys@pdf@possible@resources + { + /ColorSpace~\pdf_object_ref:n {Page/Resources/ColorSpace} + /Pattern ~\pdf_object_ref:n {Page/Resources/Pattern} + /ExtGState ~\pdf_object_ref:n {Page/Resources/ExtGState} + } + \let\pgf@sys@pdf@check@resources=\relax% + %not sure if needed, but perhaps the lists are used somewhere else ... + \let\pgf@sys@pgf@resource@list@extgs=\pgfutil@empty% + \let\pgf@sys@pgf@resource@list@patterns=\pgfutil@empty% + \let\pgf@sys@pgf@resource@list@colorspaces=\pgfutil@empty% + % the commands to add page resources + \def\pgf@sys@addpdfresource@extgs@plain##1 + { + \exp_after:wN %for transparent which passes a command + \__pdfmanagement_patch_pgfextgs:w ##1\q_stop + } + \def\pgf@sys@addpdfresource@patterns@plain##1 + { + \__pdfmanagement_patch_pgfpatterns:w ##1\q_stop + } + \def\pgf@sys@addpdfresource@colorspaces@plain##1 + { + \__pdfmanagement_patch_pgfcolorspaces:w ##1\q_stop + } + } + +\cs_new:Npn \__pdfmanagement_split_dict_entry_aux:NNw #1 #2 /#3~#4\q_stop + { + \tl_set:Nn #1 {#3} + \tl_set:Nn #2 {#4} + } + +\cs_new:Npn \__pdfmanagement_patch_pgfextgs:w #1/#2<<#3>>#4\q_stop + { + \exp_args:Nne + \__pdf_backend_PageResources_gput:nnn + {ExtGState}{\tl_trim_spaces:n{#2}}{<<#3>>} + } +\cs_new:Npn \__pdfmanagement_patch_pgfpatterns:w #1/#2\space#3\q_stop + { + \exp_args:Nnxx + \__pdf_backend_PageResources_gput:nnn + {Pattern}{\tl_trim_spaces:n{#2}}{#3} + } +\cs_new:Npn \__pdfmanagement_patch_pgfcolorspaces:w #1/#2[#3]#4\q_stop + { + \exp_args:Nne + \__pdf_backend_PageResources_gput:nnn + {ColorSpace}{\tl_trim_spaces:n{#2}}{[#3]} + } + +\bool_if:NT \g__pdfmanagement_firstaid_transparent_bool + { + \declare@file@substitution{transparent.sty}{transparent-ltx.sty} + } +\bool_if:NT \g__pdfmanagement_firstaid_pdflscape_bool + { + \declare@file@substitution{pdflscape.sty}{pdflscape-ltx.sty} + } +\bool_if:NT \g__pdfmanagement_firstaid_hyperxmp_bool + { + \AddToHook + {file/after/hyperxmp.sty} + {\RequirePackage{hyperxmp-patches-tmp-ltx}} + } +\hook_gput_code:nnn {begindocument} {pdf} + { + \tl_if_exist:NT \spc@op + { + \def\spc@Pageresources#1{} + } + + } + +\hook_gput_code:nnn {begindocument/end} {pdf} + { + \tl_if_exist:NT \spc@op + { + \__pdf_backend_object_new:nn {__spc_extgstate_op_false}{dict} + \__pdf_backend_object_write:nn + {__spc_extgstate_op_false} + {/Type /ExtGState~/op~false~/OP~false} + \pdfmanagement_add:nnn + {Page/Resources/ExtGState} + {SPCko} + {\__pdf_backend_object_ref:n {__spc_extgstate_op_false}} + \__pdf_backend_object_new:nn {__spc_extgstate_op_true0}{dict} + \__pdf_backend_object_write:nn + {__spc_extgstate_op_true0} + {/Type /ExtGState~/op~true~/OP~true~/OPM~0}% + \pdfmanagement_add:nnn + {Page/Resources/ExtGState} + {SPCmz} + {\__pdf_backend_object_ref:n {__spc_extgstate_op_true0}} + \__pdf_backend_object_new:nn {__spc_extgstate_op_true1}{dict} + \__pdf_backend_object_write:nn + {__spc_extgstate_op_true1} + {/Type /ExtGState~/op~true~/OP~true~/OPM~1}% + \pdfmanagement_add:nnn + {Page/Resources/ExtGState} + {SPCop} + {\__pdf_backend_object_ref:n {__spc_extgstate_op_true1}} + } + } +%% +%% +%% End of file `pdfmanagement-firstaid.sty'. |