From c2230efaa8f8b651f718cc78e0806f6dc1c5a7dd Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 27 May 2022 20:42:19 +0000
Subject: bidi (27may22)

git-svn-id: svn://tug.org/texlive/trunk@63414 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/xelatex/bidi/scrreprt-xetex-bidi.def       | 95 +++++++++++++++++++++-
 1 file changed, 91 insertions(+), 4 deletions(-)

(limited to 'Master/texmf-dist/tex/xelatex/bidi/scrreprt-xetex-bidi.def')

diff --git a/Master/texmf-dist/tex/xelatex/bidi/scrreprt-xetex-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/scrreprt-xetex-bidi.def
index 39df770cb64..00f0fc0fc42 100644
--- a/Master/texmf-dist/tex/xelatex/bidi/scrreprt-xetex-bidi.def
+++ b/Master/texmf-dist/tex/xelatex/bidi/scrreprt-xetex-bidi.def
@@ -20,7 +20,7 @@
 %%   by Vafa Khalighi.
 %% 
 %% 
-%% \CheckSum{51690}
+%% \CheckSum{52030}
 %% \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
@@ -37,7 +37,7 @@
 %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
 %%   Right brace   \}     Tilde         \~}
 %%
-\ProvidesFile{scrreprt-xetex-bidi.def}[2022/05/22 v1.2 bidi adaptations for scrreprt class for XeTeX engine]
+\ProvidesFile{scrreprt-xetex-bidi.def}[2022/05/27 v1.3 bidi adaptations for scrreprt class for XeTeX engine]
 \newcommand{\scr@saved@LTRfootnotetext}{}
 \newcommand{\scr@saved@RTLfootnotetext}{}
 \let\scr@saved@footnotetext\@footnotetext
@@ -559,6 +559,90 @@
     \vskip\belowcaptionskip
   \fi
 }
+
+\renewcommand{\scr@@makesinglelinecaption}[3]{%
+    {\usekomafont{caption}{\strut\ignorespaces
+      #1{{\usekomafont{captionlabel}{#2\captionformat}}}%
+      \ignorespaces #3\unskip}}%
+}
+
+\renewcommand{\scr@makemultilinecaption}[3]{%
+  {%
+    \usefontofkomafont{caption}{%
+      \hb@xt@\hsize{%
+        \cap@left
+        \vbox{\hsize\cap@width\linewidth\hsize
+          \scr@ifundefinedorrelax{@captype}{%
+            \ClassWarning{\KOMAClassName}{%
+              `\string\caption' outside float.\MessageBreak
+              Seems you are using `\string\caption' outside a
+              float.\MessageBreak
+              Maybe you are using a package that uses
+              `\string\@makecaption'\MessageBreak
+              without setting `\string\@captype' before.\MessageBreak
+              Because I cannot detect the caption type, I'm using\MessageBreak
+              the empty one.%
+            }%
+            \let\@captype\@empty
+          }{}%
+          \scr@ifundefinedorrelax{ragged\@captype caption}{\raggedcaption}{%
+            \@nameuse{ragged\@captype caption}%
+          }%
+          \ifdofullc@p
+            \@hangfrom{%
+              \strut
+              \scr@smashdp{%
+                #1{%
+                  \usekomafont{caption}{%
+                    \usekomafont{captionlabel}{#2\captionformat}%
+                  }%
+                }%
+              }%
+            }%
+            {{\usekomafont{caption}{#3\scr@endstrut}}\par}%
+          \else
+            \ifdim\cap@indent<\z@
+              \strut
+              #1{%
+                {\usekomafont{caption}{%
+                  \usekomafont{captionlabel}{#2\captionformat}%
+                }%
+              }\par}%
+              \noindent{{\usekomafont{caption}{%
+                  \hspace*{-\cap@indent}#3\scr@endstrut
+              }}\par}%
+            \else
+              \if@capbreak
+                \strut
+                #1{%
+                  {\usekomafont{caption}{%
+                    \usekomafont{captionlabel}{#2\captionformat}%
+                  }%
+                }\par}%
+                \noindent\@hangfrom{\hspace*{\cap@indent}}%
+                {{\usekomafont{caption}{#3\scr@endstrut}}\par}%
+              \else
+                \@hangfrom{\scr@smashdp\strut\hspace*{\cap@indent}}%
+                {%
+                  \hspace{-\cap@indent}%
+                  \scr@smashdp{%
+                    #1{\usekomafont{caption}{%
+                        \usekomafont{captionlabel}{#2\captionformat}%
+                      }%
+                    }%
+                  }%
+                  {{\usekomafont{caption}{#3\scr@endstrut}}\par}%
+                }%
+              \fi
+            \fi
+          \fi
+        }%
+        \cap@right
+      }\par\kern\dp\strutbox
+    }%
+  }\kern-\dp\strutbox
+}
+
 \bidi@AfterFile{longtable-xetex-bidi.def}{%
   \if@komalongtable
     \renewcommand{\LT@makecaption}[3]{%
@@ -613,7 +697,7 @@
   \csname scr@tso@#1@entryformat\endcsname[1]{\usekomafont{partentry}{##1}}%
   \expandafter\renewcommand%
   \csname scr@tso@#1@pagenumberformat\endcsname[1]{%
-    \usekomafont{partentry}{\usekomafont{partentrypagenumber}{##1}}}%
+    {\usekomafont{partentry}{\usekomafont{partentrypagenumber}{##1}}}}%
   \expandafter\renewcommand\expandafter*%
   \csname scr@tso@#1@beforeskip\endcsname{2.25em \@plus\p@}%
 }
@@ -632,7 +716,7 @@
   \csname scr@tso@#1@entryformat\endcsname{\usekomafont{chapterentry}}%
   \expandafter\renewcommand%
   \csname scr@tso@#1@pagenumberformat\endcsname[1]{%
-    \usekomafont{chapterentry}{\usekomafont{chapterentrypagenumber}{##1}}}%
+    {\usekomafont{chapterentry}{\usekomafont{chapterentrypagenumber}{##1}}}}%
   \expandafter\renewcommand\expandafter*%
   \csname scr@tso@#1@beforeskip\endcsname{1.0em \@plus\p@}%
 }
@@ -641,6 +725,9 @@
 \TOCEntryStyleStartInitCode{section}{%
   \expandafter\renewcommand%
   \csname scr@tso@#1@linefill\endcsname{\TOCLineLeaderFill\relax}%
+      \expandafter\renewcommand%
+      \csname scr@tso@#1@pagenumberformat\endcsname[1]{%
+        {\normalfont\normalcolor ##1}}%
 }
 
 \CloneTOCEntryStyle{section}{default}
-- 
cgit v1.2.3

