diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3drivers-graphics.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3drivers-graphics.dtx | 88 |
1 files changed, 71 insertions, 17 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers-graphics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers-graphics.dtx index 555b394ae15..86bfcfeb1f7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers-graphics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers-graphics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-05-09} +% \date{Released 2019-05-28} % % \maketitle % @@ -108,9 +108,9 @@ % \end{macrocode} % % \begin{variable}{\l_@@_graphics_attr_tl} -% In PDF mode, additional attributes of an image (such as page number) are -% needed both to obtain the bounding box and when inserting the image: this -% occurs as the image dictionary approach means they are read as part of +% In PDF mode, additional attributes of an graphic (such as page number) are +% needed both to obtain the bounding box and when inserting the graphic: this +% occurs as the graphic dictionary approach means they are read as part of % the bounding box operation. As such, it is easier to track additional % attributes using a dedicated |tl| rather than build up the same data % twice. @@ -127,9 +127,9 @@ % } % \begin{macro} % {\@@_graphics_getbb_auxi:n, \@@_graphics_getbb_auxii:n} -% Getting the bounding box here requires us to box up the image and +% Getting the bounding box here requires us to box up the graphic and % measure it. To deal with the difference in feature support in bitmap -% and vector images but keeping the common parts, there is a little work +% and vector graphics but keeping the common parts, there is a little work % to do in terms of auxiliaries. The key here is to notice that we need % two forms of the attributes: a \enquote{short} set to allow us to % track for caching, and the full form to pass to the primitive. @@ -167,7 +167,7 @@ { \@@_graphics_getbb_auxii:n {#1} } } % \begin{macrocode} -% Measuring the image is done by boxing up: for PDF images we could +% Measuring the graphic is done by boxing up: for PDF graphics we could % use |\tex_pdfximagebbox:D|, but if doesn't work for other types. % As the box always starts at $(0,0)$ there is no need to worry about % the lower-left position. @@ -224,6 +224,60 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\driver_graphics_getbb_eps:n} +% \begin{macro}{\@@_graphics_getbb_eps:nm} +% \begin{macro}{\driver_graphics_include_eps:n} +% \begin{variable}{\l_@@_dir_str, \l_@@_name_str, \l_@@_ext_str} +% EPS graphics may be included in \texttt{pdfmode} by conversion to +% PDF: this requires restricted shell escape. Modelled on the \pkg{epstopdf} +% \LaTeXe{} package, but simplified, conversion takes place here if we have +% shell access. +% \begin{macrocode} +\sys_if_shell:T + { + \str_new:N \l_@@_dir_str + \str_new:N \l_@@_name_str + \str_new:N \l_@@_ext_str + \cs_new_protected:Npn \driver_graphics_getbb_eps:n #1 + { + \file_parse_full_name:nNNN {#1} + \l_@@_dir_str + \l_@@_name_str + \l_@@_ext_str + \exp_args:Nx \@@_graphics_getbb_eps:nn + { + \l_@@_name_str - \str_tail:N \l_@@_ext_str + -converted-to.pdf + } + {#1} + } + \cs_new_protected:Npn \@@_graphics_getbb_eps:nn #1#2 + { + \file_compare_timestamp:nNnT {#2} > {#1} + { + \sys_shell_now:n + { repstopdf ~ #2 ~ #1 } + } + \tl_set:Nn \l_graphics_name_tl {#1} + \driver_graphics_getbb_pdf:n {#1} + } + \cs_new_protected:Npn \driver_graphics_include_eps:n #1 + { + \file_parse_full_name:nNNN {#1} + \l_@@_dir_str \l_@@_name_str \l_@@_ext_str + \exp_args:Nx \driver_graphics_include_pdf:n + { + \l_@@_name_str - \str_tail:N \l_@@_ext_str + -converted-to.pdf + } + } + } +% \end{macrocode} +% \end{variable} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macrocode} %</pdfmode> % \end{macrocode} @@ -268,7 +322,7 @@ % \end{macro} % % \begin{variable}{\g_@@_graphics_int} -% Used to track the object number associated with each image. +% Used to track the object number associated with each graphic. % \begin{macrocode} \int_new:N \g_@@_graphics_int % \end{macrocode} @@ -283,7 +337,7 @@ % \begin{macro}{\@@_graphics_include_auxii:nnn, \@@_graphics_include_auxii:xnn} % \begin{macro}{\@@_graphics_include_auxiii:nnn} % The special syntax depends on the file type. There is a difference in -% how PDF images are best handled between |dvipdfmx| and |xdvipdfmx|: for +% how PDF graphics are best handled between |dvipdfmx| and |xdvipdfmx|: for % the latter it is better to use the primitive route. The relevant code for % that is included later in this file. % \begin{macrocode} @@ -306,7 +360,7 @@ { \@@_graphics_include_auxi:nn {#1} { epdf } } %</dvipdfmx> % \end{macrocode} -% Image inclusion is set up to use the fact that each image is stored in +% Graphic inclusion is set up to use the fact that each image is stored in % the PDF as an XObject. This means that we can include repeated images % only once and refer to them. To allow that, track the nature of each % image: much the same as for the direct PDF mode case. @@ -331,14 +385,14 @@ \int_if_exist:cTF { c_@@_graphics_ #2#1 _int } { \@@_literal:x - { pdf:usexobj~@image \int_use:c { c_@@_graphics_ #2#1 _int } } + { pdf:usexobj~@graphic \int_use:c { c_@@_graphics_ #2#1 _int } } } { \@@_graphics_include_auxiii:nnn {#2} {#1} {#3} } } \cs_generate_variant:Nn \@@_graphics_include_auxii:nnn { x } % \end{macrocode} % Inclusion using the specials is relatively straight-forward, but there -% is one wrinkle. To get the |pagebox| correct for PDF images in all cases, +% is one wrinkle. To get the |pagebox| correct for PDF graphics in all cases, % it is necessary to provide both that information and the |bbox| argument: % odd things happen otherwise! % \begin{macrocode} @@ -349,7 +403,7 @@ \@@_literal:x { pdf:#3~ - @image \int_use:c { c_@@_graphics_ #1#2 _int } ~ + @graphic \int_use:c { c_@@_graphics_ #1#2 _int } ~ \int_compare:nNnT \l_graphics_page_int > 1 { page ~ \int_use:N \l_graphics_page_int \c_space_tl } \tl_if_empty:NF \l_graphics_pagebox_tl @@ -473,9 +527,9 @@ % % \begin{macro}{\driver_graphics_include_pdf:n} % \begin{macro}{\@@_graphics_include_bitmap_quote:w} -% For PDF images, properly supporting the |pagebox| concept in \XeTeX{} +% For PDF graphics, properly supporting the |pagebox| concept in \XeTeX{} % is best done using the |\tex_XeTeXpdffile:D| primitive. The syntax here -% is the same as for the image measurement part, although we know at this +% is the same as for the graphic measurement part, although we know at this % stage that there must be some valid setting for \cs{l_graphics_pagebox_tl}. % \begin{macrocode} \cs_new_protected:Npn \driver_graphics_include_pdf:n #1 @@ -520,9 +574,9 @@ % % \begin{macro}{\driver_graphics_include_png:n, \driver_graphics_include_jpg:n} % \begin{macro}{\@@_graphics_include_bitmap_quote:w} -% The driver here has built-in support for basic image inclusion (see +% The driver here has built-in support for basic graphic inclusion (see % \texttt{dvisvgm.def} for a more complex approach, needed if clipping, -% \emph{etc.}, is covered at the image driver level). The only issue is +% \emph{etc.}, is covered at the graphic driver level). The only issue is % that |#1| must be quote-corrected. The \texttt{dvisvgm:img} operation % quotes the file name, but if it is already quoted (contains spaces) % then we have an issue: we simply strip off any quotes as a result. |