texlive[50076] Master/texmf-dist: media9 (20feb19)

commits+karl at tug.org commits+karl at tug.org
Wed Feb 20 23:42:23 CET 2019


Revision: 50076
          http://tug.org/svn/texlive?view=revision&revision=50076
Author:   karl
Date:     2019-02-20 23:42:23 +0100 (Wed, 20 Feb 2019)
Log Message:
-----------
media9 (20feb19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/media9/ChangeLog
    trunk/Master/texmf-dist/doc/latex/media9/media9.pdf
    trunk/Master/texmf-dist/tex/latex/media9/media9.sty
    trunk/Master/texmf-dist/tex/latex/media9/pdfbase.sty

Modified: trunk/Master/texmf-dist/doc/latex/media9/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/doc/latex/media9/ChangeLog	2019-02-20 22:42:07 UTC (rev 50075)
+++ trunk/Master/texmf-dist/doc/latex/media9/ChangeLog	2019-02-20 22:42:23 UTC (rev 50076)
@@ -1,7 +1,13 @@
+2019-02-19
+	* v0.95 : media9.sty
+	* v0.26 : pdfbase.sty
+	* fix : media9.sty: box scaling fixed after recent expl3 update
+	* new: pdfbase.sty: basic dvisvgm support
+
 2019-01-02
 	* v0.94 : media9.sty
 	* v0.25 : pdfbase.sty
-	* fix : pdfbase.sty: many cs now def'ed as `protected'; adjustments after
+	* fix :  merge request (latex3 end-2018 deprecations)
 
 2018-06-07
 	* v0.93 : media9.sty

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

Modified: trunk/Master/texmf-dist/tex/latex/media9/media9.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/media9/media9.sty	2019-02-20 22:42:07 UTC (rev 50075)
+++ trunk/Master/texmf-dist/tex/latex/media9/media9.sty	2019-02-20 22:42:23 UTC (rev 50076)
@@ -37,11 +37,11 @@
 \RequirePackage{xparse}
 \RequirePackage{atbegshi}
 
-\def\g at mix@date at tl{2019/01/02}
-\def\g at mix@version at tl{0.94}
+\def\g at mix@date at tl{2019/02/19}
+\def\g at mix@version at tl{0.95}
 
-\def\g at mix@liiikerneldate{2017/05/29}
-\def\g at mix@liiipkgdate{2017/05/29}
+\def\g at mix@liiikerneldate{2019/02/15}
+\def\g at mix@liiipkgdate{2018/10/17}
 
 \ProvidesExplPackage{media9}{\g at mix@date at tl}{\g at mix@version at tl}
 {acrobat-9/X compatible media}
@@ -711,16 +711,16 @@
     \tl_gset:Nx\g_mix_wd_tl{\dim_abs:n{\g_mix_wdarg_tl}}
     \tl_gset:Nx\g_mix_ht_tl{\dim_abs:n{\g_mix_htarg_tl}}
     \tl_gset:Nx\g_mix_tt_tl{\dim_abs:n{\g_mix_ttarg_tl}}
-    \dim_compare:nT{\width=\c_zero_dim}{\box_set_wd:Nn#1{\g_mix_wd_tl}}
+    \dim_compare:nT{\width=\c_zero_dim}{\box_gset_wd:Nn#1{\g_mix_wd_tl}}
     \dim_compare:nT{\totalheight=\c_zero_dim}{
       \bool_if:nT{ %height option given
         \int_compare_p:n{\g_mix_resizeflag_int=\c_six}||
         \int_compare_p:n{\g_mix_resizeflag_int=\c_two}
-      }{\box_set_ht:Nn#1{\g_mix_ht_tl}}
+      }{\box_gset_ht:Nn#1{\g_mix_ht_tl}}
       \bool_if:nT{ %totalheight option given
         \int_compare_p:n{\g_mix_resizeflag_int=\c_five}||
         \int_compare_p:n{\g_mix_resizeflag_int=\c_one}
-      }{\box_set_ht:Nn#1{\g_mix_tt_tl}}
+      }{\box_gset_ht:Nn#1{\g_mix_tt_tl}}
     }
   \group_end:
   \tl_gset:Nn\g_mix_dp_tl{\c_zero_dim} %to be initialised here

Modified: trunk/Master/texmf-dist/tex/latex/media9/pdfbase.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/media9/pdfbase.sty	2019-02-20 22:42:07 UTC (rev 50075)
+++ trunk/Master/texmf-dist/tex/latex/media9/pdfbase.sty	2019-02-20 22:42:23 UTC (rev 50076)
@@ -21,8 +21,10 @@
 %
 % Package options:
 %
-%   xetex,
-%   dvipdfmx,
+%   xetex
+%   dvipdfmx
+%   dvisvgm  (basic support: \pbs_literal:nn, \pbs_pdfannot:nnnn,
+%                            \pbs_pdfxform:nnnnn\pbs_pdfrefxform:n)
 %   bigfiles (for embedding large files as stream objects; only relevant for
 %     dvips mode, ignored otherwise)
 %
@@ -149,8 +151,8 @@
 \RequirePackage{expl3}
 \RequirePackage{l3keys2e}
 
-\def\g at pbs@date at tl{2019/01/02}
-\def\g at pbs@version at tl{0.25}
+\def\g at pbs@date at tl{2019/02/19}
+\def\g at pbs@version at tl{0.26}
 
 \ProvidesExplPackage{pdfbase}{\g at pbs@date at tl}{\g at pbs@version at tl}
 {driver independent access to low-level PDF features}
@@ -233,6 +235,7 @@
 
 \bool_new:N\g_pbs_pkgbigfiles_bool
 \bool_new:N\g_pbs_dvipdfmx_bool
+\bool_new:N\g_pbs_dvisvgm_bool
 \bool_new:N\g_pbs_lscape_bool %if we are inside landscape env
 \AtBeginDocument{
   \cs_if_exist:NT\landscape{%
@@ -242,21 +245,41 @@
 }
 
 \keys_define:nn{pdfbase}{
-  xetex .bool_gset:N = \g_pbs_dvipdfmx_bool,
-  dvipdfmx .bool_gset:N = \g_pbs_dvipdfmx_bool,
+  xetex .code:n = {}, %dummy, we use engine test instead
 
-  bigfiles .choice:,
-  bigfiles / true .code:n = {\bool_gset_true:N\g_pbs_pkgbigfiles_bool},
-  bigfiles / false .code:n = {\bool_gset_false:N\g_pbs_pkgbigfiles_bool},
-  bigfiles .default:n = {true},
+  dvipdfmx .choice:,
+  dvipdfmx / true .code:n = {
+    \bool_gset_true:N\g_pbs_dvipdfmx_bool
+    \bool_gset_false:N\g_pbs_dvisvgm_bool
+  },
+  dvipdfmx / false .code:n = {\bool_gset_false:N\g_pbs_dvipdfmx_bool},
+  dvipdfmx .default:n = {true},
 
+  dvisvgm .choice:,
+  dvisvgm / true .code:n = {
+    \bool_gset_true:N\g_pbs_dvisvgm_bool
+    \bool_gset_false:N\g_pbs_dvipdfmx_bool
+  },
+  dvisvgm / false .code:n = {\bool_gset_false:N\g_pbs_dvisvgm_bool},
+  dvisvgm .default:n = {true},
+
+  bigfiles .bool_gset:N = \g_pbs_pkgbigfiles_bool,
+
   unknown .code:n = {
     \msg_error:nnx{pdfbase}{unknown~package~option}{\l_keys_key_tl}
   }
 }
 \ProcessKeysOptions{pdfbase}
-\sys_if_engine_xetex:T{\bool_gset_true:N\g_pbs_dvipdfmx_bool}
 
+\sys_if_output_pdf:T{
+  \bool_gset_false:N\g_pbs_dvipdfmx_bool
+  \bool_gset_false:N\g_pbs_dvisvgm_bool
+}
+
+\sys_if_engine_xetex:T{
+  \bool_if:NF\g_xsb_dvisvgm_bool{\bool_gset_true:N\g_pbs_dvipdfmx_bool}
+}
+
 \cs_new_nopar:Nn\pbs_first_of_two:nn{#1} %helpers
 \cs_new_nopar:Nn\pbs_second_of_two:nn{#2}
 
@@ -487,7 +510,7 @@
       \str_if_eq:nnTF{#1}{}{         % #2: raw PDF
         % set current location's coordinates to (0,0), while saving graphics
         % state before and re-instating after insertion (this is different from
-        % \pdfliteral{...}}
+        % \pdfliteral{...}
         \special{pdf:content~#2}
       }{
         % `direct' works the same as `page': no origin translation,
@@ -641,390 +664,449 @@
     }
     \cs_new_nopar:Nn\pbs_pdfemc:{\special{pdf:code~EMC}}
   }{
-    %dvips
-    \bool_new:N\g_pbs_powerdot_bool %to cope with some powerdot oddity
-    \@ifclassloaded{powerdot}{\bool_gset_true:N\g_pbs_powerdot_bool}{}
+    \bool_if:NTF\g_pbs_dvisvgm_bool{
+      \tl_gset:Nx\g_pbs_hash_tl{\token_to_str:N#}
+      %insert literal Postscript code
+      \cs_new_protected_nopar:Nn\pbs_literal:nn{ % #1: empty (`'), `direct' or `page'
+        \str_if_eq:nnTF{#1}{}{         % #2: raw Postscript
+          % set current location's coordinates to (0,0) and set unit vectors to
+          % 1bp right and 1bp upwards; graphics state is saved before and
+          % re-instated after insertion
+          \special{"~#2}
+        }{
+          % `direct' does the same as `page': no origin translation,
+          % no gs saving
+          \special{ps::~#2}
+        }
+      }
 
-    \sys_if_engine_pdftex:TF{
-      \cs_new_nopar:Nn\pbs_filesize:n{\pdffilesize{#1}}
-      \cs_new_nopar:Nn\pbs_filedump:nnn{\pdffiledump~offset~#1~length~#2~{#3}}
-    }{
-      \sys_if_engine_luatex:T{
-        \RequirePackage{pdftexcmds}
-        \cs_new_nopar:Nn\pbs_filesize:n{\pdf at filesize{#1}}
-        \cs_new_nopar:Nn\pbs_filedump:nnn{\pdf at filedump{#1}{#2}{#3}}
+      \cs_new_protected_nopar:Nn\pbs_pdfannot:nnnn{
+        \special{dvisvgm:raw~{?nl}<path~d=}
+        \group_begin:\dim_set:Nn\unitlength{1pt}
+        \begin{picture}(0,0)% mark annotation rectangle
+          \put(0,-\dim_to_decimal:n{#3}){% ll
+            \special{dvisvgm:raw~'M{?x}~{?y}}
+          }
+          \put(\dim_to_decimal:n{#1},-\dim_to_decimal:n{#3}){% lr
+            \special{dvisvgm:raw~{?nl}L{?x}~{?y}}
+          }
+          \put(\dim_to_decimal:n{#1},\dim_to_decimal:n{#2}){% ur
+            \special{dvisvgm:raw~{?nl}L{?x}~{?y}}
+          }
+          \put(0,\dim_to_decimal:n{#2}){% ul
+            \special{dvisvgm:raw~{?nl}L{?x}~{?y}~Z'}
+          }
+        \end{picture}
+        \group_end:
+        \special{dvisvgm:raw~{?nl}opacity='0'~#4~class='annot'/>}
       }
-    }
 
-    \AtBeginDocument{
-      \@ifpackageloaded{hyperref}{}{
-        %define `?pdfmark' operator as in file pdfmark.def from package `hyperref'
-        \special{!~
-          systemdict~/pdfmark~known
-          {
-            userdict~/?pdfmark~systemdict~/exec~get~put
-          }{
-            userdict~/?pdfmark~systemdict~/pop~get~put~
-            userdict~/pdfmark~systemdict~/cleartomark~get~put
+      \cs_new_protected_nopar:Nn\pbs_pdfxform:nnnnn{
+        \makebox[\c_zero_dim][l]{
+          \raisebox{\c_zero_dim}[\c_zero_dim][\c_zero_dim]{
+            \special{dvisvgm:raw~{?nl}<defs>{?nl}
+              <
+                g~transform='translate(-{?x},-{?y})'~#4~
+                id='pbs at obj\int_use:N\g_pbs_obj_int'~class='xform'
+              >
+            }
+            \box_use_drop:N#5
+            \special{dvisvgm:raw~{?nl}</g>{?nl}</defs>}
           }
-          ifelse
         }
+        \tl_gset:Nx\g_pbs_pdflastxform_tl{\g_pbs_hash_tl pbs at obj\int_use:N\g_pbs_obj_int}
+        \int_gincr:N\g_pbs_obj_int
       }
-      \special{!~
-        %keeping track of xform nesting level
-        true~setglobal~globaldict~/pbs at xform@level~0~put~false~setglobal
-      }
-    }
 
-    \bool_if:NT\g_pbs_pkgbigfiles_bool{
-      \special{psfile=\jobname.pbsdat}
-      %open auxiliary file \jobname.pbsdat for writing hex encoded streams of
-      %the files to be embedded. This file is inserted into PS during dvips run
-      \iow_new:N\g_pbs_mstreams_stream
-      \iow_open:Nn\g_pbs_mstreams_stream{\jobname.pbsdat}
-      \iow_now:Nn\g_pbs_mstreams_stream{
-        /M9D~1~dict~def~M9D~begin
-        /o{mark/_objdef}bind~def/O{/type/stream/OBJ~pdfmark}bind~def
-        /m~systemdict/mark~get~def
-        /P{/ASCIIHexDecode~filter/PUT~pdfmark}bind~def
-        /PP{/PUT~pdfmark}bind~def
-        /C{/CLOSE~pdfmark}bind~def~end
+      \cs_new_protected_nopar:Nn\pbs_pdfrefxform:n{
+        \special{dvisvgm:raw~{?nl}<use~x='{?x}'~y='{?y}'~xlink:href='#1'/>}
       }
-    }
+    }{
+      %dvips
+      \bool_new:N\g_pbs_powerdot_bool %to cope with some powerdot oddity
+      \@ifclassloaded{powerdot}{\bool_gset_true:N\g_pbs_powerdot_bool}{}
 
-    %insert literal Postscript code
-    \cs_new_protected_nopar:Nn\pbs_literal:nn{ % #1: empty (`'), `direct' or `page'
-      \str_if_eq:nnTF{#1}{}{         % #2: raw Postscript
-        % set current location's coordinates to (0,0) and set unit vectors to
-        % 1bp right and 1bp upwards; graphics state is saved before and
-        % re-instated after insertion
-        \special{"~#2}
+      \sys_if_engine_pdftex:TF{
+        \cs_new_nopar:Nn\pbs_filesize:n{\pdffilesize{#1}}
+        \cs_new_nopar:Nn\pbs_filedump:nnn{\pdffiledump~offset~#1~length~#2~{#3}}
       }{
-        % `direct' does the same as `page': no origin translation,
-        % no gs saving
-        \special{ps::~#2}
+        \sys_if_engine_luatex:T{
+          \RequirePackage{pdftexcmds}
+          \cs_new_nopar:Nn\pbs_filesize:n{\pdf at filesize{#1}}
+          \cs_new_nopar:Nn\pbs_filedump:nnn{\pdf at filedump{#1}{#2}{#3}}
+        }
       }
-    }
 
-    \cs_new_protected_nopar:Nn\pbs_pdfobj:nnn{
-      \tl_clear:N\l_pbs_usenum_tl
-      \tl_if_blank:oTF{#1}{
-        \tl_set:Nx\l_pbs_usenum_tl{{pbs at obj\int_use:N\g_pbs_obj_int}}
-        \int_gincr:N\g_pbs_obj_int
-      }{
-        \tl_set:Nx\l_pbs_usenum_tl{#1}
+      \AtBeginDocument{
+        \@ifpackageloaded{hyperref}{}{
+          %define `?pdfmark' operator as in file pdfmark.def from package `hyperref'
+          \special{!~
+            systemdict~/pdfmark~known
+            {
+              userdict~/?pdfmark~systemdict~/exec~get~put
+            }{
+              userdict~/?pdfmark~systemdict~/pop~get~put~
+              userdict~/pdfmark~systemdict~/cleartomark~get~put
+            }
+            ifelse
+          }
+        }
+        \special{!~
+          %keeping track of xform nesting level
+          true~setglobal~globaldict~/pbs at xform@level~0~put~false~setglobal
+        }
       }
-      \tl_if_blank:oF{#3}{
-        \bool_if:nTF{
-          \g_pbs_pkgbigfiles_bool &&
-          \str_if_eq_p:nn{#2}{fstream}
+
+      \bool_if:NT\g_pbs_pkgbigfiles_bool{
+        \special{psfile=\jobname.pbsdat}
+        %open auxiliary file \jobname.pbsdat for writing hex encoded streams of
+        %the files to be embedded. This file is inserted into PS during dvips run
+        \iow_new:N\g_pbs_mstreams_stream
+        \iow_open:Nn\g_pbs_mstreams_stream{\jobname.pbsdat}
+        \iow_now:Nn\g_pbs_mstreams_stream{
+          /M9D~1~dict~def~M9D~begin
+          /o{mark/_objdef}bind~def/O{/type/stream/OBJ~pdfmark}bind~def
+          /m~systemdict/mark~get~def
+          /P{/ASCIIHexDecode~filter/PUT~pdfmark}bind~def
+          /PP{/PUT~pdfmark}bind~def
+          /C{/CLOSE~pdfmark}bind~def~end
+        }
+      }
+
+      %insert literal Postscript code
+      \cs_new_protected_nopar:Nn\pbs_literal:nn{ % #1: empty (`'), `direct' or `page'
+        \str_if_eq:nnTF{#1}{}{         % #2: raw Postscript
+          % set current location's coordinates to (0,0) and set unit vectors to
+          % 1bp right and 1bp upwards; graphics state is saved before and
+          % re-instated after insertion
+          \special{"~#2}
         }{
-          \iow_now:Nx\g_pbs_mstreams_stream{
-            M9D~begin~o\l_pbs_usenum_tl O
-          }
+          % `direct' does the same as `page': no origin translation,
+          % no gs saving
+          \special{ps::~#2}
+        }
+      }
+
+      \cs_new_protected_nopar:Nn\pbs_pdfobj:nnn{
+        \tl_clear:N\l_pbs_usenum_tl
+        \tl_if_blank:oTF{#1}{
+          \tl_set:Nx\l_pbs_usenum_tl{{pbs at obj\int_use:N\g_pbs_obj_int}}
+          \int_gincr:N\g_pbs_obj_int
         }{
-          \special{ps:~mark~/_objdef~\l_pbs_usenum_tl\space/type
-            \str_case:nn{#2}{
-              {dict}{/dict}
-              {array}{/array}
-              {stream}{/stream}
-              {fstream}{/stream}
-            }~
-            /OBJ~pdfmark
-          }
+          \tl_set:Nx\l_pbs_usenum_tl{#1}
         }
-        \str_case:nn{#2}{
-          {dict}{\special{ps:~mark~\l_pbs_usenum_tl~<<#3>>/PUT~pdfmark}}
-          {array}{
-            \special{ps:~mark~\l_pbs_usenum_tl~0~[#3]/PUTINTERVAL~pdfmark}
+        \tl_if_blank:oF{#3}{
+          \bool_if:nTF{
+            \g_pbs_pkgbigfiles_bool &&
+            \str_if_eq_p:nn{#2}{fstream}
+          }{
+            \iow_now:Nx\g_pbs_mstreams_stream{
+              M9D~begin~o\l_pbs_usenum_tl O
+            }
+          }{
+            \special{ps:~mark~/_objdef~\l_pbs_usenum_tl\space/type
+              \str_case:nn{#2}{
+                {dict}{/dict}
+                {array}{/array}
+                {stream}{/stream}
+                {fstream}{/stream}
+              }~
+              /OBJ~pdfmark
+            }
           }
-          {stream}{\special{ps::[nobreak]
-            ~mark~\l_pbs_usenum_tl~(\pbs_second_of_two:nn#3)/PUT~pdfmark~
-            ~mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>/PUT~pdfmark
-          }}
-          {fstream}{
-            \tl_set:Nn\l_pbs_offset_tl{0}
-            \tl_set:Nx\l_pbs_fsize_tl{\pbs_filesize:n{\pbs_second_of_two:nn#3}}
-            \message{<\pbs_second_of_two:nn#3}
-            %embed file in chunks of 32768 Bytes into PS as chunks of
-            %65536 Bytes of HEX code
-            \bool_while_do:nn{
-              \int_compare_p:n{\l_pbs_offset_tl<\l_pbs_fsize_tl}
-            }{
+          \str_case:nn{#2}{
+            {dict}{\special{ps:~mark~\l_pbs_usenum_tl~<<#3>>/PUT~pdfmark}}
+            {array}{
+              \special{ps:~mark~\l_pbs_usenum_tl~0~[#3]/PUTINTERVAL~pdfmark}
+            }
+            {stream}{\special{ps::[nobreak]
+              ~mark~\l_pbs_usenum_tl~(\pbs_second_of_two:nn#3)/PUT~pdfmark~
+              ~mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>/PUT~pdfmark
+            }}
+            {fstream}{
+              \tl_set:Nn\l_pbs_offset_tl{0}
+              \tl_set:Nx\l_pbs_fsize_tl{\pbs_filesize:n{\pbs_second_of_two:nn#3}}
+              \message{<\pbs_second_of_two:nn#3}
+              %embed file in chunks of 32768 Bytes into PS as chunks of
+              %65536 Bytes of HEX code
+              \bool_while_do:nn{
+                \int_compare_p:n{\l_pbs_offset_tl<\l_pbs_fsize_tl}
+              }{
+                \bool_if:NTF\g_pbs_pkgbigfiles_bool{
+                  \iow_now:Nx\g_pbs_mstreams_stream{
+                    m\l_pbs_usenum_tl
+                    (\pbs_filedump:nnn{\l_pbs_offset_tl}{32767}{
+                      \pbs_second_of_two:nn#3
+                    })P
+                  }
+                }{
+                  \special{ps:
+                    mark~
+                      \l_pbs_usenum_tl~
+                      (\pbs_filedump:nnn{\l_pbs_offset_tl}{32767}{
+                        \pbs_second_of_two:nn#3
+                      })~
+                      /ASCIIHexDecode~filter~/PUT~
+                    pdfmark
+                  }
+                }
+                \tl_set:Nx\l_pbs_offset_tl{\int_eval:n{\l_pbs_offset_tl+32767}}
+                \message{.}
+              }
               \bool_if:NTF\g_pbs_pkgbigfiles_bool{
                 \iow_now:Nx\g_pbs_mstreams_stream{
-                  m\l_pbs_usenum_tl
-                  (\pbs_filedump:nnn{\l_pbs_offset_tl}{32767}{
-                    \pbs_second_of_two:nn#3
-                  })P
+                  m\l_pbs_usenum_tl<<\pbs_first_of_two:nn#3>>PP~
+                  m\l_pbs_usenum_tl~C~end
                 }
               }{
                 \special{ps:
-                  mark~
-                    \l_pbs_usenum_tl~
-                    (\pbs_filedump:nnn{\l_pbs_offset_tl}{32767}{
-                      \pbs_second_of_two:nn#3
-                    })~
-                    /ASCIIHexDecode~filter~/PUT~
-                  pdfmark
+                  mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>~/PUT~pdfmark~
+                  mark~\l_pbs_usenum_tl~/CLOSE~pdfmark
                 }
               }
-              \tl_set:Nx\l_pbs_offset_tl{\int_eval:n{\l_pbs_offset_tl+32767}}
-              \message{.}
+              \message{>}
             }
-            \bool_if:NTF\g_pbs_pkgbigfiles_bool{
-              \iow_now:Nx\g_pbs_mstreams_stream{
-                m\l_pbs_usenum_tl<<\pbs_first_of_two:nn#3>>PP~
-                m\l_pbs_usenum_tl~C~end
-              }
-            }{
-              \special{ps:
-                mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>~/PUT~pdfmark~
-                mark~\l_pbs_usenum_tl~/CLOSE~pdfmark
-              }
-            }
-            \message{>}
           }
         }
+        \tl_gset_eq:NN\g_pbs_pdflastobj_tl\l_pbs_usenum_tl
       }
-      \tl_gset_eq:NN\g_pbs_pdflastobj_tl\l_pbs_usenum_tl
-    }
 
-    \cs_new_protected_nopar:Nn\pbs_pdfannot:nnnn{
-      \group_begin:
-        \dim_set:Nn\unitlength{1pt}
-        \begin{picture}(0,0)% mark annotation rectangle
-        \put(0,-\dim_to_decimal:n{#3}){
-          \special{ps:~currentpoint~/pbs at lly~exch~def~/pbs at llx~exch~def}
+      \cs_new_protected_nopar:Nn\pbs_pdfannot:nnnn{
+        \group_begin:
+          \dim_set:Nn\unitlength{1pt}
+          \begin{picture}(0,0)% mark annotation rectangle
+          \put(0,-\dim_to_decimal:n{#3}){
+            \special{ps:~currentpoint~/pbs at lly~exch~def~/pbs at llx~exch~def}
+          }
+          \put(\dim_to_decimal:n{#1},\dim_to_decimal:n{#2}){
+            \special{ps:~currentpoint~/pbs at ury~exch~def~/pbs at urx~exch~def}
+          }
+          \end{picture}
+        \group_end:
+        %dumb dummy Widget, workaround for AR bug;
+        %see https://forums.adobe.com/message/5787612#5787612
+        \str_if_eq_x:nnF{\cs_if_exist_use:N\ocgbase_insert_oc:}{}{
+          \special{ps:
+            mark~
+              /_objdef~{pbs at obj\int_use:N\g_pbs_obj_int}
+              /Rect~[pbs at llx~pbs at lly~pbs at urx~pbs at ury]
+              /Ff~65537/FT/Btn/Subtype/Widget
+            /ANN~pdfmark
+          }
+          \int_gincr:N\g_pbs_obj_int
         }
-        \put(\dim_to_decimal:n{#1},\dim_to_decimal:n{#2}){
-          \special{ps:~currentpoint~/pbs at ury~exch~def~/pbs at urx~exch~def}
+        %the actual annotation
+        \str_if_eq_x:nnF{#4}{}{
+          \special{ps:
+            mark~
+              /_objdef~{pbs at obj\int_use:N\g_pbs_obj_int}
+              /Rect~[pbs at llx~pbs at lly~pbs at urx~pbs at ury]
+              \cs_if_exist_use:N\ocgbase_insert_oc:~#4
+            /ANN~pdfmark
+          }
+          \tl_gset:Nx\g_pbs_pdflastann_tl{{pbs at obj\int_use:N\g_pbs_obj_int}}
+          \int_gincr:N\g_pbs_obj_int
         }
-        \end{picture}
-      \group_end:
-      %dumb dummy Widget, workaround for AR bug;
-      %see https://forums.adobe.com/message/5787612#5787612
-      \str_if_eq_x:nnF{\cs_if_exist_use:N\ocgbase_insert_oc:}{}{
-        \special{ps:
-          mark~
-            /_objdef~{pbs at obj\int_use:N\g_pbs_obj_int}
-            /Rect~[pbs at llx~pbs at lly~pbs at urx~pbs at ury]
-            /Ff~65537/FT/Btn/Subtype/Widget
-          /ANN~pdfmark
-        }
-        \int_gincr:N\g_pbs_obj_int
       }
-      %the actual annotation
-      \str_if_eq_x:nnF{#4}{}{
-        \special{ps:
-          mark~
-            /_objdef~{pbs at obj\int_use:N\g_pbs_obj_int}
-            /Rect~[pbs at llx~pbs at lly~pbs at urx~pbs at ury]
-            \cs_if_exist_use:N\ocgbase_insert_oc:~#4
-          /ANN~pdfmark
+
+      \cs_new_protected:Nn\pbs_pdflink:nn{
+        %dumb dummy Widget, workaround for AR bug;
+        %see https://forums.adobe.com/message/5787612#5787612
+        \pbs_pdfannot:nnnn{3pt}{3pt}{0pt}{}
+        \cs_if_exist:NTF\pdfmark{
+          \pdfmark[#2]{pdfmark=/ANN,Raw={
+            \cs_if_exist_use:N\ocgbase_insert_oc:~#1}}
+        }{
+          \hbox_set:Nn\l_tmpb_box{#2}
+          \pbs_pdfannot:nnnn{
+            \dim_use:N\box_wd:N\l_tmpb_box}{
+            \dim_use:N\box_ht:N\l_tmpb_box}{
+            \dim_use:N\box_dp:N\l_tmpb_box
+          }{#1}
+          \box_use_drop:N\l_tmpb_box
         }
-        \tl_gset:Nx\g_pbs_pdflastann_tl{{pbs at obj\int_use:N\g_pbs_obj_int}}
-        \int_gincr:N\g_pbs_obj_int
       }
-    }
 
-    \cs_new_protected:Nn\pbs_pdflink:nn{
-      %dumb dummy Widget, workaround for AR bug;
-      %see https://forums.adobe.com/message/5787612#5787612
-      \pbs_pdfannot:nnnn{3pt}{3pt}{0pt}{}
-      \cs_if_exist:NTF\pdfmark{
-        \pdfmark[#2]{pdfmark=/ANN,Raw={
-          \cs_if_exist_use:N\ocgbase_insert_oc:~#1}}
-      }{
-        \hbox_set:Nn\l_tmpb_box{#2}
-        \pbs_pdfannot:nnnn{
-          \dim_use:N\box_wd:N\l_tmpb_box}{
-          \dim_use:N\box_ht:N\l_tmpb_box}{
-          \dim_use:N\box_dp:N\l_tmpb_box
-        }{#1}
-        \box_use_drop:N\l_tmpb_box
+      \msg_set:nnn{pdfbase}{content~too~large}{
+        Line~\msg_line_number: :\\
+        Content~exceeds~paper~size~(width~and/or~height)\\
+        of~the~document~and~may~be~clipped~in~the~final\\
+        output.
       }
-    }
 
-    \msg_set:nnn{pdfbase}{content~too~large}{
-      Line~\msg_line_number: :\\
-      Content~exceeds~paper~size~(width~and/or~height)\\
-      of~the~document~and~may~be~clipped~in~the~final\\
-      output.
-    }
-
-    \cs_new_protected_nopar:Nn\pbs_pdfxform:nnnnn{ % #1, #3 not used (resources are
-      %this allows nesting \pbs_pdfxform:nnnnn{...}      %  managed by pdfmarks)
-      \special{ps:
-        gsave~
-        pbs at xform@level~0~eq~{/pbs at ctm@0~matrix~currentmatrix~def}~if~
-        pbs at ctm@0~setmatrix~
-        true~setglobal~
-        globaldict~/pbs at xform@level~pbs at xform@level~1~add~put~
-        false~setglobal
-      }
-      %rescale box to fit within the papersize while distilling
-      \tl_gset:cx{scale_{pbs at obj\int_use:N\g_pbs_obj_int}}{\fp_eval:n{min(1.0,
-        \dim_ratio:nn{\paperwidth}{\box_wd:N#5},
-        \dim_ratio:nn{\paperheight}{\box_ht:N#5+\box_dp:N#5}
-      )}}
-      \box_scale:Nnn#5{
-        \tl_use:c{scale_{pbs at obj\int_use:N\g_pbs_obj_int}}
-      }{
-        \tl_use:c{scale_{pbs at obj\int_use:N\g_pbs_obj_int}}
-      }
-      \group_begin:
-        %mark bbox of box#5
-        \dim_set:Nn\unitlength{1pt}
-        \begin{picture}(0,0)
-        \put(0,-\dim_to_decimal:n{\box_dp:N#5}){
-          \special{ps:
-            currentpoint~/pbs at lly~exch~def~/pbs at llx~exch~def
+      \cs_new_protected_nopar:Nn\pbs_pdfxform:nnnnn{ % #1, #3 not used (resources are
+        %this allows nesting \pbs_pdfxform:nnnnn{...}      %  managed by pdfmarks)
+        \special{ps:
+          gsave~
+          pbs at xform@level~0~eq~{/pbs at ctm@0~matrix~currentmatrix~def}~if~
+          pbs at ctm@0~setmatrix~
+          true~setglobal~
+          globaldict~/pbs at xform@level~pbs at xform@level~1~add~put~
+          false~setglobal
+        }
+        %rescale box to fit within the papersize while distilling
+        \tl_gset:cx{scale_{pbs at obj\int_use:N\g_pbs_obj_int}}{\fp_eval:n{min(1.0,
+          \dim_ratio:nn{\paperwidth}{\box_wd:N#5},
+          \dim_ratio:nn{\paperheight}{\box_ht:N#5+\box_dp:N#5}
+        )}}
+        \box_scale:Nnn#5{
+          \tl_use:c{scale_{pbs at obj\int_use:N\g_pbs_obj_int}}
+        }{
+          \tl_use:c{scale_{pbs at obj\int_use:N\g_pbs_obj_int}}
+        }
+        \group_begin:
+          %mark bbox of box#5
+          \dim_set:Nn\unitlength{1pt}
+          \begin{picture}(0,0)
+          \put(0,-\dim_to_decimal:n{\box_dp:N#5}){
+            \special{ps:
+              currentpoint~/pbs at lly~exch~def~/pbs at llx~exch~def
+            }
           }
+          \put(
+            \dim_to_decimal:n{\box_wd:N#5},
+            \dim_to_decimal:n{\box_ht:N#5}
+          ){
+            \special{ps:
+              currentpoint~/pbs at ury~exch~def~/pbs at urx~exch~def
+            }
+          }
+          \end{picture}
+        \group_end:
+        %additional dict entries
+        \tl_set:Nx\l_tmpa_tl{#4} \tl_trim_spaces:N\l_tmpa_tl
+        \special{ps:
+          gsave~
+          currentpoint~/pbs at cury~exch~def~/pbs at curx~exch~def~
+          %translate graphics to upper left page corner
+          \bool_if:nF{\g_pbs_powerdot_bool||\g_pbs_lscape_bool}{
+            {
+              pbs at llx~neg~pbs at ury~neg~translate~
+              Resolution~neg~VResolution~neg~translate %one inch left, one inch up
+            }?pdfmark~
+          }
+          %distill graphics into XObject
+          gsave~pbs at curx~pbs at cury~translate~ %move origin (0,0) to the current
+          mark~                              %position
+            /_objdef~{pbs at obj\int_use:N\g_pbs_obj_int}
+            /BBox~[
+              pbs at llx~pbs at curx~sub~pbs at lly~pbs at cury~sub~
+              pbs at urx~pbs at curx~sub~pbs at ury~pbs at cury~sub
+            ]
+            %insert additional dict entries (the Distiller way)
+            \str_if_eq_x:nnF{\l_tmpa_tl}{}{
+              product~(Distiller)~search~{pop~pop~pop~\l_tmpa_tl}{pop}ifelse
+            }
+          /BP~pdfmark~grestore~
+          \int_compare:nT{#2>\c_zero}{
+            %operations needed if used as annotation appearance
+            {
+              isls{%landscape mode (powerdot, geometry /w landscape option)
+                /pbs at dxdy~{
+                  pbs at urx~pbs at llx~sub~abs~
+                  pbs at ury~pbs at lly~sub~abs~div
+                }~bind~def
+                /pbs at dydx~{1~pbs at dxdy~div}~bind~def
+                /pbs at cx~{pbs at urx~pbs at llx~add~2~div}~bind~def
+                /pbs at cy~{pbs at ury~pbs at lly~add~2~div}~bind~def
+                %graphics needs to be rescaled for some reason ...
+                [pbs at dxdy~0~0~pbs at dydx~1~pbs at dxdy~sub~pbs at cx~mul~
+                  1~pbs at dydx~sub~pbs at cy~mul]~concat
+                %... rotated by 270 degrees ...
+                [0~-1~1~0~pbs at cx~pbs at cy~sub~pbs at cx~pbs at cy~add]~concat
+                %... and flipped around vertical axis
+                [-1~0~0~1~pbs at llx~pbs at urx~add~0]~concat
+              }{%flip around horizontal axis in portrait mode
+                [1~0~0~-1~0~pbs at lly~pbs at ury~add]~concat
+              }ifelse
+            }?pdfmark
+          }
         }
-        \put(
-          \dim_to_decimal:n{\box_wd:N#5},
-          \dim_to_decimal:n{\box_ht:N#5}
-        ){
+        \begin{picture}(0,0)\put(0,0){\box_use:N#5}\end{picture}
+        \special{ps:~mark~/EP~pdfmark~grestore}
+        %insert additional dict entries (the Ghostscript way)
+        \str_if_eq_x:nnF{\l_tmpa_tl}{}{
           \special{ps:
-            currentpoint~/pbs at ury~exch~def~/pbs at urx~exch~def
+            product~(Ghostscript)~search~{
+              pop~pop~pop~
+              mark~{pbs at obj\int_use:N\g_pbs_obj_int}~<<\l_tmpa_tl>>~/PUT~pdfmark
+            }{pop}ifelse
           }
         }
-        \end{picture}
-      \group_end:
-      %additional dict entries
-      \tl_set:Nx\l_tmpa_tl{#4} \tl_trim_spaces:N\l_tmpa_tl
-      \special{ps:
-        gsave~
-        currentpoint~/pbs at cury~exch~def~/pbs at curx~exch~def~
-        %translate graphics to upper left page corner
-        \bool_if:nF{\g_pbs_powerdot_bool||\g_pbs_lscape_bool}{
-          {
-            pbs at llx~neg~pbs at ury~neg~translate~
-            Resolution~neg~VResolution~neg~translate %one inch left, one inch up
-          }?pdfmark~
-        }
-        %distill graphics into XObject
-        gsave~pbs at curx~pbs at cury~translate~ %move origin (0,0) to the current
-        mark~                              %position
-          /_objdef~{pbs at obj\int_use:N\g_pbs_obj_int}
-          /BBox~[
-            pbs at llx~pbs at curx~sub~pbs at lly~pbs at cury~sub~
-            pbs at urx~pbs at curx~sub~pbs at ury~pbs at cury~sub
-          ]
-          %insert additional dict entries (the Distiller way)
-          \str_if_eq_x:nnF{\l_tmpa_tl}{}{
-            product~(Distiller)~search~{pop~pop~pop~\l_tmpa_tl}{pop}ifelse
+        \tl_gset:Nx\g_pbs_pdflastxform_tl{{pbs at obj\int_use:N\g_pbs_obj_int}}
+        \int_gincr:N\g_pbs_obj_int
+        \int_compare:nT{#2>\c_zero}{
+          %Form XObjects for use as annotation appearances require that
+          %dvips generated PostScript to be further processed with ps2pdf
+          %must not have the exaggerated dpi resolution resulting from dvips
+          %option `-Ppdf'.
+          \tl_if_exist:NF\g_pbs_dpiwarned_tl{
+            \tl_new:N\g_pbs_dpiwarned_tl
+            \pbs_at_end_dvi:n{\special{ps::[nobreak]\pbs_dpiwarning:}}
           }
-        /BP~pdfmark~grestore~
-        \int_compare:nT{#2>\c_zero}{
-          %operations needed if used as annotation appearance
-          {
-            isls{%landscape mode (powerdot, geometry /w landscape option)
-              /pbs at dxdy~{
-                pbs at urx~pbs at llx~sub~abs~
-                pbs at ury~pbs at lly~sub~abs~div
-              }~bind~def
-              /pbs at dydx~{1~pbs at dxdy~div}~bind~def
-              /pbs at cx~{pbs at urx~pbs at llx~add~2~div}~bind~def
-              /pbs at cy~{pbs at ury~pbs at lly~add~2~div}~bind~def
-              %graphics needs to be rescaled for some reason ...
-              [pbs at dxdy~0~0~pbs at dydx~1~pbs at dxdy~sub~pbs at cx~mul~
-                1~pbs at dydx~sub~pbs at cy~mul]~concat
-              %... rotated by 270 degrees ...
-              [0~-1~1~0~pbs at cx~pbs at cy~sub~pbs at cx~pbs at cy~add]~concat
-              %... and flipped around vertical axis
-              [-1~0~0~1~pbs at llx~pbs at urx~add~0]~concat
-            }{%flip around horizontal axis in portrait mode
-              [1~0~0~-1~0~pbs at lly~pbs at ury~add]~concat
-            }ifelse
-          }?pdfmark
         }
-      }
-      \begin{picture}(0,0)\put(0,0){\box_use:N#5}\end{picture}
-      \special{ps:~mark~/EP~pdfmark~grestore}
-      %insert additional dict entries (the Ghostscript way)
-      \str_if_eq_x:nnF{\l_tmpa_tl}{}{
         \special{ps:
-          product~(Ghostscript)~search~{
-            pop~pop~pop~
-            mark~{pbs at obj\int_use:N\g_pbs_obj_int}~<<\l_tmpa_tl>>~/PUT~pdfmark
-          }{pop}ifelse
+          true~setglobal~
+          globaldict~/pbs at xform@level~pbs at xform@level~1~sub~put~
+          false~setglobal~
+          grestore
         }
       }
-      \tl_gset:Nx\g_pbs_pdflastxform_tl{{pbs at obj\int_use:N\g_pbs_obj_int}}
-      \int_gincr:N\g_pbs_obj_int
-      \int_compare:nT{#2>\c_zero}{
-        %Form XObjects for use as annotation appearances require that
-        %dvips generated PostScript to be further processed with ps2pdf
-        %must not have the exaggerated dpi resolution resulting from dvips
-        %option `-Ppdf'.
-        \tl_if_exist:NF\g_pbs_dpiwarned_tl{
-          \tl_new:N\g_pbs_dpiwarned_tl
-          \pbs_at_end_dvi:n{\special{ps::[nobreak]\pbs_dpiwarning:}}
-        }
-      }
-      \special{ps:
-        true~setglobal~
-        globaldict~/pbs at xform@level~pbs at xform@level~1~sub~put~
-        false~setglobal~
-        grestore
-      }
-    }
 
-    \cs_new_protected_nopar:Nn\pbs_pdfrefxform:n{% #1: xform obj ID
-      %The /SP pdfmark for placement of Form XObjects works reliably only
-      %since gs-9.14. As gs-9.14 had some other TeX-related issues, we
-      %require 9.15.
-      \tl_if_exist:NF\g_pbs_gsoldwarned_tl{
-        \tl_new:N\g_pbs_gsoldwarned_tl
-        \pbs_at_end_dvi:n{\special{ps::[nobreak]\pbs_gsoldwarning:}}
-      }
-      \special{ps:
-        gsave~currentpoint~translate~1~\tl_use:c{scale_#1}~div~dup~scale~
-        mark~#1~/SP~pdfmark~grestore
-      }
-    }
-
-    \cs_new_protected_nopar:Nn\pbs_pdfximage:n{
-      \filename at parse{#1}
-      \tl_set:Nx\l_pbs_ext_tl{\tl_lower_case:n{\filename at ext}}
-      \bool_if:nTF{
-          \str_if_eq_p:Vn\l_pbs_ext_tl{ps}
-        ||\str_if_eq_p:Vn\l_pbs_ext_tl{eps}
-      }{
-        \special{ps:
-          mark~/_objdef~{pbs at obj\int_use:N\g_pbs_obj_int}~/NI~pdfmark
+      \cs_new_protected_nopar:Nn\pbs_pdfrefxform:n{% #1: xform obj ID
+        %The /SP pdfmark for placement of Form XObjects works reliably only
+        %since gs-9.14. As gs-9.14 had some other TeX-related issues, we
+        %require 9.15.
+        \tl_if_exist:NF\g_pbs_gsoldwarned_tl{
+          \tl_new:N\g_pbs_gsoldwarned_tl
+          \pbs_at_end_dvi:n{\special{ps::[nobreak]\pbs_gsoldwarning:}}
         }
-        \special{psfile=#1~hsize=0~vsize=0}
         \special{ps:
-          {
-            0~0~1~[1~0~0~1~0~0]~{}~image~%empty dummy, in case #1 is not
-          }?pdfmark                      %a valid raster image file
+          gsave~currentpoint~translate~1~\tl_use:c{scale_#1}~div~dup~scale~
+          mark~#1~/SP~pdfmark~grestore
         }
-        \tl_gset:Nx\g_pbs_pdflastximage_tl{{pbs at obj\int_use:N\g_pbs_obj_int}}
-        \int_gincr:N\g_pbs_obj_int
-      }{
-        \msg_error:nnxxx{pdfbase}{wrong~image~resource}{#1}{dvips}{
-          Postscript~(ps/eps)~with~bitmapped~content
+      }
+
+      \cs_new_protected_nopar:Nn\pbs_pdfximage:n{
+        \filename at parse{#1}
+        \tl_set:Nx\l_pbs_ext_tl{\tl_lower_case:n{\filename at ext}}
+        \bool_if:nTF{
+            \str_if_eq_p:Vn\l_pbs_ext_tl{ps}
+          ||\str_if_eq_p:Vn\l_pbs_ext_tl{eps}
+        }{
+          \special{ps:
+            mark~/_objdef~{pbs at obj\int_use:N\g_pbs_obj_int}~/NI~pdfmark
+          }
+          \special{psfile=#1~hsize=0~vsize=0}
+          \special{ps:
+            {
+              0~0~1~[1~0~0~1~0~0]~{}~image~%empty dummy, in case #1 is not
+            }?pdfmark                      %a valid raster image file
+          }
+          \tl_gset:Nx\g_pbs_pdflastximage_tl{{pbs at obj\int_use:N\g_pbs_obj_int}}
+          \int_gincr:N\g_pbs_obj_int
+        }{
+          \msg_error:nnxxx{pdfbase}{wrong~image~resource}{#1}{dvips}{
+            Postscript~(ps/eps)~with~bitmapped~content
+          }
         }
       }
-    }
 
-    \cs_new_protected_nopar:Nn\pbs_pdfcatalog:n{
-      \special{ps:~mark~{Catalog}~<<#1>>~/PUT~pdfmark}
-    }
+      \cs_new_protected_nopar:Nn\pbs_pdfcatalog:n{
+        \special{ps:~mark~{Catalog}~<<#1>>~/PUT~pdfmark}
+      }
 
-    %marked content BDC/EMC operators
-    %require Ghostscript v. >= 9.15
-    \cs_new_protected_nopar:Nn\pbs_pdfbdc:nn{
-      \special{ps:~mark~#1~#2~/BDC~pdfmark}
-      \tl_if_exist:NF\g_pbs_gsoldwarned_tl{
-        \tl_new:N\g_pbs_gsoldwarned_tl
-        \pbs_at_end_dvi:n{\special{ps::[nobreak]\pbs_gsoldwarning:}}
+      %marked content BDC/EMC operators
+      %require Ghostscript v. >= 9.15
+      \cs_new_protected_nopar:Nn\pbs_pdfbdc:nn{
+        \special{ps:~mark~#1~#2~/BDC~pdfmark}
+        \tl_if_exist:NF\g_pbs_gsoldwarned_tl{
+          \tl_new:N\g_pbs_gsoldwarned_tl
+          \pbs_at_end_dvi:n{\special{ps::[nobreak]\pbs_gsoldwarning:}}
+        }
       }
-    }
-    \cs_new_nopar:Nn\pbs_pdfemc:{\special{ps:~mark~/EMC~pdfmark}}
+      \cs_new_nopar:Nn\pbs_pdfemc:{\special{ps:~mark~/EMC~pdfmark}}
+    }  
   }
 }
 



More information about the tex-live-commits mailing list