summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-07-04 21:23:20 +0000
committerKarl Berry <karl@freefriends.org>2021-07-04 21:23:20 +0000
commitf262a7d129a86f7fa0eb16a7106ee426eee88d42 (patch)
treec93c9239fd5c147daf43ac9b0d5fec878956c25a /Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty
parent2026845171ebe3af57cd37c7d03ebf1b2970a62c (diff)
lwarp
git-svn-id: svn://tug.org/texlive/trunk@59834 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty')
-rw-r--r--Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty136
1 files changed, 72 insertions, 64 deletions
diff --git a/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty b/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty
index 8611329fb78..6a5d70df83e 100644
--- a/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty
+++ b/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty
@@ -50,6 +50,10 @@
\newcommand*{\LWR@igangle}{}
\newcommand*{\LWR@igxscale}{1}
\newcommand*{\LWR@igyscale}{1}
+
+\newbool{LWR@igkeepaspectratio}
+\boolfalse{LWR@igkeepaspectratio}
+
\newcommand*{\LWR@igclass}{inlineimage}
\newcommand*{\LWR@igalt}{\ImageAltText}
@@ -93,6 +97,9 @@
{}% not px
}{}% end of length > 0pt
}
+\define@key{igraph}{keepaspectratio}[false]{%
+ \booltrue{LWR@igkeepaspectratio}%
+}
\define@key{igraph}{origin}[c]{%
\renewcommand*{\LWR@igorigin}{#1}%
}
@@ -120,7 +127,6 @@
\define@key{igraph}{viewport}{}
\define@key{igraph}{trim}{}
\define@key{igraph}{totalheight}{}
-\define@key{igraph}{keepaspectratio}[true]{}
\define@key{igraph}{clip}[true]{}
\define@key{igraph}{draft}[true]{}
\define@key{igraph}{type}{}
@@ -170,83 +176,81 @@
}%
}
-\newcommand*{\LWR@ig@wpimagesizes}[4]{%
- \ifbool{FormatWP}{%
- \begingroup%
- \LWR@restoreorigformatting%
- \ifpdf%
- \appto\LWR@restoreorigformatting{%
- \DeclareGraphicsExtensions{%
- .pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
- }%
+\newcommand*{\LWR@ig@useactualimagesize}[4]{%
+ \begingroup%
+ \LWR@restoreorigformatting%
+ \ifpdf%
+ \appto\LWR@restoreorigformatting{%
+ \DeclareGraphicsExtensions{%
+ .pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
}%
- \else% \ifpdf
- \ifXeTeX%
- \appto\LWR@restoreorigformatting{%
- \DeclareGraphicsExtensions{%
- .pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
- }%
+ }%
+ \else% \ifpdf
+ \ifXeTeX%
+ \appto\LWR@restoreorigformatting{%
+ \DeclareGraphicsExtensions{%
+ .pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
}%
- \else%
- \appto\LWR@restoreorigformatting{%
- \DeclareGraphicsExtensions{%
- .eps,.EPS,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
+ }%
+ \else%
+ \appto\LWR@restoreorigformatting{%
+ \DeclareGraphicsExtensions{%
+ .eps,.EPS,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
+ }%
+ }%
+ \fi%
+ \fi% \ifpdf
+ \ifbool{FormatWP}{\define@key{Gin}{angle}{}}{}%
+ \IfBooleanTF{#1}%
+ {% starred
+ \IfValueTF{#3}%
+ {%
+ \global\sbox{\LWR@imagesizebox}{%
+ \LWR@origincludegraphics*[#2][#3]{#4}%
}%
}%
- \fi%
- \fi% \ifpdf
- \define@key{Gin}{angle}{}%
- \IfBooleanTF{#1}%
- {% starred
- \IfValueTF{#3}%
+ {%
+ \IfValueTF{#2}%
{%
\global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics*[#2][#3]{#4}%
+ \LWR@origincludegraphics*[#2]{#4}%
}%
- }%
- {%
- \IfValueTF{#2}%
- {%
- \global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics*[#2]{#4}%
- }%
- }{%
- \global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics*{#4}%
- }%
+ }{%
+ \global\sbox{\LWR@imagesizebox}{%
+ \LWR@origincludegraphics*{#4}%
}%
}%
- }% starred
- {% not starred
- \IfValueTF{#3}%
+ }%
+ }% starred
+ {% not starred
+ \IfValueTF{#3}%
+ {%
+ \global\sbox{\LWR@imagesizebox}{%
+ \LWR@origincludegraphics[#2][#3]{#4}%
+ }%
+ }%
+ {%
+ \IfValueTF{#2}%
{%
\global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics[#2][#3]{#4}%
+ \LWR@origincludegraphics[#2]{#4}%
}%
- }%
- {%
- \IfValueTF{#2}%
- {%
- \global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics[#2]{#4}%
- }%
- }{%
- \global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics{#4}%
- }%
+ }{%
+ \global\sbox{\LWR@imagesizebox}{%
+ \LWR@origincludegraphics{#4}%
}%
}%
- }% not starred
- \endgroup%
- \settowidth{\LWR@igwidth}{\usebox{\LWR@imagesizebox}}%
- \global\renewcommand*{\LWR@igwidthstyle}{%
- width:\LWR@printlength{\LWR@igwidth}%
- }%
- \settoheight{\LWR@igheight}{\usebox{\LWR@imagesizebox}}%
- \global\renewcommand*{\LWR@igheightstyle}{%
- height:\LWR@printlength{\LWR@igheight}%
}%
- }{}% FormatWP
+ }% not starred
+ \endgroup%
+ \settowidth{\LWR@igwidth}{\usebox{\LWR@imagesizebox}}%
+ \global\renewcommand*{\LWR@igwidthstyle}{%
+ width:\LWR@printlength{\LWR@igwidth}%
+ }%
+ \settoheight{\LWR@igheight}{\usebox{\LWR@imagesizebox}}%
+ \global\renewcommand*{\LWR@igheightstyle}{%
+ height:\LWR@printlength{\LWR@igheight}%
+ }%
}
\newcommand*{\LWR@ig@htmltag}{%
@@ -316,6 +320,7 @@
\renewcommand*{\LWR@igxscale}{1}%
\renewcommand*{\LWR@igyscale}{1}%
\renewcommand*{\LWR@igclass}{inlineimage}%
+ \boolfalse{LWR@igkeepaspectratio}%
\ifdefvoid{\LWR@ThisAltText}{%
\edef\LWR@igalt{\ImageAltText}%
}{%
@@ -338,7 +343,10 @@
\filename@parse{\LWR@parsedfilename}%
\StrSubstitute{\LWR@parsedfilename}{//}{/}[\LWR@parsedfilename]%
\LWR@traceinfo{LWR@parsedfilename is \LWR@parsedfilename}%
- \LWR@ig@wpimagesizes{#1}{#2}{#3}{#4}%
+ \ifboolexpr{
+ bool {FormatWP} or
+ bool {LWR@igkeepaspectratio}
+ }{\LWR@ig@useactualimagesize{#1}{#2}{#3}{#4}}{}%
\LWR@traceinfo{LWR@includegraphicsb: about to create href}%
\LWR@href{\LWR@parsedfilename}%
{% start of href