%%
%% This is file `lettrine-xetex-bidi.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bidi.dtx  (with options: `table,lettrine-xetex-bidi.def')
%% 
%%   __________________________________________________
%%   Copyright (c) 2009--2017  Vafa Khalighi <persian-tex@tug.org>
%% 
%%   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 “author-maintained” (as per LPPL maintenance status)
%%   by Vafa Khalighi.
%% 
%% 
%% \CheckSum{48388}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\ProvidesFile{lettrine-xetex-bidi.def}[2015/02/17 v0.5 bidi adaptations for lettrine package for XeTeX engine]
\def\@lettrine[#1]#2#3{%
  \setcounter{L@lines}{\theDefaultLines}%
  \setcounter{L@depth}{\theDefaultDepth}%
  \renewcommand*{\L@hang}{\DefaultLhang}%
  \renewcommand*{\L@oversize}{\DefaultLoversize}%
  \renewcommand*{\L@raise}{\DefaultLraise}%
  \renewcommand*{\L@ante}{}%
  \setlength{\L@Findent}{\DefaultFindent}%
  \setlength{\L@Nindent}{\DefaultNindent}%
  \setlength{\L@slope}{\DefaultSlope}%
  \setlength{\L@novskip}{\DiscardVskip}%
  \ifLettrineImage\L@imagetrue\else\L@imagefalse\fi
  \ifLettrineOnGrid\L@gridtrue\else\L@gridfalse\fi
  \if\DefaultOptionsFile\relax
  \else
    \begingroup
    \InputIfFileExists{\DefaultOptionsFile}%
      {}%
      {\PackageWarning{lettrine.sty}%
         {File \DefaultOptionsFile\space not found}%
      }%
    \def\color##1##{\l@color{##1}}%
    \let\l@color\@gobbletwo
    \def\textcolor##1##{\l@textcolor{##1}}%
    \def\l@textcolor##1##2##3{##3}%
    \expandafter\ifx\csname l@#2-keys\endcsname\relax
                  \gdef\l@LOKeys{}%
                \else
                  \xdef\l@LOKeys{\csname l@#2-keys\endcsname}%
                \fi
    \endgroup
    \def\KV@prefix{KV@L@}%
    \let\@tempc\relax
    \expandafter\KV@do\l@LOKeys,\relax,
    \sbox{\L@lbox}{\LettrineFont #2}%
    \setlength{\LettrineWidth}{\wd\L@lbox}%
    \def\KV@prefix{KV@L@}%
    \let\@tempc\relax
    \expandafter\KV@do\l@LOKeys,\relax,
  \fi
  \setkeys{L}{#1}%
  \ifL@image
     \sbox{\L@lbox}{\LettrineFontEPS{#2}}%
  \else
     \sbox{\L@lbox}{\LettrineFont #2}%
  \fi
  \sbox{\L@tbox}{\LettrineTextFont{#3}}%
   \@tempdima=\baselineskip
   \ifnum\theL@lines=1
     \setlength{\L@first}{\ht\L@lbox}%
     \addtolength{\L@first}{-\ht\L@tbox}%
     \setlength{\L@lraise}{\z@}%
   \else
     \setlength{\L@first}{-\theL@lines\@tempdima}%
     \addtolength{\L@first}{\@tempdima}%
     \sbox{\@tempboxa}{\LettrineTextFont x}%
     \addtolength{\L@first}{-\ht\@tempboxa}%
     \setlength{\L@lraise}{-\L@raise\L@first}%
     \addtolength{\L@first}{\L@lraise}%
     \addtolength{\L@first}{\ht\L@lbox}%
     \addtolength{\L@lraise}{-\theL@lines\@tempdima}%
     \addtolength{\L@lraise}{\@tempdima}%
   \fi
   \par
   \ifdim\L@first>\L@novskip
     \ifL@grid
       \@tempdima=\baselineskip
       \@tempdimb=\@tempdima
       \advance\@tempdimb by \L@novskip
       \@tempcnta=1
       \loop\ifdim\L@first>\@tempdimb
         \advance\@tempcnta by 1
         \advance\L@first by -\@tempdima
       \repeat
       \vskip\@tempcnta\baselineskip
     \else
       \vskip\L@first
     \fi
   \fi
  \setlength{\L@Pindent}{\wd\L@lbox}%
  \addtolength{\L@Pindent}{-\L@hang\wd\L@lbox}%
  \settowidth{\L@first}{\L@ante}%
  \addtolength{\L@Pindent}{\L@first}%
  \addtolength{\L@Pindent}{\L@Findent}%
  \setlength{\L@first}{\linewidth}%
  \addtolength{\L@first}{-\L@Pindent}%
  \addtolength{\L@Nindent}{\L@Pindent}%
  \setlength{\L@next}{\linewidth}%
  \addtolength{\L@next}{-\L@Nindent}%
  \addtolength{\L@Pindent}{\rightmargin}%
  \addtolength{\L@Nindent}{\rightmargin}%
  \setlength{\LettrineWidth}{\wd\L@lbox}%
  \setlength{\LettrineHeight}{\ht\L@lbox}%
  \setlength{\LettrineDepth}{\dp\L@lbox}%
  \addtocounter{L@lines}{1}%
  \addtocounter{L@lines}{\the\c@L@depth}%
  \if@RTL\def\L@parshape{\c@L@lines 0pt \the\L@first}\else\def\L@parshape{\c@L@lines \the\L@Pindent \the\L@first}\fi
  \@tempcnta=\tw@
  \@whilenum \@tempcnta<\c@L@lines\do{%
     \if@RTL\edef\L@parshape{\L@parshape 0pt \the\L@next}\else\edef\L@parshape{\L@parshape \the\L@Nindent \the\L@next}\fi
     \addtolength{\L@Nindent}{\L@slope}%
     \addtolength{\L@next}{-\L@slope}%
     \advance\@tempcnta\@ne}%
  \if@RTL \edef\L@parshape{\L@parshape 0pt \the\linewidth}\else\edef\L@parshape{\L@parshape \rightmargin \the\linewidth}\fi
  \noindent
  \parshape=\L@parshape\relax
  \smash{\llap{\mbox{\L@ante}\raisebox{\L@lraise}{\usebox{\L@lbox}}%
          \hskip \the\L@Findent}}%
  \usebox{\L@tbox}%
}
\endinput
%%
%% End of file `lettrine-xetex-bidi.def'.
