blob: 61671f0d514acc0f4ac1a77e728f1fd9aea7297c (
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
|
%%
%% This is file `xcolor-xetex-bidi.def'.
%%
%% ______________________________________
%% Copyright © 2009–2013 Vafa Khalighi
%%
%% License information appended.
%%
%%
\ProvidesFile{xcolor-xetex-bidi.def}[2013/04/08 v0.2 bidi adaptations for xcolor package for XeTeX engine]
\long\def\color@b@x#1#2#3%
{\leavevmode\ifmmode\else\if@RTL\beginL\fi\fi
\setbox\z@\hbox{\kern\fboxsep{\set@color\if@RTL\beginR\fi#3\if@RTL\endR\fi}\kern\fboxsep}%
\dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@
\dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@
{#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}\ifmmode\else\if@RTL\endL\fi\fi}
\def\normalcolor{\let\current@color\default@color\ifhmode\if@RTL\beginL\aftergroup\endR\fi\fi\set@color\ifhmode\if@RTL\beginR\aftergroup\endL\fi\fi}
\DeclareRobustCommand\color
{\ifhmode\if@RTL\beginL\aftergroup\endR\fi\fi\@ifnextchar[\@undeclaredcolor\@declaredcolor}
\def\@undeclaredcolor[#1]#2%
{\begingroup
\let\@@cls\@empty
\XC@getmodclr12{#1}{#2}{}%
{\ifblendcolors
\ifx\colorblend\@empty\else
\edef\@@mix{\expandafter\@gobble\colorblend}\@tempswafalse
\XC@coremodel\@@mod\@@clr\@xcolor@{}{}\@@mod\@@clr
\fi
\fi
\ifconvertcolorsU
\edef\@@tmp{\XC@tgt@mod{\@@mod}}%
\convertcolorspec\@@mod\@@clr\@@tmp\@@clr \let\@@mod\@@tmp
\fi
\ifmaskcolors
\convertcolorspec\@@mod\@@clr\XC@mmod\@@clr
\let\@@mod\XC@mmod
\XC@inflate\@@mod\XC@mclr\@@clr\@@tmp
\expandafter\XC@mul\@@tmp,\@@clr
\fi
\edef\@@tmp{\noexpand\XC@undeclaredcolor{\@@mod}{\@@clr}}%
\expandafter\endgroup\@@tmp}}
\def\@declaredcolor#1%
{\XC@edef\XC@@tmp{#1}\XC@@tstfalse
\ifcase\XC@type\XC@@tmp\relax \XC@@tsttrue\or \relax\else
\ifblendcolors\XC@@tsttrue\fi \ifmaskcolors\XC@@tsttrue\fi
\ifconvertcolorsU\XC@@tsttrue\fi
\fi
\ifXC@@tst
\expandafter\XC@declaredcolor\else
\expandafter\XC@declaredc@lor\fi}
\def\XC@undeclaredcolor#1#2%
{\@ifundefinedmodel{#1}%
{\c@lor@error{model `#1'}}%
{\@nameuse{color@#1}\current@color{#2}%
\edef\XC@current@color{\noexpand\xcolor@{}{\current@color}{#1}{#2}}%
\XC@display}\ifhmode\if@RTL\beginR\aftergroup\endL\fi\fi\ignorespaces}
\def\XC@declaredc@lor
{\XC@let@Nc\XC@current@color{\string\color@\XC@@tmp}%
\edef\current@color{\XC@current@color}%
\XC@display\ifhmode\if@RTL\beginR\aftergroup\endL\fi\fi\ignorespaces}
\DeclareRobustCommand\bidicolor
{\@ifnextchar[\@bidiundeclaredcolor\@bidideclaredcolor}
\def\@bidiundeclaredcolor[#1]#2%
{\begingroup
\let\@@cls\@empty
\XC@getmodclr12{#1}{#2}{}%
{\ifblendcolors
\ifx\colorblend\@empty\else
\edef\@@mix{\expandafter\@gobble\colorblend}\@tempswafalse
\XC@coremodel\@@mod\@@clr\@xcolor@{}{}\@@mod\@@clr
\fi
\fi
\ifconvertcolorsU
\edef\@@tmp{\XC@tgt@mod{\@@mod}}%
\convertcolorspec\@@mod\@@clr\@@tmp\@@clr \let\@@mod\@@tmp
\fi
\ifmaskcolors
\convertcolorspec\@@mod\@@clr\XC@mmod\@@clr
\let\@@mod\XC@mmod
\XC@inflate\@@mod\XC@mclr\@@clr\@@tmp
\expandafter\XC@mul\@@tmp,\@@clr
\fi
\edef\@@tmp{\noexpand\XC@bidiundeclaredcolor{\@@mod}{\@@clr}}%
\expandafter\endgroup\@@tmp}}
\def\XC@bidiundeclaredcolor#1#2%
{\@ifundefinedmodel{#1}%
{\c@lor@error{model `#1'}}%
{\@nameuse{color@#1}\current@color{#2}%
\edef\XC@current@color{\noexpand\xcolor@{}{\current@color}{#1}{#2}}%
\XC@display}}
\def\@bidideclaredcolor#1%
{\XC@edef\XC@@tmp{#1}\XC@@tstfalse
\ifcase\XC@type\XC@@tmp\relax \XC@@tsttrue\or \relax\else
\ifblendcolors\XC@@tsttrue\fi \ifmaskcolors\XC@@tsttrue\fi
\ifconvertcolorsU\XC@@tsttrue\fi
\fi
\ifXC@@tst
\expandafter\XC@bidideclaredcolor\else
\expandafter\XC@bidideclaredc@lor\fi}
\def\XC@bidideclaredcolor
{\XC@split\XC@@tmp
\edef\@@tmp{\noexpand\@bidiundeclaredcolor[\@@mod]{\@@clr}}%
\expandafter\endgroup\@@tmp}
\def\XC@bidideclaredc@lor
{\XC@let@Nc\XC@current@color{\string\color@\XC@@tmp}%
\edef\current@color{\XC@current@color}%
\XC@display}
\def\color@box#1#2{\color@b@x\relax{\bidicolor#1{#2}}}
\def\color@fbox#1#2#3#{\protect\color@fb@x{#1}{#2}{#3}}
\def\color@fb@x#1#2#3#4%
{\color@b@x{\fboxsep\z@\bidicolor#1{#2}\XC@fbox}%
{\@ifxempty{#3}{\bidicolor#1}{\bidicolor#3}{#4}}}
\def\color@setgroup{\begingroup\ifhmode\if@RTL\beginL\aftergroup\endR\fi\fi\set@color\ifhmode\if@RTL\beginR\aftergroup\endL\fi\fi}
%%
%% 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 `xcolor-xetex-bidi.def'.
|