From b744c27771c8d669144b77ff52439d43a5596ff2 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Sun, 28 Jun 2020 03:01:21 +0000
Subject: CTAN sync 202006280301

---
 macros/latex/contrib/icon-appr/icon-appr.dtx | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

(limited to 'macros/latex/contrib/icon-appr/icon-appr.dtx')

diff --git a/macros/latex/contrib/icon-appr/icon-appr.dtx b/macros/latex/contrib/icon-appr/icon-appr.dtx
index ec48098342..14a77bbbf2 100644
--- a/macros/latex/contrib/icon-appr/icon-appr.dtx
+++ b/macros/latex/contrib/icon-appr/icon-appr.dtx
@@ -14,7 +14,7 @@
 %</copyright>
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{icon-appr}
-%<package> [2020/06/05 v1.2 Provides icon appearances for button fields (dps)]
+%<package> [2020/06/13 v1.2.1 Provides icon appearances for button fields (dps)]
 %<*driver>
 \documentclass{ltxdoc}
 \usepackage[colorlinks,hyperindex=false]{hyperref}
@@ -97,7 +97,7 @@
 \newtoks\IA@IconsAlpha \IA@IconsAlpha={}
 \let\IA@Icons\@empty
 \let\IA@Icons@pdfmark\@empty
-\let\IA@Icons@pdfmark@Names\@gobble
+\let\IA@Icons@pdfmark@Names\@empty
 \newcommand{\sortitem}[2][\relax]{%
   \DTLnewrow{list}% Create a new entry
   \ifx#1\relax
@@ -173,7 +173,8 @@
 %    \begin{macrocode}
   \g@addto@macro\IA@Icons{\end{sortedlist}}
 %    \end{macrocode}
-%     We expand \cs{IA@Icons} only if not a pdfmark workflow.
+%     We expand \cs{IA@Icons} only if not a pdfmark workflow, this is were the list of icon names
+%     is sorted.
 %    \begin{macrocode}
   \ifpdfmarkup\else\expandafter\IA@Icons\fi
 %    \end{macrocode}
@@ -372,7 +373,9 @@
 %    When a \psf{pdfmark}-type driver is being used, \cs{embedEPS} is \cs{let} to
 %    \cs{IA@embedEPS}. This command is used to embed EPS files.
 %    \begin{macrocode}
-\newcommand\IA@embedEPS[2][]{\global\@EmbedEPSUsedtrue
+\newcommand\IA@embedEPS[2][]{\ifx\IA@Icons@pdfmark@Names\@empty
+  \global\let\IA@Icons@pdfmark@Names\@gobble\fi
+  \global\@EmbedEPSUsedtrue
   \begingroup\let\x\noexpand
   \setkeys*{IAKVfamily}{#1}%\XKV@rm has remaining keys
   \ifx\IAKVfamily@name\@empty\IA@handle@name@empty\fi
@@ -442,24 +445,31 @@
 %    \app{Acrobat}. Here, we create a series of hidden \cs{pushButtons} fields
 %    each referencing one of the EPS embedded with \cs{embedEPS}; the creation
 %    of these fields is encapsulated into the \cs{IA@makeHiddenIconFlds}.
+%    \changes{v1.2.1}{2020/06/13}{Replaced \string\cs{ifpdfmarkup} with \string\cs{if@EmbedEPSUsed}.
+%    Code should only be used if \string\cs{embedEPS} is used.}
 %    \begin{macrocode}
-\ifpdfmarkup
-\def\IA@makeHiddenIconFlds{%\texttt{\IA@Icons@pdfmark}\previewOn
+\def\IA@makeHiddenIconFlds{\if@EmbedEPSUsed
   \edef\x{\noexpand\@tfor\noexpand\iName:=\IA@Icons@pdfmark}\x\do{%
    \smash{\rlap{\pushButton[\BC{}\BG{}\F\FHidden\TP{1}\S{S}
     \I{\csOf{\iName}}]{IAhidden.\iName}{0bp}{0bp}}}%
   }%
+  \fi
 }
 %    \end{macrocode}
 %    Insert \cs{IA@makdHiddenIconFlds} at the beginning of the document.
 %    \begin{macrocode}
-\AtBeginDocument{\IA@makeHiddenIconFlds} % kaf
+\AtBeginDocument{\IA@makeHiddenIconFlds}
 %    \end{macrocode}
 %    Finally, a document JavaScript is inserted into the document that
 %    gets each of the fields created by \cs{IA@makeHiddenIconFlds},
 %    and uses \texttt{\meta{Doc}.addIcon()} and \texttt{\meta{Field}.buttonGetIcon()}
 %    to ``register'' these icons. We then delete the fields after we are finished with them.
+%    \cs{IA@Icons@pdfmark@Names} will be either empty (\cs{embedEPS} is not used) or
+%    expands to a list of icon names, for each use of \cs{embedEPS}.
+%    \changes{v1.2.1}{2020/06/13}{\string\cs{IA@Icons@pdfmark@Names} is either empty
+%    or expands to a list of icon names.}
 %    \begin{macrocode}
+\ifpdfmarkup
 \begin{insDLJS}{aicons}{icon-appr: Add icons to Catalog > Names > AP}
 var aIconNames= new Array(\IA@Icons@pdfmark@Names);
 for (i=0; i< aIconNames.length; i++) {
-- 
cgit v1.2.3

