diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/media9/pdfbase.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/media9/pdfbase.sty | 144 |
1 files changed, 90 insertions, 54 deletions
diff --git a/Master/texmf-dist/tex/latex/media9/pdfbase.sty b/Master/texmf-dist/tex/latex/media9/pdfbase.sty index 67ff708ad51..31b5e23deed 100644 --- a/Master/texmf-dist/tex/latex/media9/pdfbase.sty +++ b/Master/texmf-dist/tex/latex/media9/pdfbase.sty @@ -156,8 +156,8 @@ % % The Current Maintainer of this work is A. Grahn. -\def\g@pbs@date@tl{2022/08/04} -\def\g@pbs@version@tl{0.55} +\def\g@pbs@date@tl{2024/09/16} +\def\g@pbs@version@tl{0.59} \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesExplPackage{pdfbase}{\g@pbs@date@tl}{\g@pbs@version@tl} @@ -168,7 +168,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \msg_gset:nnnn{pdfbase}{unknown~package~option}{Unknown~package~option~`#1'.}{ - Package option~'#1'~is~unknown;\\ + Package~option~'#1'~is~unknown;\\ perhaps~it~is~spelled~incorrectly. } @@ -220,11 +220,11 @@ {dvipdfmx}{ \bool_gset_true:N\g_pbs_dvipdfmx_bool \bool_gset_false:N\g_pbs_dvisvgm_bool - } + } {dvisvgm}{ \bool_gset_false:N\g_pbs_dvipdfmx_bool \bool_gset_true:N\g_pbs_dvisvgm_bool - } + } }{ % otherwise let the L3 backend code decide \str_case_e:nn{\c_sys_backend_str}{ {dvisvgm}{ @@ -270,6 +270,12 @@ \seq_new:N\g_pbs_bop_seq \seq_new:N\g_pbs_eop_seq +% column (boc, eoc) hooks +\cs_new_protected:Nn\pbs_boc_action:n{\seq_gput_right:Nn\g_pbs_boc_seq{#1}} +\cs_new_protected:Nn\pbs_eoc_action:n{\seq_gput_right:Nn\g_pbs_eoc_seq{#1}} +\seq_new:N\g_pbs_boc_seq +\seq_new:N\g_pbs_eoc_seq + \bool_new:N\g_pbs_lscape_bool %if we are inside landscape env \bool_new:N\g_pbs_ocgbase_loaded_bool \AtBeginDocument{ @@ -1105,8 +1111,8 @@ \mode_leave_vertical: % resources 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}, - \dim_ratio:nn{\paperheight}{\box_ht:N#5+\box_dp:N#5} + \dim_ratio:nn{\paperwidth}{\box_wd:N#5}/\the\mag*1000, + \dim_ratio:nn{\paperheight}{\box_ht:N#5+\box_dp:N#5}/\the\mag*1000 )}} \box_scale:Nnn#5{ \tl_use:c{scale_{pbs@obj\int_use:N\g_pbs_obj_int}} @@ -1302,33 +1308,38 @@ \tl_gput_left:Nx\g_pbs_fields_tl{#1\space} } -%modify output routine for output box insertions -\bool_new:N\l_pbs_is_vertical_bool +% modify page output routine for inserting actions at begin and end \cs_set_eq:NN\pbs_outputpage_orig:\@outputpage \cs_set_protected_nopar:Npn\@outputpage{ \int_gincr:N\g_pbs_page_int - \box_if_vertical:cTF{@outputbox}{ - \bool_set_true:N\l_pbs_is_vertical_bool - }{ - \bool_set_false:N\l_pbs_is_vertical_bool - } - \hbox_set:Nn\@outputbox{ + \vbox_set:Nn\@outputbox{ %begin of page - \hbox_overlap_right:n{\seq_map_inline:Nn\g_pbs_bop_seq{##1}} + \seq_map_inline:Nn\g_pbs_bop_seq{##1} \box_use_drop:N\@outputbox %end of page - \hbox_overlap_right:n{\seq_map_inline:Nn\g_pbs_eop_seq{##1}} - } - \bool_if:NT\l_pbs_is_vertical_bool{ - \vbox_set:Nn\@outputbox{\box_use_drop:N\@outputbox} + \seq_map_inline:Nn\g_pbs_eop_seq{##1} } \pbs_outputpage_orig: } +% modify column making routine for inserting actions at begin and end +\cs_set_eq:NN\pbs_makecol_orig:\@makecol +\cs_set_protected_nopar:Npn\@makecol{ + \vbox_set:Nn\@cclv{ + %begin of column + \seq_map_inline:Nn\g_pbs_boc_seq{##1} + \vbox_unpack_drop:N\@cclv + %end of column + \seq_map_inline:Nn\g_pbs_eoc_seq{##1} + } + \pbs_makecol_orig: +} + \AddToHook{shipout/foreground}{ %insert /Properties into current page's resources \put(0,0){\pbs_insert_properties_entry:} } + \AddToHook{shipout/background}{ % workaround for curious AR bug (pdf annot or link placed on % OCG remains active although OCG is hidden) @@ -1336,8 +1347,15 @@ % somewhere on the page. \bool_if:NT\g_pbs_ocgbase_loaded_bool{ \put(1,-1){ + \tl_if_exist:NF\g_pbs_blank_xform_tl{ + \hbox_set:Nn\l_tmpa_box{\phantom{\rule{1pt}{1pt}}} + \pbs_pdfxform:nnnnn{0}{1}{}{}{\l_tmpa_box} + \tl_const:Ne\g_pbs_blank_xform_tl{\pbs_pdflastxform:} + } \pbs_pdfannot:nnnn{3bp}{\c_zero_dim}{3bp}{ - /Ff~65537/FT/Btn/Subtype/Widget + /Ff~65537/FT/Btn/Subtype/Widget/F~4 + /A~<</S/ResetForm>>% to make pdf.js happy + /AP~<</N~<</On~\g_pbs_blank_xform_tl>>>>/AS/On /T~(pbs@ARFix@\int_use:N\g_pbs_page_int) } } @@ -1435,8 +1453,8 @@ % `fstream', then % {stream attributes as PDF key-value dictionary}{file name} % -% if #3 && #1 are both empty, an object reference will be reserved for later -% use as #1 +% if #3 && #1 are both empty, an object reference will be reserved for +% later use as #1 % % \pbs_pdflastobj: % inserts object ID of PDF object created/processed during most recent call @@ -1471,9 +1489,9 @@ % -------- % % \pbs_pdfxform:nnnnn -% #1: add pgf/tikz resources (transparency, shading)? (0|1) %dvipdfmx/xetex +% #1: add pgf/tikz resources (transparency, shading)? (0|1); dvipdfmx/xetex % #2: write immediately to PDF? (0|1); eg 1 for appearances; pdftex/luatex -% #3: additional resources %all BUT dvips +% #3: additional resources; all BUT dvips % #4: additional dictionary entries % #5: savebox number % creates PDF Form XObject from savebox content @@ -1539,8 +1557,8 @@ % % The Current Maintainer of this work is A. Grahn. -\def\g@pbs@date@tl{2022/08/04} -\def\g@pbs@version@tl{0.55} +\def\g@pbs@date@tl{2024/09/16} +\def\g@pbs@version@tl{0.59} \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesExplPackage{pdfbase}{\g@pbs@date@tl}{\g@pbs@version@tl} @@ -1551,7 +1569,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \msg_gset:nnnn{pdfbase}{unknown~package~option}{Unknown~package~option~`#1'.}{ - Package option~'#1'~is~unknown;\\ + Package~option~'#1'~is~unknown;\\ perhaps~it~is~spelled~incorrectly. } @@ -1603,11 +1621,11 @@ {dvipdfmx}{ \bool_gset_true:N\g_pbs_dvipdfmx_bool \bool_gset_false:N\g_pbs_dvisvgm_bool - } + } {dvisvgm}{ \bool_gset_false:N\g_pbs_dvipdfmx_bool \bool_gset_true:N\g_pbs_dvisvgm_bool - } + } }{ % otherwise let the L3 backend code decide \str_case_e:nn{\c_sys_backend_str}{ {dvisvgm}{ @@ -1653,8 +1671,16 @@ \seq_new:N\g_pbs_bop_seq \seq_new:N\g_pbs_eop_seq -\bool_new:N\g_pbs_lscape_bool %if we are inside landscape env +% column (boc, eoc) hooks +\cs_new_protected:Nn\pbs_boc_action:n{\seq_gput_right:Nn\g_pbs_boc_seq{#1}} +\cs_new_protected:Nn\pbs_eoc_action:n{\seq_gput_right:Nn\g_pbs_eoc_seq{#1}} +\seq_new:N\g_pbs_boc_seq +\seq_new:N\g_pbs_eoc_seq + \bool_new:N\g_pbs_ocgbase_loaded_bool +\AddToHook{package/ocgbase/after}{\bool_gset_true:N\g_pbs_ocgbase_loaded_bool} + +\bool_new:N\g_pbs_lscape_bool %if we are inside landscape env \AtBeginDocument{ \iow_now:Nx\@mainaux{ \token_to_str:N\providecommand\token_to_str:N\pbs@newkey[2]{} @@ -1666,7 +1692,6 @@ \tl_put_right:Nn\landscape{\bool_gset_true:N\g_pbs_lscape_bool} \tl_put_left:Nn\endlandscape{\bool_gset_false:N\g_pbs_lscape_bool} } - \@ifpackageloaded{ocgbase}{\bool_gset_true:N\g_pbs_ocgbase_loaded_bool}{} } % writing to core objects in the PDF, using the new pdfmanagement interface @@ -1851,7 +1876,9 @@ \xsb_addto_props:n{/rm@oc\int_use:N\g_pbs_oc_int\space#2} \int_gincr:N\g_pbs_oc_int }{ - \pdf_bdcobject:nx{#1}{\tl_use:c{g_pbs_objname_#2_tl}} + \tl_if_exist:cT{g_pbs_objname_#2_tl}{ + \exp_args:Nne\pdf_bdcobject:nn{#1}{\tl_use:c{g_pbs_objname_#2_tl}} + } } } @@ -1868,9 +1895,7 @@ %pgf + transparency related settings \bool_new:N\g_pbs_pgfloaded_bool \bool_gset_false:N\g_pbs_pgfloaded_bool - \AtBeginDocument{ - \@ifpackageloaded{pgf}{\bool_gset_true:N\g_pbs_pgfloaded_bool}{} - } + \AddToHook{package/pgf/after}{\bool_gset_true:N\g_pbs_pgfloaded_bool} \int_new:N\g_pbs_obj_int %object ID \bool_if:NTF\g_pbs_dvipdfmx_bool{ %dvipdfmx/XeTeX \AtBeginDocument{ @@ -2042,7 +2067,9 @@ } \cs_new_protected_nopar:Nn\pbs_pdfbdc:nn{ - \pdf_bdcobject:nx{#1}{\tl_use:c{g_pbs_objname_#2_tl}} + \tl_if_exist:cT{g_pbs_objname_#2_tl}{ + \exp_args:Nne\pdf_bdcobject:nn{#1}{\tl_use:c{g_pbs_objname_#2_tl}} + } } }{ \bool_if:NTF\g_pbs_dvisvgm_bool{ @@ -2436,8 +2463,8 @@ \mode_leave_vertical: % resources 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}, - \dim_ratio:nn{\paperheight}{\box_ht:N#5+\box_dp:N#5} + \dim_ratio:nn{\paperwidth}{\box_wd:N#5}/\the\mag*1000, + \dim_ratio:nn{\paperheight}{\box_ht:N#5+\box_dp:N#5}/\the\mag*1000 )}} \box_scale:Nnn#5{ \tl_use:c{scale_{pbs@obj\int_use:N\g_pbs_obj_int}} @@ -2602,7 +2629,6 @@ } } } -\cs_generate_variant:Nn\pdf_bdcobject:nn{nx} \cs_new_eq:NN\pbs_pdfemc:\pdf_emc: \cs_new_nopar:Nn\pbs_pdflastobj:{\g_pbs_pdflastobj_tl} @@ -2610,29 +2636,33 @@ \cs_new_nopar:Nn\pbs_pdflastxform:{\g_pbs_pdflastxform_tl} \cs_new_nopar:Nn\pbs_pdflastximage:{\g_pbs_pdflastximage_tl} -%modify output routine for output box insertions -\bool_new:N\l_pbs_is_vertical_bool +% modify page output routine for inserting actions at begin and end \cs_set_eq:NN\pbs_outputpage_orig:\@outputpage \cs_set_protected_nopar:Npn\@outputpage{ \int_gincr:N\g_pbs_page_int - \box_if_vertical:cTF{@outputbox}{ - \bool_set_true:N\l_pbs_is_vertical_bool - }{ - \bool_set_false:N\l_pbs_is_vertical_bool - } - \hbox_set:Nn\@outputbox{ + \vbox_set:Nn\@outputbox{ %begin of page - \hbox_overlap_right:n{\seq_map_inline:Nn\g_pbs_bop_seq{##1}} + \seq_map_inline:Nn\g_pbs_bop_seq{##1} \box_use_drop:N\@outputbox %end of page - \hbox_overlap_right:n{\seq_map_inline:Nn\g_pbs_eop_seq{##1}} - } - \bool_if:NT\l_pbs_is_vertical_bool{ - \vbox_set:Nn\@outputbox{\box_use_drop:N\@outputbox} + \seq_map_inline:Nn\g_pbs_eop_seq{##1} } \pbs_outputpage_orig: } +% modify column making routine for inserting actions at begin and end +\cs_set_eq:NN\pbs_makecol_orig:\@makecol +\cs_set_protected_nopar:Npn\@makecol{ + \vbox_set:Nn\@cclv{ + %begin of column + \seq_map_inline:Nn\g_pbs_boc_seq{##1} + \vbox_unpack_drop:N\@cclv + %end of column + \seq_map_inline:Nn\g_pbs_eoc_seq{##1} + } + \pbs_makecol_orig: +} + \AddToHook{shipout/background}{ % workaround for curious AR bug (pdf annot or link placed on % OCG remains active although OCG is hidden) @@ -2640,8 +2670,14 @@ % somewhere on the page. \bool_if:NT\g_pbs_ocgbase_loaded_bool{ \put(1,-1){ + \tl_if_exist:NF\g_pbs_blank_xform_tl{ + \hbox_set:Nn\l_tmpa_box{\phantom{\rule{1pt}{1pt}}} + \pbs_pdfxform:nnnnn{0}{1}{}{}{\l_tmpa_box} + \tl_const:Ne\g_pbs_blank_xform_tl{\pbs_pdflastxform:} + } \pbs_pdfannot:nnnn{3bp}{\c_zero_dim}{3bp}{ - /Ff~65537/FT/Btn/Subtype/Widget + /Ff~65537/FT/Btn/Subtype/Widget/F~4 + /AP~<</N~<</On~\g_pbs_blank_xform_tl>>>>/AS/On /T~(pbs@ARFix@\int_use:N\g_pbs_page_int) } } |