diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/xsavebox')
-rw-r--r-- | Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty | 78 |
1 files changed, 59 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty b/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty index 21bc7116136..8114fbff442 100644 --- a/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty +++ b/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty @@ -45,12 +45,18 @@ % % The Current Maintainer of this work is A. Grahn. +%process non-detectable dvipdfmx driver for passing to expl3 +\RequirePackage{xkeyval} +\DeclareOptionX{dvipdfmx}{% + \PassOptionsToPackage{driver=dvipdfmx}{expl3} +} +\DeclareOptionX*{}\ProcessOptionsX*\relax %allow anything as an option + \RequirePackage{xparse} -\RequirePackage{pdfbase} %everything with `pbs_' prefix \RequirePackage{l3keys2e} -\def\g@xsb@version@tl{0.12} -\def\g@xsb@date@tl{2018/07/09} +\def\g@xsb@version@tl{0.13} +\def\g@xsb@date@tl{2019/06/24} \ProvidesExplPackage{xsavebox}{\g@xsb@date@tl}{\g@xsb@version@tl} {saveboxes for repeating content without code replication} @@ -60,10 +66,6 @@ Please~install~an~up~to~date~version~of~`#1'.\\ Loading~xsavebox~will~abort! } -\@ifpackagelater{pdfbase}{2017/03/23}{}{ - \msg_error:nnn{xsavebox}{support~outdated}{pdfbase.sty} - \tex_endinput:D -} %re-run message \msg_set:nnn{xsavebox}{rerun}{Rerun~to~get~internal~references~right!} @@ -81,6 +83,7 @@ } %package options +\bool_new:N\g_xsb_dvisvgm_bool %`dvisvgm' driver option \tl_gset:Nn\g_xsb_margin_tl{3pt} \keys_define:nn{xsavebox}{ margin .code:n = { @@ -88,13 +91,49 @@ \tl_gset:Nx\g_xsb_margin_tl{\dim_use:N\l_tmpa_dim} }, + xetex .code:n = {}, %dummy, we use engine test instead + + dvipdfmx .choice:, + dvipdfmx / true .code:n = { + \bool_gset_false:N\g_xsb_dvisvgm_bool + \PassOptionsToPackage{dvipdfmx}{pdfbase} + }, + dvipdfmx / false .code:n = {}, + dvipdfmx .default:n = {true}, + + dvisvgm .choice:, + dvisvgm / true .code:n = { + \bool_gset_true:N\g_xsb_dvisvgm_bool + \PassOptionsToPackage{dvisvgm}{pdfbase} + }, + dvisvgm / false .code:n = {\bool_gset_false:N\g_xsb_dvisvgm_bool}, + dvisvgm .default:n = {true}, + unknown .code:n = { \msg_error:nnx{xsavebox}{unknown~package~option}{\l_keys_key_tl} } } - \ProcessKeysOptions{xsavebox} +\sys_if_output_pdf:T{\bool_gset_false:N\g_xsb_dvisvgm_bool} + +\RequirePackage{pdfbase} +\@ifpackagelater{pdfbase}{2017/03/23}{}{ + \msg_error:nnn{xsavebox}{support~outdated}{pdfbase.sty} + \tex_endinput:D +} +\cs_gset_eq:NN\xsb@newkey\pbs@newkey +\cs_gset_eq:NN\xsb_pdfxform:nnnnn\pbs_pdfxform:nnnnn +\cs_gset_eq:NN\xsb_pdflastxform:\pbs_pdflastxform: +\cs_gset_eq:NN\xsb_pdfrefxform:n\pbs_pdfrefxform:n + +\bool_if:NTF\g_xsb_dvisvgm_bool{ + \tl_gset:Nn\g_xsb_margin_tl{0pt} + \cs_new_protected_nopar:Nn\xsb_updatebbox:nnn{\special{dvisvgm:bbox~#1~#2~#3}} +}{ + \cs_new_protected_nopar:Nn\xsb_updatebbox:nnn{} +} + \int_new:N\g_xsb_id_int %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -140,7 +179,7 @@ } %process one of \l_xsb_raw_box or \l_xsb_box \dim_compare:nTF{\box_wd:N\l_xsb_raw_box>\box_wd:N\l_xsb_box}{ - \str_if_eq_x:nnTF{#4}{s}{ + \str_if_eq:eeTF{#4}{s}{ %sqeezing content correctly \IfBooleanTF{#1}{ %for colour injection @@ -208,7 +247,7 @@ \cs_new_protected_nopar:Nn\xsb_endxlrbox:n{ \unskip \group_end:\hbox_set_end: - \sbox\l_xsb_box{\hbox_unpack_clear:N\l_xsb_box} + \sbox\l_xsb_box{\hbox_unpack_drop:N\l_xsb_box} \xsb_process_box:nnnN{#1}{\width}{c}\l_xsb_box \xsb_endLTR: \group_end: @@ -245,7 +284,7 @@ %temporarily (for distilling) push the box bounds somewhat; glyphs tend to %be bigger than their bounding boxes \hbox_set_to_wd:Nnn#4{\width+\g_xsb_margin_tl+\g_xsb_margin_tl}{ - \hss\hbox_unpack_clear:N#4\hss + \hss\hbox_unpack_drop:N#4\hss } \box_set_ht:Nn#4{\height+\g_xsb_margin_tl} \box_set_dp:Nn#4{\depth+\g_xsb_margin_tl} @@ -260,33 +299,34 @@ \xsb_pop_props_to:N\l_tmpa_tl %distill box to Form XObject, if used (ref'ed) \bool_if:cT{c_\tl_use:c{xsb@\int_use:N\g_xsb_id_int}_bool}{ - \pbs_pdfxform:nnnnn{1}{0}{\l_tmpa_tl}{ + \xsb_pdfxform:nnnnn{1}{0}{\l_tmpa_tl}{ \cs_if_exist_use:N\ocgbase_insert_oc:}{#4} } %for tracking box usage \iow_now:Nx\@mainaux{ - \token_to_str:N\pbs@newkey{xsb@\int_use:N\g_xsb_id_int}{false} + \token_to_str:N\xsb@newkey{xsb@\int_use:N\g_xsb_id_int}{false} } %define command for inserting the m-boxed XObject reference \cs_gset_protected:cpx{the#1}{ \exp_not:N\tl_if_exist:cF{xsb_\int_use:N\g_xsb_id_int}{ %mark box as `used' \exp_not:N\iow_now:Nx\@mainaux{ - \token_to_str:N\pbs@newkey{xsb@\int_use:N\g_xsb_id_int}{true} + \token_to_str:N\xsb@newkey{xsb@\int_use:N\g_xsb_id_int}{true} } \exp_not:N\tl_new:c{xsb_\int_use:N\g_xsb_id_int} - } + } \exp_not:N\bool_if:cF{c_\tl_use:c{xsb@\int_use:N\g_xsb_id_int}_bool}{ \exp_not:N\xsb_rerun_msg: } \exp_not:N\xsb_beginLTR: + \xsb_updatebbox:nnn{\l_xsb_new_wd_tl}{\l_xsb_ht_tl}{\l_xsb_dp_tl} \exp_not:N\makebox[\l_xsb_new_wd_tl][#3]{ \exp_not:N\hbox_to_wd:nn{\l_xsb_wd_tl}{ \exp_not:N\vrule~width~\c_zero_dim~height~\l_xsb_ht_tl~ depth~\l_xsb_dp_tl \exp_not:N\skip_horizontal:n{-\g_xsb_margin_tl} \bool_if:cT{c_\tl_use:c{xsb@\int_use:N\g_xsb_id_int}_bool}{ - \exp_not:N\pbs_pdfrefxform:n{\pbs_pdflastxform:} + \exp_not:N\xsb_pdfrefxform:n{\xsb_pdflastxform:} } \hss } @@ -302,12 +342,12 @@ %environment for setting LTR typesetting direction with e-TeX based engines \cs_new_protected:Nn\xsb_beginLTR:{ \cs_if_exist:NT\TeXXeTstate{ - \int_compare:nT{\TeXXeTstate>\c_zero}{\beginL} + \int_compare:nT{\TeXXeTstate>\c_zero_int}{\beginL} } } \cs_new_protected:Nn\xsb_endLTR:{ \cs_if_exist:NT\TeXXeTstate{ - \int_compare:nT{\TeXXeTstate>\c_zero}{\endL} + \int_compare:nT{\TeXXeTstate>\c_zero_int}{\endL} } } @@ -326,7 +366,7 @@ \cs_new_protected:Nn\xsb_pop_props_to:N{ \seq_gpop:NNT\g_xsb_props_seq\l_tmpa_tl{ \tl_trim_spaces:N\l_tmpa_tl - \str_if_eq_x:nnF{\l_tmpa_tl}{}{\tl_set:Nx#1{/Properties<<\l_tmpa_tl>>}} + \str_if_eq:eeF{\l_tmpa_tl}{}{\tl_set:Nx#1{/Properties<<\l_tmpa_tl>>}} } } |