diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def | 438 |
1 files changed, 280 insertions, 158 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def b/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def index 8ce7bcf5e52..1f1d6f61676 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def @@ -5,6 +5,12 @@ %% The original source files were: %% %% l3drivers.dtx (with options: `package,pdfmode') +%% l3drivers-basics.dtx (with options: `package,pdfmode') +%% l3drivers-color.dtx (with options: `package,pdfmode') +%% l3drivers-box.dtx (with options: `package,pdfmode') +%% l3drivers-draw.dtx (with options: `package,pdfmode') +%% l3drivers-image.dtx (with options: `package,pdfmode') +%% l3drivers-pdf.dtx (with options: `package,pdfmode') %% %% Copyright (C) 1990-2019 The LaTeX3 Project %% @@ -19,6 +25,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3drivers.dtx +%% File: l3drivers-basics.dtx \ProvidesExplFile {l3pdfmode.def}{2019-04-06}{} {L3 Experimental driver: PDF mode} @@ -26,6 +33,35 @@ \cs_new_protected:Npn \__driver_literal:n #1 { \__driver_literal:e { \exp_not:n {#1} } } \cs_generate_variant:Nn \__driver_literal:n { x } +\cs_new_protected:Npx \__driver_literal_pdf:n #1 + { + \cs_if_exist:NTF \tex_pdfextension:D + { \tex_pdfextension:D literal } + { \tex_pdfliteral:D } + { \exp_not:N \exp_not:n {#1} } + } +\cs_generate_variant:Nn \__driver_literal_pdf:n { x } +\cs_new_protected:Npx \__driver_scope_begin: + { + \cs_if_exist:NTF \tex_pdfextension:D + { \tex_pdfextension:D save \scan_stop: } + { \tex_pdfsave:D } + } +\cs_new_protected:Npx \__driver_scope_end: + { + \cs_if_exist:NTF \tex_pdfextension:D + { \tex_pdfextension:D restore \scan_stop: } + { \tex_pdfrestore:D } + } +\cs_new_protected:Npx \__driver_matrix:n #1 + { + \cs_if_exist:NTF \tex_pdfextension:D + { \tex_pdfextension:D setmatrix } + { \tex_pdfsetmatrix:D } + { \exp_not:N \exp_not:n {#1} } + } +\cs_generate_variant:Nn \__driver_matrix:n { x } +%% File: l3drivers-color.dtx \cs_new_protected:Npn \driver_color_pickup:N #1 { } \AtBeginDocument { @@ -113,34 +149,7 @@ { \tex_pdfcolorstack:D } \exp_not:N \l__driver_color_stack_int pop \scan_stop: } -\cs_new_protected:Npx \__driver_literal_pdf:n #1 - { - \cs_if_exist:NTF \tex_pdfextension:D - { \tex_pdfextension:D literal } - { \tex_pdfliteral:D } - { \exp_not:N \exp_not:n {#1} } - } -\cs_generate_variant:Nn \__driver_literal_pdf:n { x } -\cs_new_protected:Npx \__driver_scope_begin: - { - \cs_if_exist:NTF \tex_pdfextension:D - { \tex_pdfextension:D save \scan_stop: } - { \tex_pdfsave:D } - } -\cs_new_protected:Npx \__driver_scope_end: - { - \cs_if_exist:NTF \tex_pdfextension:D - { \tex_pdfextension:D restore \scan_stop: } - { \tex_pdfrestore:D } - } -\cs_new_protected:Npx \__driver_matrix:n #1 - { - \cs_if_exist:NTF \tex_pdfextension:D - { \tex_pdfextension:D setmatrix } - { \tex_pdfsetmatrix:D } - { \exp_not:N \exp_not:n {#1} } - } -\cs_generate_variant:Nn \__driver_matrix:n { x } +%% File: l3drivers-box.dtx \cs_new_protected:Npn \driver_box_use_clip:N #1 { \__driver_scope_begin: @@ -196,6 +205,154 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } +%% File: l3drivers-draw.dtx +\cs_new_eq:NN \__driver_draw_literal:n \__driver_literal_pdf:n +\cs_generate_variant:Nn \__driver_draw_literal:n { x } +\cs_new_protected:Npn \driver_draw_begin: + { \driver_draw_scope_begin: } +\cs_new_protected:Npn \driver_draw_end: + { \driver_draw_scope_end: } +\cs_new_eq:NN \driver_draw_scope_begin: \__driver_scope_begin: +\cs_new_eq:NN \driver_draw_scope_end: \__driver_scope_end: +\cs_new_protected:Npn \driver_draw_moveto:nn #1#2 + { + \__driver_draw_literal:x + { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ m } + } +\cs_new_protected:Npn \driver_draw_lineto:nn #1#2 + { + \__driver_draw_literal:x + { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ l } + } +\cs_new_protected:Npn \driver_draw_curveto:nnnnnn #1#2#3#4#5#6 + { + \__driver_draw_literal:x + { + \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ + \dim_to_decimal_in_bp:n {#3} ~ \dim_to_decimal_in_bp:n {#4} ~ + \dim_to_decimal_in_bp:n {#5} ~ \dim_to_decimal_in_bp:n {#6} ~ + c + } + } +\cs_new_protected:Npn \driver_draw_rectangle:nnnn #1#2#3#4 + { + \__driver_draw_literal:x + { + \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ + \dim_to_decimal_in_bp:n {#3} ~ \dim_to_decimal_in_bp:n {#4} ~ + re + } + } +\cs_new_protected:Npn \driver_draw_evenodd_rule: + { \bool_gset_true:N \g__driver_draw_eor_bool } +\cs_new_protected:Npn \driver_draw_nonzero_rule: + { \bool_gset_false:N \g__driver_draw_eor_bool } +\bool_new:N \g__driver_draw_eor_bool +\cs_new_protected:Npn \driver_draw_closepath: + { \__driver_draw_literal:n { h } } +\cs_new_protected:Npn \driver_draw_stroke: + { \__driver_draw_literal:n { S } } +\cs_new_protected:Npn \driver_draw_closestroke: + { \__driver_draw_literal:n { s } } +\cs_new_protected:Npn \driver_draw_fill: + { + \__driver_draw_literal:x + { f \bool_if:NT \g__driver_draw_eor_bool * } + } +\cs_new_protected:Npn \driver_draw_fillstroke: + { + \__driver_draw_literal:x + { B \bool_if:NT \g__driver_draw_eor_bool * } + } +\cs_new_protected:Npn \driver_draw_clip: + { + \__driver_draw_literal:x + { W \bool_if:NT \g__driver_draw_eor_bool * } + } +\cs_new_protected:Npn \driver_draw_discardpath: + { \__driver_draw_literal:n { n } } +\cs_new_protected:Npn \driver_draw_dash_pattern:nn #1#2 + { + \__driver_draw_literal:x + { + [ + \exp_args:Nf \use:n + { \clist_map_function:nN {#1} \__driver_draw_dash:n } + ] ~ + \dim_to_decimal_in_bp:n {#2} ~ d + } + } +\cs_new:Npn \__driver_draw_dash:n #1 + { ~ \dim_to_decimal_in_bp:n {#1} } +\cs_new_protected:Npn \driver_draw_linewidth:n #1 + { + \__driver_draw_literal:x + { \dim_to_decimal_in_bp:n {#1} ~ w } + } +\cs_new_protected:Npn \driver_draw_miterlimit:n #1 + { \__driver_draw_literal:x { \fp_eval:n {#1} ~ M } } +\cs_new_protected:Npn \driver_draw_cap_butt: + { \__driver_draw_literal:n { 0 ~ J } } +\cs_new_protected:Npn \driver_draw_cap_round: + { \__driver_draw_literal:n { 1 ~ J } } +\cs_new_protected:Npn \driver_draw_cap_rectangle: + { \__driver_draw_literal:n { 2 ~ J } } +\cs_new_protected:Npn \driver_draw_join_miter: + { \__driver_draw_literal:n { 0 ~ j } } +\cs_new_protected:Npn \driver_draw_join_round: + { \__driver_draw_literal:n { 1 ~ j } } +\cs_new_protected:Npn \driver_draw_join_bevel: + { \__driver_draw_literal:n { 2 ~ j } } +\cs_new_protected:Npn \driver_draw_color_fill_cmyk:nnnn #1#2#3#4 + { + \__driver_color_fill_select:x + { + \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ + \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ + k + } + } +\cs_new_protected:Npn \driver_draw_color_stroke_cmyk:nnnn #1#2#3#4 + { + \__driver_color_select:x + { + \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ + \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ + k + } + } +\cs_new_protected:Npn \driver_draw_color_fill_gray:n #1 + { \__driver_color_fill_select:x { \fp_eval:n {#1} ~ g } } +\cs_new_protected:Npn \driver_draw_color_stroke_gray:n #1 + { \__driver_color_select:x { \fp_eval:n {#1} ~ G } } +\cs_new_protected:Npn \driver_draw_color_fill_rgb:nnn #1#2#3 + { + \__driver_color_fill_select:x + { \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ rg } + } +\cs_new_protected:Npn \driver_draw_color_stroke_rgb:nnn #1#2#3 + { + \__driver_color_select:x + { \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ RG } + } +\cs_new_eq:NN \__driver_color_fill_select:n \__driver_color_select:n +\cs_generate_variant:Nn \__driver_color_fill_select:n { x } +\cs_new_protected:Npn \driver_draw_cm:nnnn #1#2#3#4 + { + \__driver_matrix:x + { + \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ + \fp_eval:n {#3} ~ \fp_eval:n {#4} + } + } +\cs_new_protected:Npn \driver_draw_box_use:Nnnnn #1#2#3#4#5 + { + \__driver_scope_begin: + \driver_draw_cm:nnnn {#2} {#3} {#4} {#5} + \hbox_overlap_right:n { \box_use:N #1 } + \__driver_scope_end: + } +%% File: l3drivers-image.dtx \tl_new:N \l__driver_image_attr_tl \cs_new_protected:Npn \__driver_image_getbb_jpg:n #1 { @@ -264,6 +421,70 @@ } \cs_new_eq:NN \__driver_image_include_pdf:n \__driver_image_include_jpg:n \cs_new_eq:NN \__driver_image_include_png:n \__driver_image_include_jpg:n +%% File: l3drivers-pdf.dtx +\tl_const:Nn \c__driver_pdf_AR_fix_tl + { /Ff ~ 65537 /FT /Btn /Subtype /Widget } +\cs_new_protected:Npx \__driver_pdf_AR_fix: + { + \cs_if_exist:NTF \tex_pdfextension:D + { \tex_pdfextension:D annot ~ } + { \tex_pdfannot:D } + width ~ 3pt ~ height ~ 3pt ~ depth ~ 0pt + { \c__driver_pdf_AR_fix_tl } + } +\cs_new_protected:Npx \driver_pdf_annotation:nnnn #1#2#3#4 + { + \__driver_pdf_AR_fix: + \cs_if_exist:NTF \tex_pdfextension:D + { \tex_pdfextension:D annot ~ } + { \tex_pdfannot:D } + width ~ \exp_not:N \dim_eval:n {#1} ~ + height ~ \exp_not:N \dim_eval:n {#2} ~ + depth ~ \exp_not:N \dim_eval:n {#3} ~ + {#4} + } +\cs_new:Npx \driver_pdf_annotation_last: + { + \exp_not:N \tex_the:D + \cs_if_exist:NTF \tex_pdffeedback:D + { \exp_not:N \tex_pdffeedback:D annot ~ } + { \exp_not:N \tex_pdflastannot:D } + 0 ~ R + } +\cs_new_protected:Npn \driver_pdf_link_begin_goto:nnw #1#2 + { \__driver_pdf_link_begin:nnnw {#1} { goto~name } {#2} } +\cs_new_protected:Npn \driver_pdf_link_begin_user:nnw #1#2 + { \__driver_pdf_link_begin:nnnw {#1} { user } { /Subtype /Link #2 } } +\cs_new_protected:Npx \__driver_pdf_link_begin:nnnw #1#2#3 + { + \__driver_pdf_AR_fix: + \cs_if_exist:NTF \tex_pdfextension:D + { \tex_pdfextension:D startlink ~ } + { \tex_pdfstartlink:D } + attr {#1} + #2 {#3} + } +\cs_new_protected:Npx \driver_pdf_link_end: + { + \cs_if_exist:NTF \tex_pdfextension:D + { \tex_pdfextension:D endlink \scan_stop: } + { \tex_pdfendlink:D } + } +\cs_new:Npx \driver_pdf_link_last: + { + \exp_not:N \tex_the:D + \cs_if_exist:NTF \tex_pdffeedback:D + { \exp_not:N \tex_pdffeedback:D lastlink \scan_stop: } + { \exp_not:N \tex_pdflastlink:D } + ~ 0 ~ R + } +\cs_new_protected:Npx \driver_pdf_link_margin:n #1 + { + \cs_if_exist:NTF \tex_pdfvariable:D + { \exp_not:N \tex_pdfvariable:D linkmargin } + { \exp_not:N \tex_pdflinkmargin:D } + \exp_not:N \dim_eval:n {#1} \scan_stop: + } \prop_new:N \g__driver_pdf_object_prop \group_begin: \cs_set_protected:Npn \__driver_tmp:w #1#2 @@ -337,151 +558,52 @@ { \tex_pdfvariable:D objcompresslevel } #1 \scan_stop: } -\cs_new_eq:NN \__driver_draw_literal:n \__driver_literal_pdf:n -\cs_generate_variant:Nn \__driver_draw_literal:n { x } -\cs_new_protected:Npn \driver_draw_begin: - { \driver_draw_scope_begin: } -\cs_new_protected:Npn \driver_draw_end: - { \driver_draw_scope_end: } -\cs_new_eq:NN \driver_draw_scope_begin: \__driver_scope_begin: -\cs_new_eq:NN \driver_draw_scope_end: \__driver_scope_end: -\cs_new_protected:Npn \driver_draw_moveto:nn #1#2 - { - \__driver_draw_literal:x - { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ m } - } -\cs_new_protected:Npn \driver_draw_lineto:nn #1#2 - { - \__driver_draw_literal:x - { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ l } - } -\cs_new_protected:Npn \driver_draw_curveto:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npx \driver_pdf_version_major_gset:n #1 { - \__driver_draw_literal:x + \cs_if_exist:NTF \tex_pdfvariable:D { - \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ - \dim_to_decimal_in_bp:n {#3} ~ \dim_to_decimal_in_bp:n {#4} ~ - \dim_to_decimal_in_bp:n {#5} ~ \dim_to_decimal_in_bp:n {#6} ~ - c + \int_compare:nNnT \tex_luatexversion:D > { 106 } + { + \exp_not:N \tex_global:D \tex_pdfvariable:D majorversion + \exp_not:N \int_eval:n {#1} \scan_stop: + } } - } -\cs_new_protected:Npn \driver_draw_rectangle:nnnn #1#2#3#4 - { - \__driver_draw_literal:x { - \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ - \dim_to_decimal_in_bp:n {#3} ~ \dim_to_decimal_in_bp:n {#4} ~ - re - } - } -\cs_new_protected:Npn \driver_draw_evenodd_rule: - { \bool_gset_true:N \g__driver_draw_eor_bool } -\cs_new_protected:Npn \driver_draw_nonzero_rule: - { \bool_gset_false:N \g__driver_draw_eor_bool } -\bool_new:N \g__driver_draw_eor_bool -\cs_new_protected:Npn \driver_draw_closepath: - { \__driver_draw_literal:n { h } } -\cs_new_protected:Npn \driver_draw_stroke: - { \__driver_draw_literal:n { S } } -\cs_new_protected:Npn \driver_draw_closestroke: - { \__driver_draw_literal:n { s } } -\cs_new_protected:Npn \driver_draw_fill: - { - \__driver_draw_literal:x - { f \bool_if:NT \g__driver_draw_eor_bool * } - } -\cs_new_protected:Npn \driver_draw_fillstroke: - { - \__driver_draw_literal:x - { B \bool_if:NT \g__driver_draw_eor_bool * } - } -\cs_new_protected:Npn \driver_draw_clip: - { - \__driver_draw_literal:x - { W \bool_if:NT \g__driver_draw_eor_bool * } - } -\cs_new_protected:Npn \driver_draw_discardpath: - { \__driver_draw_literal:n { n } } -\cs_new_protected:Npn \driver_draw_dash_pattern:nn #1#2 - { - \__driver_draw_literal:x - { - [ - \exp_args:Nf \use:n - { \clist_map_function:nN {#1} \__driver_draw_dash:n } - ] ~ - \dim_to_decimal_in_bp:n {#2} ~ d + \cs_if_exist:NT \tex_pdfmajorversion:D + { + \exp_not:N \tex_global:D \tex_pdfmajorversion:D + \exp_not:N \int_eval:n {#1} \scan_stop: + } } } -\cs_new:Npn \__driver_draw_dash:n #1 - { ~ \dim_to_decimal_in_bp:n {#1} } -\cs_new_protected:Npn \driver_draw_linewidth:n #1 +\cs_new_protected:Npx \driver_pdf_version_minor_gset:n #1 { - \__driver_draw_literal:x - { \dim_to_decimal_in_bp:n {#1} ~ w } + \exp_not:N \tex_global:D + \cs_if_exist:NTF \tex_pdfminorversion:D + { \exp_not:N \tex_pdfminorversion:D } + { \tex_pdfvariable:D minorversion } + \exp_not:N \int_eval:n {#1} \scan_stop: } -\cs_new_protected:Npn \driver_draw_miterlimit:n #1 - { \__driver_draw_literal:x { \fp_eval:n {#1} ~ M } } -\cs_new_protected:Npn \driver_draw_cap_butt: - { \__driver_draw_literal:n { 0 ~ J } } -\cs_new_protected:Npn \driver_draw_cap_round: - { \__driver_draw_literal:n { 1 ~ J } } -\cs_new_protected:Npn \driver_draw_cap_rectangle: - { \__driver_draw_literal:n { 2 ~ J } } -\cs_new_protected:Npn \driver_draw_join_miter: - { \__driver_draw_literal:n { 0 ~ j } } -\cs_new_protected:Npn \driver_draw_join_round: - { \__driver_draw_literal:n { 1 ~ j } } -\cs_new_protected:Npn \driver_draw_join_bevel: - { \__driver_draw_literal:n { 2 ~ j } } -\cs_new_protected:Npn \driver_draw_color_fill_cmyk:nnnn #1#2#3#4 +\cs_new:Npx \driver_pdf_version_major: { - \__driver_color_fill_select:x + \cs_if_exist:NTF \tex_pdfvariable:D { - \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ - \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ - k + \int_compare:nNnTF \tex_luatexversion:D > { 106 } + { \exp_not:N \tex_the:D \tex_pdfvariable:D majorversion } + { 1 } } - } -\cs_new_protected:Npn \driver_draw_color_stroke_cmyk:nnnn #1#2#3#4 - { - \__driver_color_select:x { - \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ - \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ - k + \cs_if_exist:NTF \tex_pdfmajorversion:D + { \exp_not:N \tex_the:D \tex_pdfmajorversion:D } + { 1 } } } -\cs_new_protected:Npn \driver_draw_color_fill_gray:n #1 - { \__driver_color_fill_select:x { \fp_eval:n {#1} ~ g } } -\cs_new_protected:Npn \driver_draw_color_stroke_gray:n #1 - { \__driver_color_select:x { \fp_eval:n {#1} ~ G } } -\cs_new_protected:Npn \driver_draw_color_fill_rgb:nnn #1#2#3 +\cs_new:Npx \driver_pdf_version_minor: { - \__driver_color_fill_select:x - { \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ rg } - } -\cs_new_protected:Npn \driver_draw_color_stroke_rgb:nnn #1#2#3 - { - \__driver_color_select:x - { \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ RG } - } -\cs_new_eq:NN \__driver_color_fill_select:n \__driver_color_select:n -\cs_generate_variant:Nn \__driver_color_fill_select:n { x } -\cs_new_protected:Npn \driver_draw_cm:nnnn #1#2#3#4 - { - \__driver_matrix:x - { - \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ - \fp_eval:n {#3} ~ \fp_eval:n {#4} - } - } -\cs_new_protected:Npn \driver_draw_box_use:Nnnnn #1#2#3#4#5 - { - \__driver_scope_begin: - \driver_draw_cm:nnnn {#2} {#3} {#4} {#5} - \hbox_overlap_right:n { \box_use:N #1 } - \__driver_scope_end: + \exp_not:N \tex_the:D + \cs_if_exist:NTF \tex_pdfminorversion:D + { \exp_not:N \tex_pdfminorversion:D } + { \tex_pdfvariable:D minorversion } } %% %% |