blob: e58ce34b19beafd6760dcfb478a6ac9d59ff6af2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
%%
%% This is file `graphicx-xetex-bidi.def'.
%%
%% ______________________________________
%% Copyright © 2009–2013 Vafa Khalighi
%%
%% License information appended.
%%
%%
\ProvidesFile{graphicx-xetex-bidi.def}[2012/01/01 v0.4 bidi adaptations for graphicx package for XeTeX engine]
\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@iii[#1,#2][#3,#4]#5{%
\begingroup
\ifmmode\else\if@RTL\beginL\fi\fi
\Gin@bboxtrue
\Gin@defaultbp\Gin@llx{#1}%
\Gin@defaultbp\Gin@lly{#2}%
\Gin@defaultbp\Gin@urx{#3}%
\Gin@defaultbp\Gin@ury{#4}%
\Ginclude@graphics{#5}%
\ifmmode\else\if@RTL\endL\fi\fi
\endgroup}
\def\Gin@ii[#1]#2{%
\def\@tempa{[}\def\@tempb{#2}%
\ifx\@tempa\@tempb
\def\@tempa{\Gin@iii[#1][}%
\expandafter\@tempa
\else
\begingroup
\ifmmode\else\if@RTL\beginL\fi\fi
\@tempswafalse
\toks@{\Ginclude@graphics{#2}}%
\setkeys{Gin}{#1}%
\Gin@esetsize
\the\toks@
\ifmmode\else\if@RTL\endL\fi\fi
\endgroup
\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–2013 Vafa Khalighi <vafakh@me.com>
%%
%% It may be distributed and/or modified under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%%
%% This work is “maintained” (as per LPPL maintenance status)
%% by Vafa Khalighi.
%%
%%
%%
%%
%% End of file `graphicx-xetex-bidi.def'.
|