| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
%% File: l3backend-graphics.dtx |
| 4 |
% |
| 5 |
% Copyright (C) 2019-2026 The LaTeX Project |
| 6 |
% |
| 7 |
% It may be distributed and/or modified under the conditions of the |
| 8 |
% LaTeX Project Public License (LPPL), either version 1.3c of this |
| 9 |
% license or (at your option) any later version. The latest version |
| 10 |
% of this license is in the file |
| 11 |
% |
| 12 |
% https://www.latex-project.org/lppl.txt |
| 13 |
% |
| 14 |
% This file is part of the "l3backend bundle" (The Work in LPPL) |
| 15 |
% and all files in that bundle must be distributed together. |
| 16 |
% |
| 17 |
% ----------------------------------------------------------------------- |
| 18 |
% |
| 19 |
% The development version of the bundle can be found at |
| 20 |
% |
| 21 |
% https://github.com/latex3/latex3 |
| 22 |
% |
| 23 |
% for those people who are interested. |
| 24 |
% |
| 25 |
%<*driver> |
| 26 |
\documentclass[full,kernel]{l3doc} |
| 27 |
\begin{document} |
| 28 |
\DocInput{\jobname.dtx} |
| 29 |
\end{document} |
| 30 |
%</driver> |
| 31 |
% \fi |
| 32 |
% |
| 33 |
% \title{^^A |
| 34 |
% The \pkg{l3backend-graphics} module\\ Backend graphics support^^A |
| 35 |
% } |
| 36 |
% |
| 37 |
% \author{^^A |
| 38 |
% The \LaTeX{} Project\thanks |
| 39 |
% {^^A |
| 40 |
% E-mail: |
| 41 |
% \href{mailto:[email protected]} |
| 42 |
% {[email protected]}^^A |
| 43 |
% }^^A |
| 44 |
% } |
| 45 |
% |
| 46 |
% \date{Released 2026-02-18} |
| 47 |
% |
| 48 |
% \maketitle |
| 49 |
% |
| 50 |
% \begin{documentation} |
| 51 |
% |
| 52 |
% \end{documentation} |
| 53 |
% |
| 54 |
% \begin{implementation} |
| 55 |
% |
| 56 |
% \section{\pkg{l3backend-graphics} implementation} |
| 57 |
% |
| 58 |
% \begin{macrocode} |
| 59 |
%<*package> |
| 60 |
%<@@=graphics> |
| 61 |
% \end{macrocode} |
| 62 |
% |
| 63 |
% \subsection{\texttt{dvips} backend} |
| 64 |
% |
| 65 |
% \begin{macrocode} |
| 66 |
%<*dvips> |
| 67 |
% \end{macrocode} |
| 68 |
% |
| 69 |
% \begin{variable}[no-user-doc]{\l_graphics_search_ext_seq} |
| 70 |
% \begin{macrocode} |
| 71 |
\seq_set_from_clist:Nn \l_graphics_search_ext_seq { .eps , .ps } |
| 72 |
% \end{macrocode} |
| 73 |
% \end{variable} |
| 74 |
% |
| 75 |
% \begin{macro}{\@@_backend_getbb_eps:n, \@@_backend_getbb_ps:n} |
| 76 |
% Simply use the generic function. |
| 77 |
% \begin{macrocode} |
| 78 |
\cs_new_eq:NN \@@_backend_getbb_eps:n \@@_read_bb:n |
| 79 |
\cs_new_eq:NN \@@_backend_getbb_ps:n \@@_read_bb:n |
| 80 |
% \end{macrocode} |
| 81 |
% \end{macro} |
| 82 |
% |
| 83 |
% \begin{macro}{\@@_backend_include_eps:n, \@@_backend_include_ps:n} |
| 84 |
% The special syntax is relatively clear here: remember we need PostScript |
| 85 |
% sizes here. |
| 86 |
% \begin{macrocode} |
| 87 |
\cs_new_protected:Npn \@@_backend_include_eps:n #1 |
| 88 |
{ |
| 89 |
\__kernel_backend_literal:e |
| 90 |
{ |
| 91 |
PSfile = #1 \c_space_tl |
| 92 |
llx = \dim_to_decimal_in_bp:n \l_@@_llx_dim \c_space_tl |
| 93 |
lly = \dim_to_decimal_in_bp:n \l_@@_lly_dim \c_space_tl |
| 94 |
urx = \dim_to_decimal_in_bp:n \l_@@_urx_dim \c_space_tl |
| 95 |
ury = \dim_to_decimal_in_bp:n \l_@@_ury_dim |
| 96 |
} |
| 97 |
} |
| 98 |
\cs_new_eq:NN \@@_backend_include_ps:n \@@_backend_include_eps:n |
| 99 |
% \end{macrocode} |
| 100 |
% \end{macro} |
| 101 |
% |
| 102 |
% \begin{macro}{\@@_backend_get_pagecount:n} |
| 103 |
% \begin{macrocode} |
| 104 |
\cs_new_eq:NN \@@_backend_get_pagecount:n \@@_get_pagecount:n |
| 105 |
% \end{macrocode} |
| 106 |
% \end{macro} |
| 107 |
% |
| 108 |
% \begin{macrocode} |
| 109 |
%</dvips> |
| 110 |
% \end{macrocode} |
| 111 |
% |
| 112 |
% \subsection{\LuaTeX{} and \pdfTeX{} backends} |
| 113 |
% |
| 114 |
% \begin{macrocode} |
| 115 |
%<*luatex|pdftex> |
| 116 |
% \end{macrocode} |
| 117 |
% |
| 118 |
% \begin{variable}[no-user-doc]{\l_graphics_search_ext_seq} |
| 119 |
% \begin{macrocode} |
| 120 |
\seq_set_from_clist:Nn \l_graphics_search_ext_seq |
| 121 |
{ .pdf , .eps , .ps , .png , .jpg , .jpeg } |
| 122 |
% \end{macrocode} |
| 123 |
% \end{variable} |
| 124 |
% |
| 125 |
% \begin{variable}{\l_@@_attr_tl} |
| 126 |
% In PDF mode, additional attributes of an graphic (such as page number) are |
| 127 |
% needed both to obtain the bounding box and when inserting the graphic: this |
| 128 |
% occurs as the graphic dictionary approach means they are read as part of |
| 129 |
% the bounding box operation. As such, it is easier to track additional |
| 130 |
% attributes using a dedicated |tl| rather than build up the same data |
| 131 |
% twice. |
| 132 |
% \begin{macrocode} |
| 133 |
\tl_new:N \l_@@_attr_tl |
| 134 |
% \end{macrocode} |
| 135 |
% \end{variable} |
| 136 |
% |
| 137 |
% \begin{variable}{\l_@@_transgroup_bool} |
| 138 |
% Needed to indicate that a transparency group should be applied: only |
| 139 |
% currently for PDF images, but could be extended. |
| 140 |
% \begin{macrocode} |
| 141 |
\bool_new:N \l_@@_transgroup_bool |
| 142 |
% \end{macrocode} |
| 143 |
% \end{variable} |
| 144 |
% |
| 145 |
% \begin{macro} |
| 146 |
% { |
| 147 |
% \@@_backend_getbb_jpg:n , |
| 148 |
% \@@_backend_getbb_jpeg:n , |
| 149 |
% \@@_backend_getbb_pdf:n , |
| 150 |
% \@@_backend_getbb_png:n |
| 151 |
% } |
| 152 |
% \begin{macro} |
| 153 |
% { |
| 154 |
% \@@_backend_getbb_auxi:n , |
| 155 |
% \@@_backend_getbb_auxii:n , |
| 156 |
% \@@_backend_getbb_auxiii:n |
| 157 |
% } |
| 158 |
% \begin{macro}[EXP]{\@@_backend_dequote:w} |
| 159 |
% Getting the bounding box here requires us to box up the graphic and |
| 160 |
% measure it. To deal with the difference in feature support in bitmap |
| 161 |
% and vector graphics but keeping the common parts, there is a little work |
| 162 |
% to do in terms of auxiliaries. The key here is to notice that we need |
| 163 |
% two forms of the attributes: a \enquote{short} set to allow us to |
| 164 |
% track for caching, and the full form to pass to the primitive. |
| 165 |
% \begin{macrocode} |
| 166 |
\cs_new_protected:Npn \@@_backend_getbb_jpg:n #1 |
| 167 |
{ |
| 168 |
\int_zero:N \l_@@_page_int |
| 169 |
\tl_clear:N \l_@@_pagebox_tl |
| 170 |
\bool_set_false:N\l_@@_transgroup_bool |
| 171 |
\tl_set:Ne \l_@@_attr_tl |
| 172 |
{ |
| 173 |
\tl_if_empty:NF \l_@@_decodearray_str |
| 174 |
{ :D \l_@@_decodearray_str } |
| 175 |
\bool_if:NT \l_@@_interpolate_bool |
| 176 |
{ :I } |
| 177 |
\str_if_empty:NF \l_@@_pdf_str |
| 178 |
{ :X \l_@@_pdf_str } |
| 179 |
} |
| 180 |
\@@_backend_getbb_auxi:n {#1} |
| 181 |
} |
| 182 |
\cs_new_eq:NN \@@_backend_getbb_jpeg:n \@@_backend_getbb_jpg:n |
| 183 |
\cs_new_eq:NN \@@_backend_getbb_png:n \@@_backend_getbb_jpg:n |
| 184 |
\cs_new_protected:Npn \@@_backend_getbb_pdf:n #1 |
| 185 |
{ |
| 186 |
\tl_clear:N \l_@@_decodearray_str |
| 187 |
\bool_set_true:N \l_@@_transgroup_bool |
| 188 |
\bool_set_false:N \l_@@_interpolate_bool |
| 189 |
\tl_set:Ne \l_@@_attr_tl |
| 190 |
{ |
| 191 |
: \l_@@_pagebox_tl |
| 192 |
\int_compare:nNnT \l_@@_page_int > 1 |
| 193 |
{ :P \int_use:N \l_@@_page_int } |
| 194 |
\str_if_empty:NF \l_@@_pdf_str |
| 195 |
{ :X \l_@@_pdf_str } |
| 196 |
} |
| 197 |
\@@_backend_getbb_auxi:n {#1} |
| 198 |
} |
| 199 |
\cs_new_protected:Npn \@@_backend_getbb_auxi:n #1 |
| 200 |
{ |
| 201 |
\@@_bb_restore:eF { #1 \l_@@_attr_tl } |
| 202 |
{ \@@_backend_getbb_auxii:n {#1} } |
| 203 |
} |
| 204 |
% \end{macrocode} |
| 205 |
% Measuring the graphic is done by boxing up: for PDF graphics we could |
| 206 |
% use |\tex_pdfximagebbox:D|, but if doesn't work for other types. |
| 207 |
% As the box always starts at $(0,0)$ there is no need to worry about |
| 208 |
% the lower-left position. Quotes need to be \emph{removed} as \LuaTeX{} |
| 209 |
% does not like them here. We always apply a transparency group attribute |
| 210 |
% here as included PDFs otherwise may have non-obvious behavior. |
| 211 |
% \begin{macrocode} |
| 212 |
\cs_new_protected:Npn \@@_backend_getbb_auxii:n #1 |
| 213 |
{ |
| 214 |
\exp_args:Ne \@@_backend_getbb_auxiii:n |
| 215 |
{ \@@_backend_dequote:w #1 " #1 " \s_@@_stop } |
| 216 |
\int_const:cn { c_@@_ #1 \l_@@_attr_tl _int } |
| 217 |
{ \tex_the:D \tex_pdflastximage:D } |
| 218 |
\@@_bb_save:e { #1 \l_@@_attr_tl } |
| 219 |
} |
| 220 |
\cs_new_protected:Npn \@@_backend_getbb_auxiii:n #1 |
| 221 |
{ |
| 222 |
\tex_immediate:D \tex_pdfximage:D |
| 223 |
\bool_lazy_any:nT |
| 224 |
{ |
| 225 |
{ \l_@@_interpolate_bool } |
| 226 |
{ \l_@@_transgroup_bool } |
| 227 |
{ ! \tl_if_empty_p:N \l_@@_decodearray_str } |
| 228 |
{ ! \str_if_empty_p:N \l_@@_pdf_str } |
| 229 |
} |
| 230 |
{ |
| 231 |
attr ~ |
| 232 |
{ |
| 233 |
\tl_if_empty:NF \l_@@_decodearray_str |
| 234 |
{ /Decode~[ \l_@@_decodearray_str ] } |
| 235 |
\bool_if:NT \l_@@_transgroup_bool |
| 236 |
{ /Group << /S /Transparency /K ~ false /I ~ false >> } |
| 237 |
\bool_if:NT \l_@@_interpolate_bool |
| 238 |
{ /Interpolate~true } |
| 239 |
\l_@@_pdf_str |
| 240 |
} |
| 241 |
} |
| 242 |
\int_compare:nNnT \l_@@_page_int > 0 |
| 243 |
{ page ~ \int_use:N \l_@@_page_int } |
| 244 |
\tl_if_empty:NF \l_@@_pagebox_tl |
| 245 |
{ \l_@@_pagebox_tl } |
| 246 |
{#1} |
| 247 |
\hbox_set:Nn \l_@@_tmp_box |
| 248 |
{ \tex_pdfrefximage:D \tex_pdflastximage:D } |
| 249 |
\dim_set:Nn \l_@@_urx_dim { \box_wd:N \l_@@_tmp_box } |
| 250 |
\dim_set:Nn \l_@@_ury_dim { \box_ht:N \l_@@_tmp_box } |
| 251 |
} |
| 252 |
\cs_new:Npn \@@_backend_dequote:w #1 " #2 " #3 \s_@@_stop {#2} |
| 253 |
% \end{macrocode} |
| 254 |
% \end{macro} |
| 255 |
% \end{macro} |
| 256 |
% \end{macro} |
| 257 |
% |
| 258 |
% \begin{macro} |
| 259 |
% { |
| 260 |
% \@@_backend_include_jpg:n , |
| 261 |
% \@@_backend_include_jpeg:n , |
| 262 |
% \@@_backend_include_pdf:n , |
| 263 |
% \@@_backend_include_png:n |
| 264 |
% } |
| 265 |
% Images are already loaded for the measurement part of the code, so |
| 266 |
% inclusion is straight-forward, with only any attributes to worry about. The |
| 267 |
% latter carry through from determination of the bounding box. |
| 268 |
% \begin{macrocode} |
| 269 |
\cs_new_protected:Npn \@@_backend_include_jpg:n #1 |
| 270 |
{ |
| 271 |
\tex_pdfrefximage:D |
| 272 |
\int_use:c { c_@@_ #1 \l_@@_attr_tl _int } |
| 273 |
} |
| 274 |
\cs_new_eq:NN \@@_backend_include_jpeg:n \@@_backend_include_jpg:n |
| 275 |
\cs_new_eq:NN \@@_backend_include_pdf:n \@@_backend_include_jpg:n |
| 276 |
\cs_new_eq:NN \@@_backend_include_png:n \@@_backend_include_jpg:n |
| 277 |
% \end{macrocode} |
| 278 |
% \end{macro} |
| 279 |
% |
| 280 |
% \begin{macro}{\@@_backend_getbb_eps:n, \@@_backend_getbb_ps:n} |
| 281 |
% \begin{macro}{\@@_backend_getbb_eps:nm} |
| 282 |
% \begin{macro}{\@@_backend_include_eps:n, \@@_backend_include_ps:n} |
| 283 |
% \begin{variable} |
| 284 |
% {\l_@@_backend_dir_str, \l_@@_backend_name_str, \l_@@_backend_ext_str} |
| 285 |
% EPS graphics may be included in \LuaTeX{}/pdfTeX{} by conversion to |
| 286 |
% PDF: this requires restricted shell escape. Modeled on the \pkg{epstopdf} |
| 287 |
% \LaTeXe{} package, but simplified, conversion takes place here if we have |
| 288 |
% shell access. |
| 289 |
% \begin{macrocode} |
| 290 |
\sys_if_shell:T |
| 291 |
{ |
| 292 |
\str_new:N \l_@@_backend_dir_str |
| 293 |
\str_new:N \l_@@_backend_name_str |
| 294 |
\str_new:N \l_@@_backend_ext_str |
| 295 |
\cs_new_protected:Npn \@@_backend_getbb_eps:n #1 |
| 296 |
{ |
| 297 |
\file_parse_full_name:nNNN {#1} |
| 298 |
\l_@@_backend_dir_str |
| 299 |
\l_@@_backend_name_str |
| 300 |
\l_@@_backend_ext_str |
| 301 |
\exp_args:Ne \@@_backend_getbb_eps:nn |
| 302 |
{ |
| 303 |
\exp_args:Ne \__kernel_file_name_quote:n |
| 304 |
{ |
| 305 |
\l_@@_backend_name_str |
| 306 |
- \str_tail:N \l_@@_backend_ext_str |
| 307 |
-converted-to.pdf |
| 308 |
} |
| 309 |
} |
| 310 |
{#1} |
| 311 |
} |
| 312 |
\cs_new_eq:NN \@@_backend_getbb_ps:n \@@_backend_getbb_eps:n |
| 313 |
\cs_new_protected:Npn \@@_backend_getbb_eps:nn #1#2 |
| 314 |
{ |
| 315 |
\file_compare_timestamp:nNnT {#2} > {#1} |
| 316 |
{ |
| 317 |
\sys_shell_now:n |
| 318 |
{ repstopdf ~ #2 ~ #1 } |
| 319 |
} |
| 320 |
\tl_set:Nn \l_@@_final_name_str {#1} |
| 321 |
\@@_backend_getbb_pdf:n {#1} |
| 322 |
} |
| 323 |
\cs_new_protected:Npn \@@_backend_include_eps:n #1 |
| 324 |
{ |
| 325 |
\file_parse_full_name:nNNN {#1} |
| 326 |
\l_@@_backend_dir_str \l_@@_backend_name_str \l_@@_backend_ext_str |
| 327 |
\exp_args:Ne \@@_backend_include_pdf:n |
| 328 |
{ |
| 329 |
\exp_args:Ne \__kernel_file_name_quote:n |
| 330 |
{ |
| 331 |
\l_@@_backend_name_str |
| 332 |
- \str_tail:N \l_@@_backend_ext_str |
| 333 |
-converted-to.pdf |
| 334 |
} |
| 335 |
} |
| 336 |
} |
| 337 |
\cs_new_eq:NN \@@_backend_include_ps:n \@@_backend_include_eps:n |
| 338 |
} |
| 339 |
% \end{macrocode} |
| 340 |
% \end{variable} |
| 341 |
% \end{macro} |
| 342 |
% \end{macro} |
| 343 |
% \end{macro} |
| 344 |
% |
| 345 |
% \begin{macro}{\@@_backend_get_pagecount:n} |
| 346 |
% Simply load and store. |
| 347 |
% \begin{macrocode} |
| 348 |
\cs_new_protected:Npn \@@_backend_get_pagecount:n #1 |
| 349 |
{ |
| 350 |
\tex_pdfximage:D {#1} |
| 351 |
\int_const:cn { c_@@_ #1 _pages_int } |
| 352 |
{ \int_use:N \tex_pdflastximagepages:D } |
| 353 |
} |
| 354 |
% \end{macrocode} |
| 355 |
% \end{macro} |
| 356 |
% |
| 357 |
% \begin{macrocode} |
| 358 |
%</luatex|pdftex> |
| 359 |
% \end{macrocode} |
| 360 |
% |
| 361 |
% \subsection{\texttt{dvipdfmx} backend} |
| 362 |
% |
| 363 |
% \begin{macrocode} |
| 364 |
%<*dvipdfmx|xetex> |
| 365 |
% \end{macrocode} |
| 366 |
% |
| 367 |
% \begin{variable}[no-user-doc]{\l_graphics_search_ext_seq} |
| 368 |
% \begin{macrocode} |
| 369 |
\seq_set_from_clist:Nn \l_graphics_search_ext_seq |
| 370 |
{ .pdf , .eps , .ps , .png , .jpg , .jpeg , .bmp } |
| 371 |
% \end{macrocode} |
| 372 |
% \end{variable} |
| 373 |
% |
| 374 |
% \begin{macro} |
| 375 |
% { |
| 376 |
% \@@_backend_getbb_eps:n , \@@_backend_getbb_ps:n , |
| 377 |
% \@@_backend_getbb_jpg:n , \@@_backend_getbb_jpeg:n , |
| 378 |
% \@@_backend_getbb_pdf:n , \@@_backend_getbb_png:n , |
| 379 |
% \@@_backend_getbb_bmp:n |
| 380 |
% } |
| 381 |
% Simply use the generic functions: only for \texttt{dvipdfmx} in the |
| 382 |
% extraction cases. |
| 383 |
% \begin{macrocode} |
| 384 |
\cs_new_eq:NN \@@_backend_getbb_eps:n \@@_read_bb:n |
| 385 |
\cs_new_eq:NN \@@_backend_getbb_ps:n \@@_read_bb:n |
| 386 |
%<*dvipdfmx> |
| 387 |
\cs_new_protected:Npn \@@_backend_getbb_jpg:n #1 |
| 388 |
{ |
| 389 |
\int_zero:N \l_@@_page_int |
| 390 |
\tl_clear:N \l_@@_pagebox_tl |
| 391 |
\@@_extract_bb:n {#1} |
| 392 |
} |
| 393 |
\cs_new_eq:NN \@@_backend_getbb_jpeg:n \@@_backend_getbb_jpg:n |
| 394 |
\cs_new_eq:NN \@@_backend_getbb_png:n \@@_backend_getbb_jpg:n |
| 395 |
\cs_new_eq:NN \@@_backend_getbb_bmp:n \@@_backend_getbb_jpg:n |
| 396 |
\cs_new_protected:Npn \@@_backend_getbb_pdf:n #1 |
| 397 |
{ |
| 398 |
\tl_clear:N \l_@@_decodearray_str |
| 399 |
\bool_set_false:N \l_@@_interpolate_bool |
| 400 |
\@@_extract_bb:n {#1} |
| 401 |
} |
| 402 |
%</dvipdfmx> |
| 403 |
% \end{macrocode} |
| 404 |
% \end{macro} |
| 405 |
% |
| 406 |
% \begin{variable}{\l_@@_transgroup_bool} |
| 407 |
% Needed to indicate that a transparency group should be applied: only |
| 408 |
% currently for PDF images, but could be extended. |
| 409 |
% \begin{macrocode} |
| 410 |
\bool_new:N \l_@@_transgroup_bool |
| 411 |
% \end{macrocode} |
| 412 |
% \end{variable} |
| 413 |
% |
| 414 |
% \begin{variable}{\g_@@_track_int} |
| 415 |
% Used to track the object number associated with each graphic. |
| 416 |
% \begin{macrocode} |
| 417 |
\int_new:N \g_@@_track_int |
| 418 |
% \end{macrocode} |
| 419 |
% \end{variable} |
| 420 |
% |
| 421 |
% \begin{macro} |
| 422 |
% { |
| 423 |
% \@@_backend_include_eps:n , \@@_backend_include_ps:n , |
| 424 |
% \@@_backend_include_jpg:n , \@@_backend_include_jpseg:n , |
| 425 |
% \@@_backend_include_pdf:n , \@@_backend_include_png:n , |
| 426 |
% \@@_backend_include_bmp:n , |
| 427 |
% } |
| 428 |
% \begin{macro}{\@@_backend_include_auxi:n} |
| 429 |
% \begin{macro}{\@@_backend_include_auxii:nn, \@@_backend_include_auxii:en} |
| 430 |
% \begin{macro}{\@@_backend_include_auxiii:nn} |
| 431 |
% The special syntax depends on the file type. There is a difference in |
| 432 |
% how PDF graphics are best handled between |dvipdfmx| and \XeTeX{}: for |
| 433 |
% the latter it is better to use the primitive route. The relevant code for |
| 434 |
% that is included later in this file. |
| 435 |
% \begin{macrocode} |
| 436 |
\cs_new_protected:Npn \@@_backend_include_eps:n #1 |
| 437 |
{ |
| 438 |
\__kernel_backend_literal:e |
| 439 |
{ |
| 440 |
PSfile = #1 \c_space_tl |
| 441 |
llx = \dim_to_decimal_in_bp:n \l_@@_llx_dim \c_space_tl |
| 442 |
lly = \dim_to_decimal_in_bp:n \l_@@_lly_dim \c_space_tl |
| 443 |
urx = \dim_to_decimal_in_bp:n \l_@@_urx_dim \c_space_tl |
| 444 |
ury = \dim_to_decimal_in_bp:n \l_@@_ury_dim |
| 445 |
} |
| 446 |
} |
| 447 |
\cs_new_eq:NN \@@_backend_include_ps:n \@@_backend_include_eps:n |
| 448 |
% \end{macrocode} |
| 449 |
% Graphic inclusion is set up to use the fact that each image is stored in |
| 450 |
% the PDF as an XObject. This means that we can include repeated images |
| 451 |
% only once and refer to them. To allow that, track the nature of each |
| 452 |
% image: much the same as for the direct PDF mode case. |
| 453 |
% \begin{macrocode} |
| 454 |
\cs_new_protected:Npn \@@_backend_include_jpg:n #1 |
| 455 |
{ |
| 456 |
\bool_set_false:N \l_@@_transgroup_bool |
| 457 |
\@@_backend_include_auxi:n {#1} |
| 458 |
} |
| 459 |
\cs_new_eq:NN \@@_backend_include_jpeg:n \@@_backend_include_jpg:n |
| 460 |
\cs_new_eq:NN \@@_backend_include_bmp:n \@@_backend_include_jpg:n |
| 461 |
\cs_new_eq:NN \@@_backend_include_png:n \@@_backend_include_jpg:n |
| 462 |
\cs_new_protected:Npn \@@_backend_include_pdf:n #1 |
| 463 |
{ |
| 464 |
\bool_set_true:N \l_@@_transgroup_bool |
| 465 |
\@@_backend_include_auxi:n {#1} |
| 466 |
} |
| 467 |
\cs_new_protected:Npn \@@_backend_include_auxi:n #1 |
| 468 |
{ |
| 469 |
\@@_backend_include_auxii:en |
| 470 |
{ |
| 471 |
\tl_if_empty:NF \l_@@_pagebox_tl |
| 472 |
{ : \l_@@_pagebox_tl } |
| 473 |
\int_compare:nNnT \l_@@_page_int > 1 |
| 474 |
{ :P \int_use:N \l_@@_page_int } |
| 475 |
\tl_if_empty:NF \l_@@_decodearray_str |
| 476 |
{ :D \l_@@_decodearray_str } |
| 477 |
\bool_if:NT \l_@@_interpolate_bool |
| 478 |
{ :I } |
| 479 |
} |
| 480 |
{#1} |
| 481 |
} |
| 482 |
\cs_new_protected:Npn \@@_backend_include_auxii:nn #1#2 |
| 483 |
{ |
| 484 |
\int_if_exist:cTF { c_@@_ #2#1 _int } |
| 485 |
{ |
| 486 |
\__kernel_backend_literal:e |
| 487 |
{ pdf:usexobj~@graphic \int_use:c { c_@@_ #2#1 _int } } |
| 488 |
} |
| 489 |
{ \@@_backend_include_auxiii:nn {#2} {#1} } |
| 490 |
} |
| 491 |
\cs_generate_variant:Nn \@@_backend_include_auxii:nn { e } |
| 492 |
% \end{macrocode} |
| 493 |
% Inclusion using the specials is relatively straight-forward, but there |
| 494 |
% is one wrinkle. To get the |pagebox| correct for PDF graphics in all cases, |
| 495 |
% it is necessary to provide both that information and the |bbox| argument: |
| 496 |
% odd things happen otherwise! We use the \texttt{dvipdfmx} special in all |
| 497 |
% cases as it allows attributes to be added to the XObject. |
| 498 |
% \begin{macrocode} |
| 499 |
\cs_new_protected:Npn \@@_backend_include_auxiii:nn #1#2 |
| 500 |
{ |
| 501 |
\int_gincr:N \g_@@_track_int |
| 502 |
\int_const:cn { c_@@_ #1#2 _int } { \g_@@_track_int } |
| 503 |
\__kernel_backend_literal:e |
| 504 |
{ |
| 505 |
pdf:image ~ |
| 506 |
@graphic \int_use:c { c_@@_ #1#2 _int } ~ |
| 507 |
\int_compare:nNnT \l_@@_page_int > 1 |
| 508 |
{ page ~ \int_use:N \l_@@_page_int \c_space_tl } |
| 509 |
\tl_if_empty:NF \l_@@_pagebox_tl |
| 510 |
{ |
| 511 |
pagebox ~ \l_@@_pagebox_tl \c_space_tl |
| 512 |
bbox ~ |
| 513 |
\dim_to_decimal_in_bp:n \l_@@_llx_dim \c_space_tl |
| 514 |
\dim_to_decimal_in_bp:n \l_@@_lly_dim \c_space_tl |
| 515 |
\dim_to_decimal_in_bp:n \l_@@_urx_dim \c_space_tl |
| 516 |
\dim_to_decimal_in_bp:n \l_@@_ury_dim \c_space_tl |
| 517 |
} |
| 518 |
(#1) |
| 519 |
\bool_lazy_any:nT |
| 520 |
{ |
| 521 |
{ \l_@@_interpolate_bool } |
| 522 |
{ \l_@@_transgroup_bool } |
| 523 |
{ ! \tl_if_empty_p:N \l_@@_decodearray_str } |
| 524 |
} |
| 525 |
{ |
| 526 |
<< |
| 527 |
\tl_if_empty:NF \l_@@_decodearray_str |
| 528 |
{ /Decode~[ \l_@@_decodearray_str ] } |
| 529 |
\bool_if:NT \l_@@_transgroup_bool |
| 530 |
{ /Group << /S /Transparency /K ~ false /I ~ false >> } |
| 531 |
\bool_if:NT \l_@@_interpolate_bool |
| 532 |
{ /Interpolate~true } |
| 533 |
>> |
| 534 |
} |
| 535 |
} |
| 536 |
} |
| 537 |
% \end{macrocode} |
| 538 |
% \end{macro} |
| 539 |
% \end{macro} |
| 540 |
% \end{macro} |
| 541 |
% \end{macro} |
| 542 |
% |
| 543 |
% \begin{macro}{\@@_backend_get_pagecount:n} |
| 544 |
% \begin{macrocode} |
| 545 |
%<*dvipdfmx> |
| 546 |
\cs_new_eq:NN \@@_backend_get_pagecount:n \@@_get_pagecount:n |
| 547 |
%</dvipdfmx> |
| 548 |
% \end{macrocode} |
| 549 |
% \end{macro} |
| 550 |
% |
| 551 |
% \begin{macrocode} |
| 552 |
%</dvipdfmx|xetex> |
| 553 |
% \end{macrocode} |
| 554 |
% |
| 555 |
% \subsection{\XeTeX{} backend} |
| 556 |
% |
| 557 |
% \begin{macrocode} |
| 558 |
%<*xetex> |
| 559 |
% \end{macrocode} |
| 560 |
% |
| 561 |
% \begin{macro} |
| 562 |
% { |
| 563 |
% \@@_backend_getbb_jpg:n , |
| 564 |
% \@@_backend_getbb_jpeg:n , |
| 565 |
% \@@_backend_getbb_pdf:n , |
| 566 |
% \@@_backend_getbb_png:n , |
| 567 |
% \@@_backend_getbb_bmp:n |
| 568 |
% } |
| 569 |
% \begin{macro}{\@@_backend_getbb_auxi:nN} |
| 570 |
% \begin{macro}{\@@_backend_getbb_auxii:nnN, \@@_backend_getbb_auxii:VnN} |
| 571 |
% \begin{macro}{\@@_backend_getbb_auxiii:nNnn} |
| 572 |
% \begin{macro}{\@@_backend_getbb_auxiv:nnNnn, \@@_backend_getbb_auxiv:VnNnn} |
| 573 |
% \begin{macro}{\@@_backend_getbb_auxv:nNnn, \@@_backend_getbb_auxv:nNnn} |
| 574 |
% \begin{macro}[EXP]{\@@_backend_getbb_pagebox:w} |
| 575 |
% For \XeTeX{}, there are two primitives that allow us to obtain |
| 576 |
% the bounding box without needing \texttt{extractbb}. The only complexity |
| 577 |
% is passing the various minor variations to a common core process. The |
| 578 |
% \XeTeX{} primitive omits the text |box| from the page box specification, |
| 579 |
% so there is also some \enquote{trimming} to do here. |
| 580 |
% \begin{macrocode} |
| 581 |
\cs_new_protected:Npn \@@_backend_getbb_jpg:n #1 |
| 582 |
{ |
| 583 |
\int_zero:N \l_@@_page_int |
| 584 |
\tl_clear:N \l_@@_pagebox_tl |
| 585 |
\@@_backend_getbb_auxi:nN {#1} \tex_XeTeXpicfile:D |
| 586 |
} |
| 587 |
\cs_new_eq:NN \@@_backend_getbb_jpeg:n \@@_backend_getbb_jpg:n |
| 588 |
\cs_new_eq:NN \@@_backend_getbb_png:n \@@_backend_getbb_jpg:n |
| 589 |
\cs_new_eq:NN \@@_backend_getbb_bmp:n \@@_backend_getbb_jpg:n |
| 590 |
\cs_new_protected:Npn \@@_backend_getbb_pdf:n #1 |
| 591 |
{ |
| 592 |
\tl_clear:N \l_@@_decodearray_str |
| 593 |
\bool_set_false:N \l_@@_interpolate_bool |
| 594 |
\@@_backend_getbb_auxi:nN {#1} \tex_XeTeXpdffile:D |
| 595 |
} |
| 596 |
\cs_new_protected:Npn \@@_backend_getbb_auxi:nN #1#2 |
| 597 |
{ |
| 598 |
\int_compare:nNnTF \l_@@_page_int > 1 |
| 599 |
{ \@@_backend_getbb_auxii:VnN \l_@@_page_int {#1} #2 } |
| 600 |
{ \@@_backend_getbb_auxiii:nNnn {#1} #2 { :P 1 } { page 1 } } |
| 601 |
} |
| 602 |
\cs_new_protected:Npn \@@_backend_getbb_auxii:nnN #1#2#3 |
| 603 |
{ \@@_backend_getbb_auxiii:nNnn {#2} #3 { :P #1 } { page #1 } } |
| 604 |
\cs_generate_variant:Nn \@@_backend_getbb_auxii:nnN { V } |
| 605 |
\cs_new_protected:Npn \@@_backend_getbb_auxiii:nNnn #1#2#3#4 |
| 606 |
{ |
| 607 |
\tl_if_empty:NTF \l_@@_pagebox_tl |
| 608 |
{ \@@_backend_getbb_auxiv:VnNnn \l_@@_pagebox_tl } |
| 609 |
{ \@@_backend_getbb_auxv:nNnn } |
| 610 |
{#1} #2 {#3} {#4} |
| 611 |
} |
| 612 |
\cs_new_protected:Npn \@@_backend_getbb_auxiv:nnNnn #1#2#3#4#5 |
| 613 |
{ |
| 614 |
\use:e |
| 615 |
{ |
| 616 |
\@@_backend_getbb_auxv:nNnn {#2} #3 { : #1 #4 } |
| 617 |
{ |
| 618 |
#5 |
| 619 |
\tl_if_blank:nF {#1} |
| 620 |
{ \c_space_tl \@@_backend_getbb_pagebox:w #1 } |
| 621 |
} |
| 622 |
} |
| 623 |
} |
| 624 |
\cs_generate_variant:Nn \@@_backend_getbb_auxiv:nnNnn { V } |
| 625 |
\cs_new_protected:Npn \@@_backend_getbb_auxv:nNnn #1#2#3#4 |
| 626 |
{ |
| 627 |
\@@_bb_restore:nF {#1#3} |
| 628 |
{ \@@_backend_getbb_auxvi:nNnn {#1} #2 {#3} {#4} } |
| 629 |
} |
| 630 |
\cs_new_protected:Npn \@@_backend_getbb_auxvi:nNnn #1#2#3#4 |
| 631 |
{ |
| 632 |
\hbox_set:Nn \l_@@_tmp_box { #2 #1 ~ #4 } |
| 633 |
\dim_set:Nn \l_@@_urx_dim { \box_wd:N \l_@@_tmp_box } |
| 634 |
\dim_set:Nn \l_@@_ury_dim { \box_ht:N \l_@@_tmp_box } |
| 635 |
\@@_bb_save:n {#1#3} |
| 636 |
} |
| 637 |
\cs_new:Npn \@@_backend_getbb_pagebox:w #1 box {#1} |
| 638 |
% \end{macrocode} |
| 639 |
% \end{macro} |
| 640 |
% \end{macro} |
| 641 |
% \end{macro} |
| 642 |
% \end{macro} |
| 643 |
% \end{macro} |
| 644 |
% \end{macro} |
| 645 |
% \end{macro} |
| 646 |
% |
| 647 |
% \begin{macro}{\@@_backend_get_pagecount:n} |
| 648 |
% Very little to do here other than cover the case of a non-PDF file. |
| 649 |
% \begin{macrocode} |
| 650 |
\cs_new_protected:Npn \@@_backend_get_pagecount:n #1 |
| 651 |
{ |
| 652 |
\int_const:cn { c_@@_ #1 _pages_int } |
| 653 |
{ |
| 654 |
\int_max:nn |
| 655 |
{ \int_use:N \tex_XeTeXpdfpagecount:D #1 ~ } |
| 656 |
{ 1 } |
| 657 |
} |
| 658 |
} |
| 659 |
% \end{macrocode} |
| 660 |
% \end{macro} |
| 661 |
% |
| 662 |
% \begin{macrocode} |
| 663 |
%</xetex> |
| 664 |
% \end{macrocode} |
| 665 |
% |
| 666 |
% \subsection{\texttt{dvisvgm} backend} |
| 667 |
% |
| 668 |
% \begin{macrocode} |
| 669 |
%<*dvisvgm> |
| 670 |
% \end{macrocode} |
| 671 |
% |
| 672 |
% \begin{variable}[no-user-doc]{\l_graphics_search_ext_seq} |
| 673 |
% \begin{macrocode} |
| 674 |
\seq_set_from_clist:Nn \l_graphics_search_ext_seq |
| 675 |
{ .svg , .pdf , .eps , .ps , .png , .jpg , .jpeg } |
| 676 |
% \end{macrocode} |
| 677 |
% \end{variable} |
| 678 |
% |
| 679 |
% \begin{macro}{\@@_backend_getbb_svg:n} |
| 680 |
% \begin{macro}{\@@_backend_getbb_svg_auxi:nNn} |
| 681 |
% \begin{macro}{\@@_backend_getbb_svg_auxii:w} |
| 682 |
% \begin{macro} |
| 683 |
% { |
| 684 |
% \@@_backend_getbb_svg_auxiii:Nw , |
| 685 |
% \@@_backend_getbb_svg_auxiv:Nw , |
| 686 |
% \@@_backend_getbb_svg_auxv:Nw |
| 687 |
% } |
| 688 |
% \begin{macro}{\@@_backend_getbb_svg_auxvi:Nn} |
| 689 |
% \begin{macro}{\@@_backend_getbb_svg_auxvii:w} |
| 690 |
% This is relatively similar to reading bounding boxes for |.eps| files. Life |
| 691 |
% is though made more tricky as we cannot pick a single line for the data. So |
| 692 |
% we have to loop until we collect up both height and width. To do that, we |
| 693 |
% can use a marker value. We also have to allow for the default units of the |
| 694 |
% lengths: they are big points and may be omitted. |
| 695 |
% \begin{macrocode} |
| 696 |
\cs_new_protected:Npn \@@_backend_getbb_svg:n #1 |
| 697 |
{ |
| 698 |
\@@_bb_restore:nF {#1} |
| 699 |
{ |
| 700 |
\ior_open:Nn \l_@@_tmp_ior {#1} |
| 701 |
\ior_if_eof:NTF \l_@@_tmp_ior |
| 702 |
{ \msg_error:nnn { graphics } { graphic-not-found } {#1} } |
| 703 |
{ |
| 704 |
\dim_zero:N \l_@@_llx_dim |
| 705 |
\dim_zero:N \l_@@_lly_dim |
| 706 |
\dim_set:Nn \l_@@_urx_dim { -\c_max_dim } |
| 707 |
\dim_set:Nn \l_@@_ury_dim { -\c_max_dim } |
| 708 |
\ior_str_map_inline:Nn \l_@@_tmp_ior |
| 709 |
{ |
| 710 |
\dim_compare:nNnT \l_@@_urx_dim = { -\c_max_dim } |
| 711 |
{ |
| 712 |
\@@_backend_getbb_svg_auxi:nNn |
| 713 |
{ width } \l_@@_urx_dim {##1} |
| 714 |
} |
| 715 |
\dim_compare:nNnT \l_@@_ury_dim = { -\c_max_dim } |
| 716 |
{ |
| 717 |
\@@_backend_getbb_svg_auxi:nNn |
| 718 |
{ height } \l_@@_ury_dim {##1} |
| 719 |
} |
| 720 |
\bool_lazy_and:nnF |
| 721 |
{ \dim_compare_p:nNn \l_@@_urx_dim = { -\c_max_dim } } |
| 722 |
{ \dim_compare_p:nNn \l_@@_ury_dim = { -\c_max_dim } } |
| 723 |
{ \ior_map_break: } |
| 724 |
} |
| 725 |
\@@_bb_save:n {#1} |
| 726 |
} |
| 727 |
\ior_close:N \l_@@_tmp_ior |
| 728 |
} |
| 729 |
} |
| 730 |
\cs_new_protected:Npn \@@_backend_getbb_svg_auxi:nNn #1#2#3 |
| 731 |
{ |
| 732 |
\use:e |
| 733 |
{ |
| 734 |
\cs_set_protected:Npn \@@_backend_getbb_svg_auxii:w |
| 735 |
##1 \tl_to_str:n {#1} = ##2 \tl_to_str:n {#1} = ##3 |
| 736 |
\s_@@_stop |
| 737 |
} |
| 738 |
{ |
| 739 |
\tl_if_blank:nF {##2} |
| 740 |
{ |
| 741 |
\peek_remove_spaces:n |
| 742 |
{ |
| 743 |
\peek_meaning:NTF ' % ' |
| 744 |
{ \@@_backend_getbb_svg_auxiii:Nw #2 } |
| 745 |
{ |
| 746 |
\peek_meaning:NTF " % " |
| 747 |
{ \@@_backend_getbb_svg_auxiv:Nw #2 } |
| 748 |
{ \@@_backend_getbb_svg_auxv:Nw #2 } |
| 749 |
} |
| 750 |
} |
| 751 |
##2 \s_@@_stop |
| 752 |
} |
| 753 |
} |
| 754 |
\use:e |
| 755 |
{ |
| 756 |
\@@_backend_getbb_svg_auxii:w #3 |
| 757 |
\tl_to_str:n {#1} = \tl_to_str:n {#1} = |
| 758 |
\s_@@_stop |
| 759 |
} |
| 760 |
} |
| 761 |
\cs_new_protected:Npn \@@_backend_getbb_svg_auxii:w { } |
| 762 |
\cs_new_protected:Npn \@@_backend_getbb_svg_auxiii:Nw #1 ' #2 ' #3 \s_@@_stop |
| 763 |
{ \@@_backend_getbb_svg_auxvi:Nn #1 {#2} } |
| 764 |
\cs_new_protected:Npn \@@_backend_getbb_svg_auxiv:Nw #1 " #2 " #3 \s_@@_stop |
| 765 |
{ \@@_backend_getbb_svg_auxvi:Nn #1 {#2} } |
| 766 |
\cs_new_protected:Npn \@@_backend_getbb_svg_auxv:Nw #1 #2 ~ #3 \s_@@_stop |
| 767 |
{ \@@_backend_getbb_svg_auxvi:Nn #1 {#2} } |
| 768 |
\cs_new_protected:Npn \@@_backend_getbb_svg_auxvi:Nn #1#2 |
| 769 |
{ |
| 770 |
\tex_afterassignment:D \@@_backend_getbb_svg_auxvii:w |
| 771 |
\l_@@_tmp_dim #2 bp \scan_stop: |
| 772 |
\dim_set_eq:NN #1 \l_@@_tmp_dim |
| 773 |
} |
| 774 |
\cs_new_protected:Npn \@@_backend_getbb_svg_auxvii:w #1 \scan_stop: { } |
| 775 |
% \end{macrocode} |
| 776 |
% \end{macro} |
| 777 |
% \end{macro} |
| 778 |
% \end{macro} |
| 779 |
% \end{macro} |
| 780 |
% \end{macro} |
| 781 |
% \end{macro} |
| 782 |
% |
| 783 |
% \begin{macro}{\@@_backend_getbb_eps:n, \@@_backend_getbb_ps:n} |
| 784 |
% Simply use the generic function. |
| 785 |
% \begin{macrocode} |
| 786 |
\cs_new_eq:NN \@@_backend_getbb_eps:n \@@_read_bb:n |
| 787 |
\cs_new_eq:NN \@@_backend_getbb_ps:n \@@_read_bb:n |
| 788 |
% \end{macrocode} |
| 789 |
% \end{macro} |
| 790 |
% |
| 791 |
% \begin{macro}{\@@_backend_getbb_png:n, \@@_backend_getbb_jpg:n, \@@_backend_getbb_jpeg:n} |
| 792 |
% These can be included by extracting the bounding box data. |
| 793 |
% \begin{macrocode} |
| 794 |
\cs_new_protected:Npn \@@_backend_getbb_jpg:n #1 |
| 795 |
{ |
| 796 |
\int_zero:N \l_@@_page_int |
| 797 |
\tl_clear:N \l_@@_pagebox_tl |
| 798 |
\@@_extract_bb:n {#1} |
| 799 |
} |
| 800 |
\cs_new_eq:NN \@@_backend_getbb_jpeg:n \@@_backend_getbb_jpg:n |
| 801 |
\cs_new_eq:NN \@@_backend_getbb_png:n \@@_backend_getbb_jpg:n |
| 802 |
% \end{macrocode} |
| 803 |
% \end{macro} |
| 804 |
% |
| 805 |
% \begin{macro}{\@@_backend_getbb_pdf:n} |
| 806 |
% Same as for \texttt{dvipdfmx}: use the generic function |
| 807 |
% \begin{macrocode} |
| 808 |
\cs_new_protected:Npn \@@_backend_getbb_pdf:n #1 |
| 809 |
{ |
| 810 |
\tl_clear:N \l_@@_decodearray_str |
| 811 |
\bool_set_false:N \l_@@_interpolate_bool |
| 812 |
\@@_extract_bb:n {#1} |
| 813 |
} |
| 814 |
% \end{macrocode} |
| 815 |
% \end{macro} |
| 816 |
% |
| 817 |
% \begin{macro} |
| 818 |
% { |
| 819 |
% \@@_backend_include_eps:n , |
| 820 |
% \@@_backend_include_ps:n , |
| 821 |
% \@@_backend_include_pdf:n |
| 822 |
% } |
| 823 |
% \begin{macro}{\@@_backend_include:nn} |
| 824 |
% The special syntax is relatively clear here: remember we need PostScript |
| 825 |
% sizes here. (This is the same as the \texttt{dvips} code.) |
| 826 |
% \begin{macrocode} |
| 827 |
\cs_new_protected:Npn \@@_backend_include_eps:n #1 |
| 828 |
{ \@@_backend_include:nn { PSfile } {#1} } |
| 829 |
\cs_new_eq:NN \@@_backend_include_ps:n \@@_backend_include_eps:n |
| 830 |
\cs_new_protected:Npn \@@_backend_include_pdf:n #1 |
| 831 |
{ \@@_backend_include:nn { pdffile } {#1} } |
| 832 |
\cs_new_protected:Npn \@@_backend_include:nn #1#2 |
| 833 |
{ |
| 834 |
\__kernel_backend_literal:e |
| 835 |
{ |
| 836 |
#1 = #2 \c_space_tl |
| 837 |
llx = \dim_to_decimal_in_bp:n \l_@@_llx_dim \c_space_tl |
| 838 |
lly = \dim_to_decimal_in_bp:n \l_@@_lly_dim \c_space_tl |
| 839 |
urx = \dim_to_decimal_in_bp:n \l_@@_urx_dim \c_space_tl |
| 840 |
ury = \dim_to_decimal_in_bp:n \l_@@_ury_dim |
| 841 |
} |
| 842 |
} |
| 843 |
% \end{macrocode} |
| 844 |
% \end{macro} |
| 845 |
% \end{macro} |
| 846 |
% |
| 847 |
% \begin{macro} |
| 848 |
% { |
| 849 |
% \@@_backend_include_svg:n , |
| 850 |
% \@@_backend_include_png:n , |
| 851 |
% \@@_backend_include_jpg:n , |
| 852 |
% \@@_backend_include_jpeg:n |
| 853 |
% } |
| 854 |
% \begin{macro}{\@@_backend_include_dequote:w} |
| 855 |
% The backend here has built-in support for basic graphic inclusion (see |
| 856 |
% \texttt{dvisvgm.def} for a more complex approach, needed if clipping, |
| 857 |
% etc., is covered at the graphic backend level). We have to deal |
| 858 |
% with the fact that the image reference point is at the \emph{top}, so |
| 859 |
% there is a need for a vertical shift to put it in the right place. |
| 860 |
% The other issue is that |#1| must be quote-corrected. The |
| 861 |
% \texttt{dvisvgm:img} operation quotes the file name, but if it is already |
| 862 |
% quoted (contains spaces) then we have an issue: we simply strip off any |
| 863 |
% quotes as a result. |
| 864 |
% \begin{macrocode} |
| 865 |
\cs_new_protected:Npn \@@_backend_include_svg:n #1 |
| 866 |
{ |
| 867 |
\box_move_up:nn { \l_@@_ury_dim } |
| 868 |
{ |
| 869 |
\hbox:n |
| 870 |
{ |
| 871 |
\__kernel_backend_literal:e |
| 872 |
{ |
| 873 |
dvisvgm:img~ |
| 874 |
\dim_to_decimal:n { \l_@@_urx_dim } ~ |
| 875 |
\dim_to_decimal:n { \l_@@_ury_dim } ~ |
| 876 |
\@@_backend_include_dequote:w #1 " #1 " \s_@@_stop |
| 877 |
} |
| 878 |
} |
| 879 |
} |
| 880 |
} |
| 881 |
\cs_new_eq:NN \@@_backend_include_png:n \@@_backend_include_svg:n |
| 882 |
\cs_new_eq:NN \@@_backend_include_jpeg:n \@@_backend_include_svg:n |
| 883 |
\cs_new_eq:NN \@@_backend_include_jpg:n \@@_backend_include_svg:n |
| 884 |
\cs_new:Npn \@@_backend_include_dequote:w #1 " #2 " #3 \s_@@_stop |
| 885 |
{#2} |
| 886 |
% \end{macrocode} |
| 887 |
% \end{macro} |
| 888 |
% \end{macro} |
| 889 |
% |
| 890 |
% \begin{macro}{\@@_backend_get_pagecount:n} |
| 891 |
% \begin{macrocode} |
| 892 |
\cs_new_eq:NN \@@_backend_get_pagecount:n \@@_get_pagecount:n |
| 893 |
% \end{macrocode} |
| 894 |
% \end{macro} |
| 895 |
% |
| 896 |
% \begin{macrocode} |
| 897 |
%</dvisvgm> |
| 898 |
% \end{macrocode} |
| 899 |
% |
| 900 |
% \begin{macrocode} |
| 901 |
%</package> |
| 902 |
% \end{macrocode} |
| 903 |
% |
| 904 |
% \end{implementation} |
| 905 |
% |
| 906 |
% \PrintIndex |