From 026bcd88f082ea4bb3f2ddbac395339309f00a63 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Fri, 11 Sep 2020 03:02:42 +0000
Subject: CTAN sync 202009110302

---
 macros/latex/contrib/media9/pdfbase.sty | 137 ++++++++++++++++----------------
 1 file changed, 70 insertions(+), 67 deletions(-)

(limited to 'macros/latex/contrib/media9/pdfbase.sty')

diff --git a/macros/latex/contrib/media9/pdfbase.sty b/macros/latex/contrib/media9/pdfbase.sty
index 9da881bd6d..6e86b60bf8 100644
--- a/macros/latex/contrib/media9/pdfbase.sty
+++ b/macros/latex/contrib/media9/pdfbase.sty
@@ -159,8 +159,8 @@
 \RequirePackage{expl3}
 \RequirePackage{l3keys2e}
 
-\def\g@pbs@date@tl{2020/07/08}
-\def\g@pbs@version@tl{0.43}
+\def\g@pbs@date@tl{2020/09/10}
+\def\g@pbs@version@tl{0.44}
 
 \ProvidesExplPackage{pdfbase}{\g@pbs@date@tl}{\g@pbs@version@tl}
 {driver independent access to low-level PDF features}
@@ -429,7 +429,10 @@
   }
 
   \cs_new_protected_nopar:Nn\pbs_pdfrefxform:n{% #1: xform obj ID
-    \hbox_overlap_right:n{\smash{\pdfrefxform\pbs_reftonum:n{#1}}}
+    \hbox_set:Nn\l_tmpa_box{\pdfrefxform\pbs_reftonum:n{#1}}
+    \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
+    \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
+    \box_set_dp:Nn\l_tmpa_box{\c_zero_dim}\box_use_drop:N\l_tmpa_box
   }
 
   \cs_new_protected_nopar:Nn\pbs_pdfximage:n{
@@ -638,8 +641,8 @@
     }
 
     \cs_new_protected_nopar:Nn\pbs_pdfxform:nnnnn{ % #2 not used
-      \begin{picture}(0,0)
-        \put(0,0){
+      \group_begin:
+        \hbox_set:Nn\l_tmpa_box{
           \special{pdf:bxobj~@pbs@obj\int_use:N\g_pbs_obj_int\space
             width~\dim_eval:n{\box_wd:N#5}~
             height~\space\dim_eval:n{\box_ht:N#5}~
@@ -671,7 +674,10 @@
             \str_if_eq:eeF{\l_tmpa_tl}{}{<<\l_tmpa_tl>>}
           }
         }
-      \end{picture}
+        \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
+        \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
+        \box_set_dp:Nn\l_tmpa_box{\c_zero_dim}\box_use_drop:N\l_tmpa_box
+      \group_end:
       \tl_gset:Nx\g_pbs_pdflastxform_tl{@pbs@obj\int_use:N\g_pbs_obj_int}
       \int_gincr:N\g_pbs_obj_int
     }
@@ -712,7 +718,7 @@
       \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
-        \str_if_eq:nnTF{#1}{}{                   % #2: raw Postscript     `page'
+        \str_if_eq:nnTF{#1}{}{                   % #2: raw Postscript   | `page'
           % 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
@@ -726,28 +732,34 @@
 
       \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'}
+        \group_begin:
+          \hbox_set:Nn\l_tmpa_box{
+            \box_move_down:nn{#3}{\hbox_to_zero:n{% ll
+              \special{dvisvgm:raw~'M{?x}~{?y}}
+            }}
+            \hbox_to_zero:n{
+              \skip_horizontal:n{#1}
+              \box_move_down:nn{#3}{\hbox_to_zero:n{% lr
+                \special{dvisvgm:raw~L{?x}~{?y}}
+              }}
+              \box_move_up:nn{#2}{\hbox_to_zero:n{% ur
+                \special{dvisvgm:raw~L{?x}~{?y}}
+              }}\hss
+            }
+            \box_move_up:nn{#2}{\hbox_to_zero:n{% ul
+              \special{dvisvgm:raw~L{?x}~{?y}Z'}
+            }}
           }
-        \end{picture}
+          \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
+          \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
+          \box_set_dp:Nn\l_tmpa_box{\c_zero_dim}\box_use_drop:N\l_tmpa_box
         \group_end:
         \special{dvisvgm:raw~{?nl}opacity='0'~#4~class='annot'/>}
       }
 
       \cs_new_protected_nopar:Nn\pbs_pdfxform:nnnnn{
-        \makebox[\c_zero_dim][l]{
-          \raisebox{\c_zero_dim}[\c_zero_dim][\c_zero_dim]{
+        \group_begin:
+          \hbox_set:Nn\l_tmpa_box{
             \special{dvisvgm:raw~{?nl}<defs>{?nl}
               <g~
                 transform='translate({?(-(x))},{?(-(y))})'~#4~
@@ -759,7 +771,10 @@
             \special{dvisvgm:bbox~unlock}
             \special{dvisvgm:raw~{?nl}</g>{?nl}</defs>}
           }
-        }
+          \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
+          \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
+          \box_set_dp:Nn\l_tmpa_box{\c_zero_dim}\box_use_drop:N\l_tmpa_box
+        \group_end:
         \tl_gset:Nx\g_pbs_pdflastxform_tl{
           \g_pbs_hash_tl pbs@obj\int_use:N\g_pbs_obj_int}
         \int_gincr:N\g_pbs_obj_int
@@ -795,9 +810,6 @@
           }
         }
         \special{!~
-          %keeping track of xform nesting level
-          true~setglobal~globaldict~/pbs@xform@level~0~put~false~setglobal
-          %
           %back-transforms user coords to page coords (bigpoints with reference
           %point [0,0] in the bottom-left page corner)
           % user_x user_y pbs@user2page --> page_x page_y
@@ -944,15 +956,21 @@
 
       \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}){
-            \pbs_special:n{currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def}
-          }
-          \put(\dim_to_decimal:n{#1},\dim_to_decimal:n{#2}){
-            \pbs_special:n{currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def}
+          % mark annotation rectangle
+          \hbox_set:Nn\l_tmpa_box{
+            % lower left
+            \box_move_down:nn{#3}{\hbox_to_zero:n{\pbs_special:n{
+              currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def
+            }}}
+            \skip_horizontal:n{#1}
+            % upper right
+            \box_move_up:nn{#2}{\hbox_to_zero:n{\pbs_special:n{
+              currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def
+            }}}
           }
-          \end{picture}
+          \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
+          \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
+          \box_set_dp:Nn\l_tmpa_box{\c_zero_dim}\box_use_drop:N\l_tmpa_box
         \group_end:
         \str_if_eq:eeF{#4}{}{
           \pbs_special:n{
@@ -1086,15 +1104,7 @@
       }
 
       \cs_new_protected_nopar:Nn\pbs_pdfxform:nnnnn{ % #1, #3 not used (resources
-        %this allows nesting \pbs_pdfxform:nnnnn{...}       % are  managed
-        \pbs_special:n{                                     % automaticlly)
-          gsave~
-          pbs@xform@level~0~eq~{/pbs@ctm@0~matrix~currentmatrix~def}~if~
-          pbs@ctm@0~setmatrix~
-          true~setglobal~
-          globaldict~/pbs@xform@level~pbs@xform@level~1~add~put~
-          false~setglobal
-        }
+                                                     % are  managed automatically)
         %rescale box to fit within the papersize while distilling
         \tl_gset:cx{scale_{pbs@obj\int_use:N\g_pbs_obj_int}}{\fp_eval:n{min(1.0,
           \dim_ratio:nn{\paperwidth}{\box_wd:N#5},
@@ -1107,22 +1117,20 @@
         }
         \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}){
-            \pbs_special:n{
+          \hbox_set:Nn\l_tmpa_box{
+            % lower left
+            \box_move_down:nn{\box_dp:N#5}{\hbox_to_zero:n{\pbs_special:n{
               currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def
-            }
-          }
-          \put(
-            \dim_to_decimal:n{\box_wd:N#5},
-            \dim_to_decimal:n{\box_ht:N#5}
-          ){
-            \pbs_special:n{
+            }}}
+            \skip_horizontal:n{\box_wd:N#5}
+            % upper right
+            \box_move_up:nn{\box_ht:N#5}{\hbox_to_zero:n{\pbs_special:n{
               currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def
-            }
+            }}}
           }
-          \end{picture}
+          \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
+          \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
+          \box_set_dp:Nn\l_tmpa_box{\c_zero_dim}\box_use_drop:N\l_tmpa_box
         \group_end:
         %additional dict entries
         \tl_set:Nx\l_tmpa_tl{#4} \tl_trim_spaces:N\l_tmpa_tl
@@ -1176,7 +1184,9 @@
             }?pdfmark
           }
         }
-        \begin{picture}(0,0)\put(0,0){\box_use:N#5}\end{picture}
+        \box_set_wd:Nn#5{\c_zero_dim}
+        \box_set_ht:Nn#5{\c_zero_dim}
+        \box_set_dp:Nn#5{\c_zero_dim}\box_use_drop:N#5
         \pbs_special:n{~mark~/EP~pdfmark~grestore}
         %insert additional dict entries (the Ghostscript way)
         \str_if_eq:eeF{\l_tmpa_tl}{}{
@@ -1201,12 +1211,6 @@
             }
           }
         }
-        \pbs_special:n{
-          true~setglobal~
-          globaldict~/pbs@xform@level~pbs@xform@level~1~sub~put~
-          false~setglobal~
-          grestore
-        }
       }
 
       \cs_new_protected_nopar:Nn\pbs_pdfrefxform:n{% #1: xform obj ID
@@ -1343,13 +1347,12 @@
       % This can be fixed by placing a dumb (non-interactive) Widget dummy
       % somewhere on the page.
       \bool_if:NT\g_pbs_ocgbase_loaded_bool{
-        \skip_horizontal:n{1bp}
-        \box_move_down:nn{1bp}{\vbox:n{
+        \put(1,-1){
           \pbs_pdfannot:nnnn{3bp}{\c_zero_dim}{3bp}{
             /Ff~65537/FT/Btn/Subtype/Widget
             /T~(pbs@ARFix@\int_use:N\g_pbs_page_int)
           }
-        }}
+        }
       }
     }
   }
-- 
cgit v1.2.3

