diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty | 81 |
1 files changed, 69 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty b/Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty index 4b14960d8e2..b32eac928c5 100644 --- a/Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty +++ b/Master/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanagement-firstaid.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: pdfmanagement-firstaid.dtx -\ProvidesExplPackage{pdfmanagement-firstaid}{2023-10-09}{0.96a} +\ProvidesExplPackage{pdfmanagement-firstaid}{2023-11-05}{0.96b} {LaTeX PDF management testphase bundle / firstaid-patches} \clist_map_inline:nn @@ -51,15 +51,72 @@ { \bool_if:NT \g__pdfmanagement_firstaid_fontspec_bool { - \@ifpackagelater{fontspec}{2023-03-10} + \AddToHook{package/fontspec/after} { - \__fontspec_keys_define_code:nnn {fontspec} {Color} - { - \tl_set:Nn \l__fontspec_hexcol_tl {#1} - } - }{} + \@ifpackagelater{fontspec}{2023-11-05} + {\typeout{PDF~Management:~fontspec~firstaid~ignored}} + { + \def\c__fontspec_opacity_tl{} + \__fontspec_keys_define_code:nnn {fontspec} {Color} + { + \color_if_exist:nTF {#1} + { + \tl_set:Nn \l__fontspec_hexcol_tl {#1} + } + { + \cs_if_exist:cTF { \token_to_str:N \color@ #1 } + { + \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl + } + { + \int_compare:nTF { \tl_count:n {#1} == 6 } + { \tl_set:Nn \l__fontspec_hexcol_tl {#1} } + { + \int_compare:nTF { \tl_count:n {#1} == 8 } + { \fontspec_parse_colour:viii #1 } + { + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {bad-colour} {#1} } + } + } + } + } + } + \__fontspec_keys_define_code:nnn {fontspec} {Opacity} + { + \int_set:Nn \l__fontspec_tmp_int {255} + \__fontspec_int_mult_truncate:Nn \l__fontspec_tmp_int { #1 } + \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl + { + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice} {#1} } + } + \tl_set:Nx \l__fontspec_opacity_tl + { + , + \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad + \int_to_hex:n { \l__fontspec_tmp_int } + } + } + \cs_set:Nn \__fontspec_get_features:n + { + \__fontspec_init_fontface: + \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#1} + \l__fontspec_keys_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist + \keys_set:nV {fontspec-opentype} \l__fontspec_keys_leftover_clist + + \tl_if_empty:NF \l__fontspec_mapping_tl + { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } } + + \str_if_eq:eeF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } + { \c__fontspec_hexcol_tl \c__fontspec_opacity_tl } + { \__fontspec_update_featstr:n { color = {\l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } } + } + } } } + } \bool_if:NT \g__pdfmanagement_firstaid_color_bool { @@ -183,21 +240,21 @@ } \cs_generate_variant:Nn \tl_trim_spaces:n{V} -\cs_generate_variant:Nn \pdfmanagement_add:nnn {nex} +\cs_generate_variant:Nn \pdfmanagement_add:nnn {nee} \cs_new:Npn \__pdfmanagement_patch_pgfextgs:w #1/#2<<#3>>#4\q_stop { - \tl_set:Nx\l_tmpa_tl{#2} - \pdfmanagement_add:nex + \tl_set:Ne\l_tmpa_tl{#2} + \pdfmanagement_add:nee {Page/Resources/ExtGState}{\tl_trim_spaces:V\l_tmpa_tl}{<<#3 #4>>} } \cs_new:Npn \__pdfmanagement_patch_pgfpatterns:w #1/#2\space#3\q_stop { - \pdfmanagement_add:nex + \pdfmanagement_add:nee {Page/Resources/Pattern}{\tl_trim_spaces:n{#2}}{#3} } \cs_new:Npn \__pdfmanagement_patch_pgfcolorspaces:w #1/#2[#3]#4\q_stop { - \pdfmanagement_add:nex + \pdfmanagement_add:nee {Page/Resources/ColorSpace}{\tl_trim_spaces:n{#2}}{[#3]} } |