summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def')
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def107
1 files changed, 97 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def
index c46d3570e88..71b4c27904e 100644
--- a/Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def
+++ b/Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def
@@ -1,18 +1,39 @@
%%
%% This is file `graphicx-bidi.def',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% bidi.dtx (with options: `graphicx-bidi.def')
+
%%
%% __________________________________
-%% Copyright © 2009 Vafa Khalighi
+%% Copyright © 2009-2010 Vafa Khalighi
%%
%% License information appended.
%%
%%
-\def\Gin@ii[#1]#2{%
+\ProvidesFile{graphicx-bidi.def}[2010/03/01 v0.3 adaptations for graphicx package]
+\def\Grot@box@std#1#2{\ifmmode\else\if@RTL\beginL\fi\fi%
+ \Grot@setangle{#1}%
+ \setbox\z@\hbox{{\ifmmode\if@RTL\beginR\fi#2\if@RTL\endR\fi\else\if@RTL\beginR\fi#2\if@RTL\endR\fi\fi}}%
+ \Grot@x\z@
+ \Grot@y\z@
+ \Grot@box\ifmmode\else\if@RTL\endL\fi\fi}
+\long\def\Gscale@box#1[#2]#3{\ifmmode\else\if@RTL\beginL\fi\fi%
+ \leavevmode
+ \def\Gscale@x{#1}\def\Gscale@y{#2}%
+ \setbox\z@\hbox{{#3}}%
+ \setbox\tw@\hbox{\Gscale@start\rlap{\copy\z@}\Gscale@end}%
+ \ifdim#2\p@<\z@
+ \ht\tw@-#2\dp\z@
+ \dp\tw@-#2\ht\z@
+ \else
+ \ht\tw@#2\ht\z@
+ \dp\tw@#2\dp\z@
+ \fi
+ \ifdim#1\p@<\z@
+ \hb@xt@-#1\wd\z@{\kern-#1\wd\z@\box\tw@\hss}%
+ \else
+ \wd\tw@#1\wd\z@
+ \box\tw@
+ \fi\ifmmode\else\if@RTL\endL\fi\fi}
+\def\Gin@ii[#1]#2{\ifmmode\else\if@RTL\beginL\fi\fi%
\def\@tempa{[}\def\@tempb{#2}%
\ifx\@tempa\@tempb
\def\@tempa{\Gin@iii[#1][}%
@@ -20,14 +41,80 @@
\else
\begingroup
\@tempswafalse
- \toks@{\beginL\Ginclude@graphics{#2}\endL}%
+ \toks@{\Ginclude@graphics{#2}}%
\setkeys{Gin}{#1}%
\Gin@esetsize
\the\toks@
\endgroup
- \fi}%
+ \fi\ifmmode\else\if@RTL\endL\fi\fi}
+\def\reflectbox{\bidiGscale@box-1[1]}
+\long\def\bidiGscale@box#1[#2]#3{\ifmmode\else\if@RTL\beginL\fi\fi%
+ \leavevmode
+ \def\Gscale@x{#1}\def\Gscale@y{#2}%
+ \setbox\z@\hbox{{\ifmmode\if@RTL\beginR\fi#3\if@RTL\endR\fi\else\if@RTL\beginR\fi#3\if@RTL\endR\fi\fi}}%
+ \setbox\tw@\hbox{\Gscale@start\rlap{\copy\z@}\Gscale@end}%
+ \ifdim#2\p@<\z@
+ \ht\tw@-#2\dp\z@
+ \dp\tw@-#2\ht\z@
+ \else
+ \ht\tw@#2\ht\z@
+ \dp\tw@#2\dp\z@
+ \fi
+ \ifdim#1\p@<\z@
+ \hb@xt@-#1\wd\z@{\kern-#1\wd\z@\box\tw@\hss}%
+ \else
+ \wd\tw@#1\wd\z@
+ \box\tw@
+ \fi\ifmmode\else\if@RTL\endL\fi\fi}
+\def\scalebox#1{%
+ \@ifnextchar[{\bidiGscale@box{#1}}{\bidiGscale@box{#1}[#1]}}
+\def\resizebox{%
+ \leavevmode
+ \@ifstar{\bidiGscale@@box\totalheight}{\bidiGscale@@box\height}}
+\def\bidiGscale@@box#1#2#3{%
+ \let\@tempa\Gin@exclamation
+ \expandafter\def\expandafter\@tempb\expandafter{\string#2}%
+ \expandafter\def\expandafter\@tempc\expandafter{\string#3}%
+ \ifx\@tempb\@tempa
+ \ifx\@tempc\@tempa
+ \toks@{\mbox}%
+ \else
+ \toks@{\bidiGscale@box@dd{#3}#1}%
+ \fi
+ \else
+ \ifx\@tempc\@tempa
+ \toks@{\bidiGscale@box@dd{#2}\width}%
+ \else
+ \toks@{\bidiGscale@box@dddd{#2}\width{#3}#1}%
+ \fi
+ \fi
+ \the\toks@}
+\long\def\bidiGscale@box@dd#1#2#3{%
+ \@begin@tempboxa\hbox{\ifmmode\if@RTL\beginR\fi#3\if@RTL\endR\fi\else\if@RTL\beginR\fi#3\if@RTL\endR\fi\fi}%
+ \setlength\@tempdima{#1}%
+ \setlength\@tempdimb{#2}%
+ \Gscale@div\@tempa\@tempdima\@tempdimb
+ \Gscale@box\@tempa[\@tempa]{\box\@tempboxa}%
+ \@end@tempboxa}
+\long\def\bidiGscale@box@dddd#1#2#3#4#5{%
+ \@begin@tempboxa\hbox{\ifmmode\if@RTL\beginR\fi#5\if@RTL\endR\fi\else\if@RTL\beginR\fi#5\if@RTL\endR\fi\fi}%
+ \setlength\@tempdima{#1}%
+ \setlength\@tempdimb{#2}%
+ \Gscale@div\@tempa\@tempdima\@tempdimb
+ \setlength\@tempdima{#3}%
+ \setlength\@tempdimb{#4}%
+ \Gscale@div\@tempb\@tempdima\@tempdimb
+ \ifGin@iso
+ \ifdim\@tempa\p@>\@tempb\p@
+ \let\@tempa\@tempb
+ \else
+ \let\@tempb\@tempa
+ \fi
+ \fi
+ \Gscale@box\@tempa[\@tempb]{\box\@tempboxa}%
+ \@end@tempboxa}
%%
-%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%% Copyright © 2009-2010 by Vafa Khalighi <vafa@users.berlios.de>
%%
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of