texlive[49800] Master/texmf-dist: animate (23jan19)

commits+karl at tug.org commits+karl at tug.org
Wed Jan 23 22:25:14 CET 2019


Revision: 49800
          http://tug.org/svn/texlive?view=revision&revision=49800
Author:   karl
Date:     2019-01-23 22:25:14 +0100 (Wed, 23 Jan 2019)
Log Message:
-----------
animate (23jan19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/animate/ChangeLog
    trunk/Master/texmf-dist/doc/latex/animate/README.txt
    trunk/Master/texmf-dist/doc/latex/animate/animate.pdf
    trunk/Master/texmf-dist/source/latex/animate/animate.tex
    trunk/Master/texmf-dist/tex/latex/animate/animate.sty

Modified: trunk/Master/texmf-dist/doc/latex/animate/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/doc/latex/animate/ChangeLog	2019-01-23 21:25:01 UTC (rev 49799)
+++ trunk/Master/texmf-dist/doc/latex/animate/ChangeLog	2019-01-23 21:25:14 UTC (rev 49800)
@@ -1,3 +1,7 @@
+2019-01-23
+	* new : support for embedding PDF with `dvisvgm', multipage PDF support with
+	`dvisvgm' and `dvipdfmx' driver
+
 2018-12-19
 	* fix : wrong scaling of repeatedly embedded external graphics; JS-related
 	issue in case of side-by-side animations in one SVG

Modified: trunk/Master/texmf-dist/doc/latex/animate/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/animate/README.txt	2019-01-23 21:25:01 UTC (rev 49799)
+++ trunk/Master/texmf-dist/doc/latex/animate/README.txt	2019-01-23 21:25:14 UTC (rev 49800)
@@ -43,6 +43,7 @@
 
  * Package options: width=<h-size>, height=<v-size>, totalheight=<v-size>,
                     keepaspectratio, scale=<factor>, nomouse,
+                    hiresbb,pagebox,interpolate,
                     autopause, autoplay, autoresume, controls[=all | none | ...],
                     final, draft,
                     buttonsize=<size>,
@@ -71,6 +72,7 @@
 
  * Command options: width=<h-size>, height=<v-size>, totalheight=<v-size>,
                     keepaspectratio, scale=<factor>, nomouse,
+                    hiresbb,pagebox,interpolate,
                     autopause, autoplay, autoresume, final, draft,
                     controls[=all | none | ...],
                     buttonsize=<size>,

Modified: trunk/Master/texmf-dist/doc/latex/animate/animate.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/animate/animate.tex
===================================================================
--- trunk/Master/texmf-dist/source/latex/animate/animate.tex	2019-01-23 21:25:01 UTC (rev 49799)
+++ trunk/Master/texmf-dist/source/latex/animate/animate.tex	2019-01-23 21:25:14 UTC (rev 49800)
@@ -89,7 +89,9 @@
 \def\@anim at sanitizeColon{}\def\@anim at sanitizeJS{}\def\@anim at endsanitize{}
 \expandafter\parsedate\@anim at version\relax %set current date to package date
 \makeatother
-\author{Alexander Grahn \animategraphics[autoplay,loop,height=1.8ex,nomouse]{8}{bye_}{0}{3}\protect\footnote{Animated GIF taken from \href{http://www.phpBB.com}{phpBB} forum software and burst into a set of EPS files using \href{http://www.imagemagick.org}{ImageMagick} before embedding.} \protect\footnote{Animations may run slowly if viewed in the Acrobat Reader browser plugin.}\\[1ex]\url{https://gitlab.com/agrahn/animate}}
+\author{Alexander Grahn \animategraphics[autoplay,loop,height=1.8ex,nomouse]{8}{bye_}{0}{3}\protect\footnote{Animated GIF taken from \href{http://www.phpBB.com}{phpBB} forum software and burst into a set of EPS files using \href{http://www.imagemagick.org}{ImageMagick} before embedding.}%
+%\space\protect\footnote{Animations may run slowly if viewed in the Acrobat Reader browser plugin.}%
+\\[1ex]\url{https://gitlab.com/agrahn/animate}}
 \maketitle
 \endgroup
 \begin{abstract}
@@ -109,9 +111,9 @@
 
 Package `animate' supports the usual workflows for making PDF, i.\,e. pdf\LaTeX{}, Lua\LaTeX{}, \LaTeX{} $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+/Distiller and \pXepLaTeX{} $\rightarrow$ \verb+(x)dvipdfmx+. For animated SVG, it supports the \verb+dvisvgm+ driver. The DVI/XDV used as input for \verb+dvisvgm+ can be generated with \LaTeX{}, Lua\LaTeX{} (in DVI mode) and \XeLaTeX.
 
-PDF files with animations can be viewed in Acrobat Reader (except on mobile devices), PDF-XChange and Foxit Reader. Animated SVG produced by means of \LaTeX{} and \verb+dvisvgm+ are self-contained files that can be embedded into HTML using the \verb+<object>+ tag or opened directly in a Web browser, such as Chromium or Firefox. 
+PDF files with animations can be viewed in Acrobat Reader (except on mobile devices), PDF-XChange and Foxit Reader. Animated SVG produced by means of \LaTeX{} and \verb+dvisvgm+ are self-contained files that can be embedded into HTML using the \verb+<object>+ tag or opened directly in a Web browser, such as Chromium or Firefox.
 
-The user interacts with the animation through optional animation controls or using the mouse like so: Pressing the mouse button over the animation widget immediately pauses a playing animation and releasing it resumes playback. Pressing the shift-key at the same time reverses the playback direction. Keeping the mouse button pressed while moving the mouse pointer off the animation widget permanently pauses playback.
+The user interacts with the animation through optional animation controls or using the mouse like so: pressing the mouse button over the animation widget immediately pauses a playing animation and releasing it resumes playback. Pressing the shift-key at the same time reverses the playback direction. Keeping the mouse button pressed while moving the mouse pointer off the animation widget permanently pauses playback.
 
 On mobile devices, interaction with an animated SVG is similar to that on desktop devices, just using finger touches instead of mouse button press/release. To permanently pause an animation without the pause button, touch the animation with a second finger, then lift both fingers off.
 
@@ -159,6 +161,9 @@
 height=<v-size> | totalheight=<v-size>
 keepaspectratio
 scale=<factor>
+hiresbb
+interpolate
+pagebox
 buttonsize=<size>
 buttonbg=<colour>
 buttonfg=<colour>
@@ -240,14 +245,14 @@
   \animategraphics{12}{frame_}{5}{50}
 \end{verbatim}
 
-The possible file formats depend on the output driver being used. In the case of \LaTeX{} + \verb+dvips+, files with the `eps' extension are at first searched for, followed by `mps' (\MP-generated PostScript) and `ps'. With pdf\LaTeX{} and Lua\LaTeX{} the searching order is: (1)~`pdf', (2)~`mps', (3)~`png', (4)~`jpg', (5)~`jpeg', (6)~`jbig2', (7)~`jb2', (8)~`jp2'\footnotemark[1], (9)~`j2k'\footnotemark[1], (10)~`jpx'\footnotemark[1]\footnotetext[1]{Only Lua\LaTeX{} currently supports JPEG2000.}, with \XeLaTeX{} or \LaTeX{}+\verb+dvipdfmx+: (1)~`pdf', (2)~`mps', (3)~`eps', (4)~`ps', (5)~`png', (6)~`jpg', (7)~`jpeg', (8)~`bmp', and with \LaTeX{}+\verb+dvisvgm+: (1)~`eps', (2)~`ps', (3)~`mps', (4)~`svg', (5)~`png', (6)~`jpg', (7)~`jpeg'. That is, files capable of storing vector graphics are found first. Make sure that all file names have \emph{lower case} extensions.
+The possible file formats depend on the output driver being used. In the case of \LaTeX{} + \verb+dvips+, files with the `eps' extension are at first searched for, followed by `mps' (\MP-generated PostScript) and `ps'. With pdf\LaTeX{} and Lua\LaTeX{} the searching order is: (1)~`pdf', (2)~`mps', (3)~`png', (4)~`jpg', (5)~`jpeg', (6)~`jbig2', (7)~`jb2', (8)~`jp2'\footnotemark[1], (9)~`j2k'\footnotemark[1], (10)~`jpx'\footnotemark[1]\footnotetext[1]{Only Lua\LaTeX{} currently supports JPEG2000.}, with \XeLaTeX{} or \LaTeX{}+\verb+dvipdfmx+: (1)~`pdf', (2)~`mps', (3)~`eps', (4)~`ps', (5)~`png', (6)~`jpg', (7)~`jpeg', (8)~`bmp', and with \LaTeX{}+\verb+dvisvgm+: (1)~`pdf', (2)~`eps', (3)~`ps', (4)~`mps', (5)~`svg', (6)~`png', (7)~`jpg', (8)~`jpeg'. That is, files capable of storing vector graphics are found first. Make sure that all file names have \emph{lower case} extensions.
 
 This searching procedure can be skipped thanks to the package and command option `\verb+type=<file ext>+'. It enforces the embedding of files with the given file name extension \verb+<file ext>+.
 
 Command \verb+\graphicspath{}+ from the `graphicx' package can be used to specify directories to be browsed for graphics files.
 
-\myparagraph*{Multipage PDF {\rm(pdf\LaTeX, \XeLaTeX)} and JBIG2 {\rm(pdf\LaTeX)} inclusion}
-If the file `\verb+<file basename>+.(pdf|jbig2|jb2)' exists, it is taken as a multipage document where each page represents one frame of the animation. In this case, the last two arguments, \verb+<first>+ \& \verb+<last>+, are interpreted differently from above; they specify a zero-based range of pages to be included in the animation. Either or both of them may be omitted, `\verb+{}+', in which case they default to $0$ and $n-1$, where $n$ is the total number of available pages. Arguments that fall outside this range are automatically corrected to the actual limits. If \verb+<first>+ is greater than \verb+<last>+, pages are embedded in reverse order. Again, option `\verb+type=<file ext>+' can be used to enforce a particular file type.
+\myparagraph*{Multipage PDF inclusion} %{\rm(pdf\LaTeX, \XeLaTeX, \texttt{dvipdfmx})} and JBIG2 {\rm(pdf\LaTeX)} inclusion}
+Lua\LaTeX{}, pdf\LaTeX{}, \XeLaTeX{} and the \verb+dvipdfmx+ and \verb+dvisvgm+ backends are able to embed animation frames from multipage PDF. If the file `\verb+<file basename>+.pdf' exists, it is taken as a multipage document where each page represents one frame of the animation. In this case, the last two arguments, \verb+<first>+ \& \verb+<last>+, are interpreted differently from above; they specify a zero-based range of pages to be included in the animation. Either or both of them may be omitted, `\verb+{}+', in which case they default to $0$ and $n-1$, where $n$ is the total number of available pages. Arguments that fall outside this range are automatically corrected to the actual limits. If \verb+<first>+ is greater than \verb+<last>+, pages are embedded in reverse order. Again, option `\verb+type=<file ext>+' can be used to enforce a particular file extension.
 
 For example, the line
 \begin{verbatim}
@@ -255,6 +260,7 @@
 \end{verbatim}
 would create an animation from all pages of the file `frames.pdf', running at 12 fps.
 
+\clearpage
 \section{Command options}
 The following options to \verb+\animategraphics+ and `\verb+animateinline+' have been provided:
 \subsection{Basic options}
@@ -321,6 +327,12 @@
 \end{verbatim}
 (\verb+\animategraphics+ only.) Crops graphics at the edges. The four lengths specify the amount to be removed from or, if negative values have been provided, to be added to each side of the graphics.
 \begin{verbatim}
+pagebox
+hiresbb
+interpolate
+\end{verbatim}
+(\verb+\animategraphics+ only.) Options from the `graphics' bundle. Refer to the `graphics' package manual for their meaning.
+\begin{verbatim}
 controls[=all | true | on]
 controls=(none | false | off) | {[play][,step][,stop][,speed]}
 \end{verbatim}
@@ -1301,7 +1313,7 @@
 
 As `\verb+dvisvgm+' is linked against the Ghostscript library, it can parse and convert embedded PostScript to inline SVG code. It is therefore compatible with the popular TikZ and PSTricks \LaTeX{} packages.
  
-SVG is a one-page graphics format. Therefore, it is most useful to first produce DVI with a single animation per file or page. Then, `\verb+dvisvgm+' converts every page of the DVI input to a standalone animated SVG file. Use the `article' document class and pass `\verb+dvisvgm+' as a global option. In this way, it gets conveyed to `animate' and other packages to be loaded, such as `graphicx' or TikZ. Note that the `standalone' document class is not required; `\verb+dvisvgm+' already computes the tightly enclosing bounding box around the page content by default.
+SVG is a single-page graphics format. Therefore, it is most useful to first produce DVI with a single animation per file or page. Then, `\verb+dvisvgm+' converts every page of the DVI input to a standalone animated SVG file. Use the `article' document class and pass `\verb+dvisvgm+' as a global option. In this way, it gets conveyed to `animate' and other packages to be loaded, such as `graphicx' or TikZ. Note that the `standalone' document class is not required; `\verb+dvisvgm+' already computes the tightly enclosing bounding box around the page content by default. If `standalone' is still to be used, `\verb+preview+' must be added as a global document class option.
 
 The following code may serve as a template for generating standalone animated SVG:
 \begin{lstlisting}
@@ -1332,7 +1344,7 @@
 \end{center}
 \end{document}
 \end{lstlisting}
-Note that when animating external graphics with \verb+\animategraphics+, only PostScript (EPS, PS, MPS) files are converted to inline SVG code; files in other formats (SVG, PNG, JPEG) remain external and must be bundled with the final SVG output. Also note that PostScript files must have the fonts embedded. This is not always the case for \MP-generated PostScript. Here, embedding of fonts is ensured putting `\verb+prologues := 3;+' into the header of the \MP{} input. Unfortunately, animating PostScript files with \verb+\animategraphics+ is limited to vector graphics. If such files contain bitmapped content they must be converted to PNG (or JPEG, if photographs). Of course, these files remain external to the final animated SVG.
+Note that when animating external graphics with \verb+\animategraphics+, only PDF and PostScript (EPS, PS, MPS) files are converted to inline SVG code; files in other formats (SVG, PNG, JPEG) remain external and must be bundled with the final SVG output. Also note that PostScript files must have all required fonts embedded. This is not always the case for \MP-generated PostScript. Here, embedding of fonts is ensured by putting `\verb+prologues := 3;+' into the header of the \MP{} input. Unfortunately, animating PDF and PostScript files with \verb+\animategraphics+ is limited to vector graphics. If such files contain bitmapped content they must be converted to PNG (or JPEG, if photographs). Of course, these files remain external to the final animated SVG.
 
 Use one of
 \begin{verbatim}
@@ -1343,11 +1355,11 @@
 \end{verbatim}
 to produce DVI or XDV output from the \LaTeX{} source. After this, SVG is obtained by running
 \begin{verbatim}
-dvisvgm --no-fonts --exact --zoom=-1
+dvisvgm --font-format=woff --exact --zoom=-1
 \end{verbatim}
 on the intermediate DVI or XDV file.
 
-Option `\verb+--no-fonts+' prompts `\verb+dvisvgm+' to retrace font glyphs as graphical paths. It ensures that the text font looks as in normal PDF output.
+Option `\verb+--font-format=woff+' (or `\verb+--font-format=woff2+') prompts `\verb+dvisvgm+' to embed document fonts in a format that is understood by Web browsers. It ensures that typeset text looks as in normal PDF output.
 
 Option `\verb+--exact+' tells `\verb+dvisvgm+' to calculate exact bounding boxes around font glyphs. This avoids clipping of glyphs in the SVG output, as glyphs usually tend to be slightly bigger than their boxes defined in the font files.
 
@@ -1355,7 +1367,7 @@
 
 By default, `\verb+dvisvgm+' processes only the very first page of the input file. To convert multipage DVI/XDV with several animations, add option `\verb+-p1,-+'.
 
-As SVG derives from XML it is not known to be particularly economical in terms of file size. Compressed SVG, with file extension `\verb+svgz+', shortens download times and is supported by most Web browsers. It can be generated by adding option `\verb+-z+'.
+As SVG derives from XML it is not known to be particularly economical in terms of file size. Compressed SVG, with file extension `\verb+svgz+', shortens download times and is supported by most Web browsers. It can be generated by adding option `\verb+-z+'. Also, option `\verb+--precision=1+' may be used to reduce the SVG file size. It limits the precision of floating point numbers, such as coordinates, to one decimal figure.
 
 The recommended way to include animated SVG into HTML is to use the \verb+<object>+ tag. The \verb+<img>+ tag does not work here, as it ignores the embedded JavaScript. However, it may still be used as fallback. Also, it allows for search engine indexing, if desired:
 \begin{lstlisting}

Modified: trunk/Master/texmf-dist/tex/latex/animate/animate.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/animate/animate.sty	2019-01-23 21:25:01 UTC (rev 49799)
+++ trunk/Master/texmf-dist/tex/latex/animate/animate.sty	2019-01-23 21:25:14 UTC (rev 49800)
@@ -13,7 +13,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 
-\def\@anim at version{2018/12/19}
+\def\@anim at version{2019/01/23}
 \ProvidesPackage{animate}
 [\@anim at version\space PDF & SVG animations from files and inline graphics]
 
@@ -51,13 +51,6 @@
     \PassOptionsToPackage{xetex}{pdfbase}
   }
   \DeclareOptionX{dvisvgm}{%
-    \@ifclassloaded{standalone}{
-      \PackageError{animate}{%
-        Option `dvisvgm' and the `standalone' document\MessageBreak%
-        class are not compatible.\MessageBreak%
-        Use another document class, such as `article'%
-      }{}%
-    }{}%
     \setboolean{@anim at dvisvgm}{true}
     \setboolean{@anim at dvips}{false}
     \PassOptionsToPackage{dvisvgm}{graphics}
@@ -88,36 +81,133 @@
 \RequirePackage{graphics}%\scalebox, \resizebox, \rotatebox
 \RequirePackage{zref-abspage}
 
+% get number of pages in file given as #1 (file basename); #2 extension;
+% store result into macro given as #3
+\ifpdf %pdflatex/lualatex
+  \def\@anim at getpagecount#1#2#3{%
+    \pdfximage page 1 {#1.#2}\xdef#3{\the\pdflastximagepages}%
+  }
+\else
+  \if at anim@xetex
+    \def\@anim at getpagecount#1#2#3{%
+      \xdef#3{\the\numexpr\XeTeXpdfpagecount "#1.#2"\relax}%
+    }
+  \else
+    \if at anim@dvips
+      \def\@anim at getpagecount#1#2#3{\gdef#3{1}}%
+    \else %dvipdfmx, dvisvgm
+      \def\@anim at getpagecount#1#2#3{{%
+        \global\let#3\@undefined%
+        \def\%##1: ##2:{%
+          \expandafter\edef\csname ##1\endcsname{##2}%
+          \global\let#3\Pages%
+        }%
+        \endlinechar`\:% `:' appended to every line read
+        \IfFileExists{#1.xbb}{%
+          %read from xbb file
+          {\catcode`\%=0\sbox0{\input{#1.xbb}}}%
+          \ifdefined#3\else%
+            \PackageError{animate}{%
+              Cannot read number of pages from file\MessageBreak%
+              -------------------------------------\MessageBreak%
+              #1.xbb\MessageBreak%
+              -------------------------------------\MessageBreak%
+              This file seems to be invalid and should be deleted%
+            }{}%
+          \fi%
+        }{%
+          %read from command pipe (`extractbb')
+          %firstly, check whether reading from pipe is allowed
+          \immediate\closein\@inputcheck%
+          \immediate\openin\@inputcheck="|extractbb -h"%
+          \let\@anim at foo\@anim at bar% <-- needed for some reason to make
+          \ifeof\@inputcheck%       <-- this test work correctly
+            \immediate\closein\@inputcheck%
+            \PackageError{animate}{%
+              Cannot determine number of pages in file\MessageBreak%
+              ----------------------------------------\MessageBreak%
+              #1.#2\MessageBreak%
+              ----------------------------------------\MessageBreak%
+              Try --shell-escape option (--enable-pipes in MikTeX),%
+              \MessageBreak or run\MessageBreak%
+              \space\space extractbb #1.#2\MessageBreak%
+              on the command line to provide a valid `xbb' file%
+            }{}%
+          \else%
+            \immediate\closein\@inputcheck%
+            {\catcode`\%=0\sbox0{\@@input "|extractbb -O #1.#2"}}%
+          \fi%
+        }%
+      }}
+    \fi
+  \fi
+\fi
+
 \if at anim@dvisvgm
   \setboolean{@anim at export}{false}
 
   \AtBeginDocument{%
-    %bring back PS file inclusion
-    \ifdefined\Ginclude at eps\else%
-      \def\Gin at extensions{.svg,.eps,.png,.jpg,.jpeg}%
-      \def\Ginclude at eps#1{%
-       \message{<#1>}%
-        \bgroup
-        \def\@tempa{!}%
-        \dimen@\Gin at req@width
-        \dimen at ii.1bp%
-        \divide\dimen@\dimen at ii
-        \@tempdima\Gin at req@height
-        \divide\@tempdima\dimen at ii
-          \special{PSfile="#1"\GPT at space
-            llx=\Gin at llx\GPT at space
-            lly=\Gin at lly\GPT at space
-            urx=\Gin at urx\GPT at space
-            ury=\Gin at ury\GPT at space
-            \ifx\Gin at scalex\@tempa\else rwi=\number\dimen@\GPT at space\fi
-            \ifx\Gin at scaley\@tempa\else rhi=\number\@tempdima\GPT at space\fi
-            \ifGin at clip clip\fi}%
-        \egroup}%
-      \@namedef{Gin at rule@.ps}#1{{eps}{.ps}{#1}}%
-      \@namedef{Gin at rule@.eps}#1{{eps}{.eps}{#1}}%
-      \@namedef{Gin at rule@.mps}#1{{eps}{.mps}{#1}}%
-    \fi%
-    %restore PS scaling and rotation
+    % Add PS and PDF file inclusion (PDF files as of dvisvgm-2.4) to and
+    % fix scaling/rotation/transformation in dvisvgm graphics driver
+    \xdef\Gin at extensions{.eps,.pdf,\Gin at extensions}%
+    \def\Ginclude at pdf#1{\@anim at include@psorpdf{#1}{pdffile}}%
+    \def\Ginclude at eps#1{\let\Gin at page\@empty\@anim at include@psorpdf{#1}{PSfile}}%
+    \def\@anim at include@psorpdf#1#2{% code taken from dvips.def
+      \message{<#1>}%
+      \bgroup%
+      \def\@tempa{!}%
+      \dimen@\Gin at req@width%
+      \dimen at ii.1bp%
+      \divide\dimen@\dimen at ii%
+      \@tempdima\Gin at req@height%
+      \divide\@tempdima\dimen at ii%
+        \special{#2="#1"\GPT at space%
+          \ifx\Gin at page\@empty\else page=\Gin at page\GPT at space\fi%
+          llx=\Gin at llx\GPT at space%
+          lly=\Gin at lly\GPT at space%
+          urx=\Gin at urx\GPT at space%
+          ury=\Gin at ury\GPT at space%
+          \ifx\Gin at scalex\@tempa\else rwi=\number\dimen@\GPT at space\fi%
+          \ifx\Gin at scaley\@tempa\else rhi=\number\@tempdima\GPT at space\fi%
+          \ifGin at clip clip\fi}%
+      \egroup}%
+    \@namedef{Gin at rule@.ps}#1{{eps}{.ps}{#1}}%
+    \@namedef{Gin at rule@.eps}#1{{eps}{.eps}{#1}}%
+    \@namedef{Gin at rule@.mps}#1{{eps}{.mps}{#1}}%
+    \@namedef{Gin at rule@.pdf}#1{{pdf}{.xbb}{#1}}%
+    % BoundingBox determination (from dvipdfmx.def)
+    \def\Gread at pdf#1{%
+      \Gread at generic{#1}\Gread at extractbb@aux%
+    }%
+    \def\Gread at extractbb@aux#1{%
+      \ifeof\@inputcheck%
+        \immediate\openin\@inputcheck=%
+          "|extractbb %
+          \ifx\Gin at page\@empty\else -p \Gin at page\GPT at space\fi
+          \ifx\Gin at pagebox\@empty\else -B \Gin at pagebox\GPT at space\fi
+          -O \Gin at base\Gin at ext"%
+      \fi%
+      \Gread at true%
+      \let\@tempb\Gread at false%
+      \ifeof\@inputcheck%
+        \@latex at error%
+          {Cannot run pipe command. Try --shell-escape^^J%
+           (--enable-pipes in MikTeX) option}%
+          {}%
+      \else%
+        \loop%
+          \read\@inputcheck to\@tempa%
+          \ifeof\@inputcheck%
+            \Gread at false%
+          \else%
+            \expandafter\Gread at find@bb\@tempa:.\\%
+          \fi%
+          \ifGread@%
+          \repeat%
+        \immediate\closein\@inputcheck%
+      \fi%
+    }%
+    % PS scaling and rotation (from dvips.def)
     \def\Grot at start{%
       \special{ps: gsave currentpoint
         currentpoint translate \Grot at angle\GPT at space neg
@@ -384,19 +474,20 @@
 \def\@anim at xformnatdp#1{\expandafter\@anim at thirdofthree#1}
 
 %helper macro that typesets graphics file into savebox
-\def\@anim at filebox#1#2{% dvips, dvisvgm: no multi-page support
-  \edef\@anim at curfile{[clip\@anim at gropts]{#1}}%
-  \global\setbox\@anim at box=\hbox{%
-    \expandafter\includegraphics\@anim at curfile}%
-}
-\if at anim@dvips\else\if at anim@dvisvgm\else
-  %pdfTeX, LuaTeX, dvipdfmx, xetex (multi-page)
+\if at anim@dvips
+  \def\@anim at filebox#1#2{% dvips: no multi-page support
+    \edef\@anim at curfile{[clip\@anim at gropts]{#1}}%
+    \global\setbox\@anim at box=\hbox{%
+      \expandafter\includegraphics\@anim at curfile}%
+  }
+\else
+  %pdfTeX, LuaTeX, dvipdfmx, xetex, dvisvgm
   \def\@anim at filebox#1#2{%
     \edef\@anim at curfile{[clip\@anim at gropts,page=#2]{#1}}%
     \global\setbox\@anim at box=\hbox{%
       \expandafter\includegraphics\@anim at curfile}%
   }
-\fi\fi
+\fi
 
 \def\@anim at checkboxsize#1#2{% #1: box number, #2: file
   \ifdim\wd#1=\z@%
@@ -419,7 +510,7 @@
 
 %create Form XObject from graphics file
 \def\@anim at ximage#1#2#3#4{%#1:@anim at num, #2:@anim at curframe@zb, #3:filename,
-  %                                        #4: page number of multipage file
+  %                                      #4: page number of multipage file
   \if at anim@dvisvgm%
     % with dvisvgm, final animation dims must be passed to includegraphics;
     % otherwise, final bbox of the document may be wrong, in particular in the
@@ -1338,8 +1429,10 @@
     \if at anim@dvisvgm
       \def\@anim at getpath#1#2{%
         \ifx\@empty#2\@empty%
-          \gdef\@anim at ext{.eps}% we start with `eps'
+          \gdef\@anim at ext{.pdf}% we start with `pdf'
           \IfFileExists{#1\@anim at ext}{}{%
+          \gdef\@anim at ext{.eps}%
+          \IfFileExists{#1\@anim at ext}{}{%
           \gdef\@anim at ext{.ps}%
           \IfFileExists{#1\@anim at ext}{}{%
           \gdef\@anim at ext{.mps}%
@@ -1354,6 +1447,7 @@
           \IfFileExists{#1\@anim at ext}{}{%
             \PackageError{animate}{%
               None of the files\MessageBreak%
+              `#1.pdf',\MessageBreak%
               `#1.eps',\MessageBreak%
               `#1.ps',\MessageBreak%
               `#1.mps',\MessageBreak%
@@ -1364,7 +1458,7 @@
               could be found.\MessageBreak%
               Wrong file type? Mis-spelled file name?%
             }{}%
-          }}}}}}}%
+          }}}}}}}}%
         \else%
           \gdef\@anim at ext{.#2}%
           \IfFileExists{#1\@anim at ext}{}{%
@@ -1459,8 +1553,10 @@
   \endgroup%
 }
 
-\ifpdf
-  %detects multipage PDF and corrects user supplied page range
+%detects multipage PDF and corrects user supplied page range
+\def\@anim at checkmultipage#1#2{% no multi-page support in dvips
+  \setboolean{@anim at multipage}{false}}%
+\if at anim@dvips\else
   \def\@anim at checkmultipage#1#2{% #1: file base name, #2 user provided file ext
     \ifx\@empty#2\@empty%
       \IfFileExists{#1.pdf}{%
@@ -1467,15 +1563,17 @@
         \setboolean{@anim at multipage}{true}%
         \gdef\@anim at ext{.pdf}%
       }{%
-        \IfFileExists{#1.jbig2}{%
-          \setboolean{@anim at multipage}{true}%
-          \gdef\@anim at ext{.jbig2}%
-        }{%
-          \IfFileExists{#1.jb2}{%
+        \ifpdf% some extra file formats for pdftex/luatex
+          \IfFileExists{#1.jbig2}{%
             \setboolean{@anim at multipage}{true}%
-            \gdef\@anim at ext{.jb2}%
-          }{}%
-        }%
+            \gdef\@anim at ext{.jbig2}%
+          }{%
+            \IfFileExists{#1.jb2}{%
+              \setboolean{@anim at multipage}{true}%
+              \gdef\@anim at ext{.jb2}%
+            }{}%
+          }%
+        \fi%  
       }%
     \else%
       \IfFileExists{#1.#2}{%
@@ -1485,10 +1583,12 @@
     \fi%
     \if at anim@multipage%
       \xdef\@anim at pathtofile{\expandafter\zap at finalspace\@filef at und\@nil}%
-      \pdfximage page 1 {\@anim at pathtofile}%
-      \@anim at curframe=\pdflastximagepages%
-      \advance\@anim at curframe by -\@ne%since \pdfximagepages is 1-based
-      \edef\@anim at lastpage{\the\@anim at curframe}%
+      \filename at parse{\@anim at pathtofile}%
+      \@anim at getpagecount{\filename at area\filename at base}{\filename at ext}{%
+        \@anim at lastpage%
+      }%
+      %we need it zero-based
+      \edef\@anim at lastpage{\the\numexpr\@anim at lastpage-\@ne\relax}%
       \ifx\@anim at first\@empty%
         \gdef\@anim at first{0}%
       \else%
@@ -1513,56 +1613,7 @@
       \xdef\@anim at last{\the\@anim at curframe}%
     \fi%
   }%
-\else
-  \if at anim@xetex
-    \def\@anim at checkmultipage#1#2{%
-      \ifx\@empty#2\@empty%
-        \IfFileExists{#1.pdf}{%
-          \setboolean{@anim at multipage}{true}%
-          \gdef\@anim at ext{.pdf}%
-        }{}%
-      \else%
-        \IfFileExists{#1.#2}{%
-          \setboolean{@anim at multipage}{true}%
-          \gdef\@anim at ext{.#2}%
-        }{}%
-      \fi%
-      \if at anim@multipage%
-        \xdef\@anim at pathtofile{\expandafter\zap at finalspace\@filef at und\@nil}%
-        \@anim at curframe=\XeTeXpdfpagecount "\@anim at pathtofile"%
-        \advance\@anim at curframe by -\@ne%since XeTeXpdfpagecount is 1-based
-        \edef\@anim at lastpage{\the\@anim at curframe}%
-        \ifx\@anim at first\@empty%
-          \gdef\@anim at first{0}%
-        \else%
-          \ifnum\@anim at first<\z@\relax\gdef\@anim at first{0}\fi%
-          \ifnum\@anim at first>\@anim at lastpage\relax%
-            \global\let\@anim at first\@anim at lastpage%
-          \fi%
-        \fi%
-        \ifx\@anim at last\@empty%
-          \global\let\@anim at last\@anim at lastpage%
-        \else%
-          \ifnum\@anim at last<\z@\relax\gdef\@anim at last{0}\fi%
-          \ifnum\@anim at last>\@anim at lastpage\relax%
-            \global\let\@anim at last\@anim at lastpage%
-          \fi%
-        \fi%
-        \@anim at curframe=\@anim at first%
-        \advance\@anim at curframe by \@ne%
-        \xdef\@anim at first{\the\@anim at curframe}%
-        \@anim at curframe=\@anim at last%
-        \advance\@anim at curframe by \@ne%
-        \xdef\@anim at last{\the\@anim at curframe}%
-      \fi%
-    }%
-  \else
-    %no multi-page support in dvips & dvisvgm;
-    %although dvipdfmx actually has multi-page support, it lacks a way to
-    %determine the total page count which is needed here
-    \def\@anim at checkmultipage#1#2{\setboolean{@anim at multipage}{false}}%
-  \fi
-\fi
+\fi%  
 
 %environment for setting LTR typesetting direction
 \def\@anim at beginLTR{%
@@ -1625,6 +1676,10 @@
   \ifnum\@anim at resizeflags=7\relax% height+totalheight+width->totalheight+width
     \global\@anim at resizeflags=5%
   \fi%
+  \if at anim@hiresbb\xdef\@anim at gropts{\@anim at gropts,hiresbb}\fi%
+  \if at anim@interpolate\xdef\@anim at gropts{\@anim at gropts,interpolate}\fi%
+  \ifx\@anim at pagebox\@empty\else%
+    \xdef\@anim at gropts{\@anim at gropts,pagebox=\@anim at pagebox}\fi%
   \ifthenelse{\boolean{@anim at autoplay}\OR\boolean{@anim at autoresume}}{%
     \setboolean{@anim at autoplayorresume}{true}%
   }{}%
@@ -2032,7 +2087,7 @@
       \@anim at annot{\@anim at btnsize}{\@anim at btnsize}{\z@}{%
         cursor='pointer' onmousedown='\@anim at btnJS{#1}{\@anim at arg}'%
       }%
-      \@anim at updatebbox{\@anim at btnsize}{\@anim at btnsize}{}%
+      \@anim at updatebbox{\@anim at btnsize}{\@anim at btnsize}{\z@}%
       \hbox to \@anim at btnsize {%
         \vrule width \z@ height \@anim at btnsize depth \z@%
         \hss%
@@ -2872,6 +2927,17 @@
 \define at key{anim at user}{keepaspectratio}[true]{%
   \setboolean{@anim at iso}{#1}%
 }
+\newboolean{@anim at hiresbb}
+\define at key{anim at user}{hiresbb}[true]{%
+  \setboolean{@anim at hiresbb}{#1}%
+}
+\newboolean{@anim at interpolate}
+\define at key{anim at user}{interpolate}[true]{%
+  \setboolean{@anim at interpolate}{#1}%
+}
+\define at key{anim at user}{pagebox}{%
+  \gdef\@anim at pagebox{#1}%
+}
 \define at key{anim at user}{scale}{%
   \gdef\@anim at boxscale{#1}%
 }
@@ -3138,6 +3204,9 @@
   \setboolean{@anim at doscaling}{true}%
   \global\let\@anim at boxscale\@anim@@boxscale%
   \global\let\if at anim@iso=\if at anim@@iso%
+  \global\let\if at anim@hiresbb=\if at anim@@hiresbb%
+  \global\let\if at anim@interpolate=\if at anim@@interpolate%
+  \global\let\@anim at pagebox\@anim@@pagebox%
   \global\@anim at resizeflags\@anim@@resizeflags%
   \global\let\@anim at widtharg\@anim@@widtharg%
   \global\let\@anim at heightarg\@anim@@heightarg%
@@ -3331,6 +3400,18 @@
 \define at key{anim at pkg}{keepaspectratio}[true]{%
   \setboolean{@anim@@iso}{#1}%
 }
+\newboolean{@anim@@hiresbb}
+\define at key{anim at pkg}{hiresbb}[true]{%
+  \setboolean{@anim@@hiresbb}{#1}%
+}
+\newboolean{@anim@@interpolate}
+\define at key{anim at pkg}{interpolate}[true]{%
+  \setboolean{@anim@@interpolate}{#1}%
+}
+\def\@anim@@pagebox{}
+\define at key{anim at pkg}{pagebox}{%
+  \def\@anim@@pagebox{#1}%
+}
 \def\@anim@@boxscale{1}%
 \define at key{anim at pkg}{scale}{%
   \def\@anim@@boxscale{#1}%



More information about the tex-live-commits mailing list