diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty | 119 |
1 files changed, 103 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty b/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty index 6e4116ee770..02c53d2a03c 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty @@ -46,8 +46,8 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{l3names,graphicx,color} -\GetIdInfo$Id: l3coffins.dtx 2624 2011-08-18 19:02:45Z joseph $ +\RequirePackage{l3names} +\GetIdInfo$Id: l3coffins.dtx 2717 2011-09-03 13:40:31Z joseph $ {L3 Experimental coffin code layer} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -108,12 +108,12 @@ \cs_if_exist:cTF { l_coffin_poles_ \int_value:w #1 _prop } { #2 } { - \msg_kernel_error:nnx { coffin } { unknown-coffin } + \msg_kernel_error:nnx { coffins } { unknown-coffin } { \token_to_str:N #1 } } } { - \msg_kernel_error:nnx { coffin } { unknown-coffin } + \msg_kernel_error:nnx { coffins } { unknown-coffin } { \token_to_str:N #1 } } } @@ -143,10 +143,10 @@ { \hbox_set:Nn #1 { - \group_begin: - \set@color + \color_group_begin: + \color_ensure_current: #2 - \group_end: + \color_group_end: } \coffin_reset_structure:N #1 \coffin_update_poles:N #1 @@ -161,10 +161,10 @@ \vbox_set:Nn #1 { \dim_set:Nn \tex_hsize:D {#2} - \group_begin: - \set@color + \color_group_begin: + \color_ensure_current: #3 - \group_end: + \color_group_end: } \coffin_reset_structure:N #1 \coffin_update_poles:N #1 @@ -199,7 +199,7 @@ \prop_get:cnNF { l_coffin_poles_ \int_value:w #1 _prop } {#2} #3 { - \msg_kernel_error:nnxx { coffin } { unknown-coffin-pole } + \msg_kernel_error:nnxx { coffins } { unknown-coffin-pole } {#2} { \token_to_str:N #1 } \tl_set:Nn #3 { { 0 pt } { 0 pt } { 0 pt } { 0 pt } } } @@ -326,7 +326,7 @@ \l_coffin_pole_a_tl \l_coffin_pole_b_tl \bool_if:NT \l_coffin_error_bool { - \msg_kernel_error:nn { coffin } { no-pole-intersection } + \msg_kernel_error:nn { coffins } { no-pole-intersection } \dim_zero:N \l_coffin_x_dim \dim_zero:N \l_coffin_y_dim } @@ -624,7 +624,7 @@ { \coffin_rotate_bounding:nnn {##1} ##2 } \coffin_find_corner_maxima:N #1 \coffin_find_bounding_shift: - \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } + \box_rotate:Nn #1 {#2} \hbox_set:Nn #1 { \tex_kern:D \l_coffin_bounding_shift_dim @@ -737,6 +737,93 @@ {#5} {#6} } } +\fp_new:N \l_coffin_scale_x_fp +\fp_new:N \l_coffin_scale_y_fp +\dim_new:N \l_coffin_scaled_total_height_dim +\dim_new:N \l_coffin_scaled_width_dim +\cs_new_protected_nopar:Npn \coffin_resize:Nnn #1#2#3 + { + \coffin_set_user_dimensions:N #1 + \box_resize:Nnn #1 {#2} {#3} + \fp_set_from_dim:Nn \l_coffin_scale_x_fp {#2} + \fp_set_from_dim:Nn \l_coffin_tmp_fp { \Width } + \fp_div:Nn \l_coffin_scale_x_fp { \l_coffin_tmp_fp } + \fp_set_from_dim:Nn \l_coffin_scale_y_fp {#3} + \fp_set_from_dim:Nn \l_coffin_tmp_fp { \TotalHeight } + \fp_div:Nn \l_coffin_scale_y_fp { \l_coffin_tmp_fp } + \coffin_resize_common:Nnn #1 {#2} {#3} + } +\cs_generate_variant:Nn \coffin_resize:Nnn { c } +\cs_new_protected_nopar:Npn \coffin_resize_common:Nnn #1#2#3 + { + \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } + { \coffin_scale_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } + { \coffin_scale_pole:Nnnnnn #1 {##1} ##2 } + \fp_compare:NNNT \l_coffin_scale_x_fp < \c_zero_fp + { + \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } + { \coffin_x_shift_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } + { \coffin_x_shift_pole:Nnnnnn #1 {##1} ##2 } + } + \coffin_end_user_dimensions: + } +\cs_new_protected_nopar:Npn \coffin_scale:Nnn #1#2#3 + { + \box_scale:Nnn #1 {#2} {#3} + \coffin_set_user_dimensions:N #1 + \fp_set:Nn \l_coffin_scale_x_fp {#2} + \fp_set:Nn \l_coffin_scale_y_fp {#3} + \fp_compare:NNNTF \l_coffin_scale_y_fp > \c_zero_fp + { \l_coffin_scaled_total_height_dim #3 \TotalHeight } + { \l_coffin_scaled_total_height_dim -#3 \TotalHeight } + \fp_compare:NNNTF \l_coffin_scale_x_fp > \c_zero_fp + { \l_coffin_scaled_width_dim -#2 \Width } + { \l_coffin_scaled_width_dim #2 \Width } + \coffin_resize_common:Nnn #1 + { \l_coffin_scaled_width_dim } { \l_coffin_scaled_total_height_dim } + } +\cs_generate_variant:Nn \coffin_scale:Nnn { c } +\cs_new_protected_nopar:Npn \coffin_scale_vector:nnNN #1#2#3#4 + { + \fp_set_from_dim:Nn \l_coffin_tmp_fp {#1} + \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_scale_x_fp } + \dim_set:Nn #3 { \fp_to_dim:N \l_coffin_tmp_fp } + \fp_set_from_dim:Nn \l_coffin_tmp_fp {#2} + \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_scale_y_fp } + \dim_set:Nn #4 { \fp_to_dim:N \l_coffin_tmp_fp } + } +\cs_new_protected_nopar:Npn \coffin_scale_corner:Nnnn #1#2#3#4 + { + \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim + \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} + { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } + } +\cs_new_protected_nopar:Npn \coffin_scale_pole:Nnnnnn #1#2#3#4#5#6 + { + \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim + \coffin_set_pole:Nnx #1 {#2} + { + { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } + {#5} {#6} + } + } +\cs_new_protected_nopar:Npn \coffin_x_shift_corner:Nnnn #1#2#3#4 + { + \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} + { + { \dim_eval:n { #3 + \box_wd:N #1 } } {#4} + } + } +\cs_new_protected_nopar:Npn \coffin_x_shift_pole:Nnnnnn #1#2#3#4#5#6 + { + \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } {#2} + { + { \dim_eval:n #3 + \box_wd:N #1 } {#4} + {#5} {#6} + } + } \coffin_new:N \l_coffin_display_coffin \coffin_new:N \l_coffin_display_coord_coffin \coffin_new:N \l_coffin_display_pole_coffin @@ -965,7 +1052,7 @@ } \cs_new_nopar:Npn \coffin_show_aux:w #1 > ~ { } \cs_generate_variant:Nn \coffin_show_structure:N { c } -\msg_kernel_new:nnnn { coffin } { no-pole-intersection } +\msg_kernel_new:nnnn { coffins } { no-pole-intersection } { No~intersection~between~coffin~poles. } { \c_msg_coding_error_text_tl @@ -973,10 +1060,10 @@ but~they~do~not~have~a~unique~meeting~point:~ the~value~(0~pt,~0~pt)~will~be~used. } -\msg_kernel_new:nnnn { coffin } { unknown-coffin } +\msg_kernel_new:nnnn { coffins } { unknown-coffin } { Unknown~coffin~'#1'. } { The~coffin~'#1'~was~never~defined. } -\msg_kernel_new:nnnn { coffin } { unknown-coffin-pole } +\msg_kernel_new:nnnn { coffins } { unknown-coffin-pole } { Pole~'#1'~unknown~for~coffin~'#2'. } { \c_msg_coding_error_text_tl |