texlive[65611] Master/texmf-dist: babel (23jan23)

commits+karl at tug.org commits+karl at tug.org
Mon Jan 23 21:51:12 CET 2023


Revision: 65611
          http://tug.org/svn/texlive?view=revision&revision=65611
Author:   karl
Date:     2023-01-23 21:51:12 +0100 (Mon, 23 Jan 2023)
Log Message:
-----------
babel (23jan23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/babel/README.md
    trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
    trunk/Master/texmf-dist/source/latex/babel/babel.dtx
    trunk/Master/texmf-dist/source/latex/babel/babel.ins
    trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
    trunk/Master/texmf-dist/source/latex/babel/locale.zip
    trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-buddhist.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-coptic.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-ethiopic.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-hebrew.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-islamic.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-persian.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-data-bidi.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel-data-cjk.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel.def
    trunk/Master/texmf-dist/tex/generic/babel/babel.sty
    trunk/Master/texmf-dist/tex/generic/babel/blplain.tex
    trunk/Master/texmf-dist/tex/generic/babel/bplain.tex
    trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
    trunk/Master/texmf-dist/tex/generic/babel/luababel.def
    trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
    trunk/Master/texmf-dist/tex/generic/babel/plain.def
    trunk/Master/texmf-dist/tex/generic/babel/switch.def
    trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def
    trunk/Master/texmf-dist/tex/generic/babel/xebabel.def

Modified: trunk/Master/texmf-dist/doc/latex/babel/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/README.md	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/doc/latex/babel/README.md	2023-01-23 20:51:12 UTC (rev 65611)
@@ -1,5 +1,7 @@
-## Babel 3.84
+## Babel 3.85
 
+2023-01-23
+
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages. Many
 language styles work with pdflatex, as well as with xelatex and
@@ -8,9 +10,9 @@
 
 The latest stable version is available on <https://ctan.org/pkg/babel>.
 
-Changes in version 3.84 are described in:
+Changes in version 3.85 are described in:
 
-https://latex3.github.io/babel/news/whats-new-in-babel-3.84.html
+https://latex3.github.io/babel/news/whats-new-in-babel-3.85.html
 
 Apart from the manual, you can find information on some aspects of babel at:
 
@@ -46,14 +48,15 @@
 
 ### Summary of latest changes
 ```
-3.84  2022-12-26
-      * Automatic selection of encodings with \babelprovide and pdftex.
+3.85  2023-01-23
+      * A high-level interface to enable and disable transforms (lua).
+      * Font-dependent transforms (lua).
+      * Spaces allowed as separators in layout=.
       * Fixes:
-        - With 'select.write = omit' the main language wasn’t selected
-          in the aux file.
-        - Incorrect link box in end of line if it is preceded by a
-          non-Arabic character (#207)
-        - New option counters* the pre-expand \thepage. See #26.
+        - \babelprehyphenation was not applied with 'onchar'.
+        - In some rare cases the hyphenrules weren’t correctly set.
+        - Partial fix for bidi in tabular (broken after an attempt to
+          fix amsmath).
 ```
 
 ### Previous changes

Modified: trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2023-01-23 20:51:12 UTC (rev 65611)
@@ -1,7 +1,7 @@
 % \iffalse
 % This document requires lualatex
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2022/12/26 v3.84 The Babel package]
+\ProvidesFile{babel.dtx}[2022/01/23 v3.85 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -433,6 +433,14 @@
   shorthands in those macros.
 \end{note}
 
+\begin{note}
+  \Babel{} does not make any readjustments by default in font size,
+  vertical positioning or line height by default. This is on purpose
+  because the optimal solution depends on the document layout and the
+  font, and very likely the most appropriate one is a combination of
+  these settings.
+\end{note}
+
 \subsection{Multilingual documents}
 
 In multilingual documents, just use a list of the required languages as
@@ -3355,6 +3363,34 @@
 This feature is activated with the first |\babelposthyphenation| or
 |\babelprehyphenation|.
 
+\New{3.85} Another option is |label|, which takes a value similar to
+those in |\babelprovide| key |transforms| (in fact, the latter just
+applies this option). This label can be used to turn on and off
+transforms with a higher level interface, by means of
+|\enablelocaletransform| and |\disablelocaletransform| (see below).
+
+\New{3.85} When used in conjunction with |label|, this key makes a
+transform font dependent. As an example, the rules for Arabic kashida
+can differ depending on the font design. The value consists in a list
+of space-separated font tags:
+\begin{verbatim}
+\babelprehyphenation[label=transform.name, fonts=rm sf]{..}{..}
+\end{verbatim}
+Tags can adopt two forms: a family, such as |rm| or |tt|, or the set
+family/series/shape. If a font matches one of these conditions, the
+transform is enabled. The second tag in |rm rm/n/it| is redundant.
+There are no wildcards; so, for italics you may want to write something
+like |sf/m/it sf/b/it|.
+
+Transforms set for specific fonts (at least once in any language) are
+always reset with a font selector.
+
+In |\babelprovide|, transform labels can be tagged before its name,
+with a list separated with colons, like:
+\begin{verbatim}
+transforms = _rm:sf:_transform.name
+\end{verbatim}
+
 \New{3.67} With the optional argument you can associate a user defined
 transform to an attribute, so that it’s active only when it’s set
 (currently its attribute value is ignored). With this mechanism
@@ -3364,7 +3400,7 @@
 |\unsetattribute|. The following example shows how to use it, provided
 an attribute named |\latinnoj| has been declared:
 \begin{verbatim}
-  \babelprehyphenation[attribute=\latinnoj]{latin}{ J }{ string = I }
+\babelprehyphenation[attribute=\latinnoj]{latin}{ J }{ string = I }
 \end{verbatim}
 
 See the
@@ -3437,6 +3473,12 @@
   linked to fonts, not to languages.
 \end{note}
 
+\Describe{\enablelocaletransform}{\marg{label}}
+\DescribeOther{\disablelocaletransform}{\marg{label}}
+
+\New{3.85} Enables and disables the transform with the given label in
+the current language.
+
 \subsection{Selection based on BCP 47 tags}
 \label{bcp47}
 
@@ -3711,8 +3753,8 @@
 \newcommand\refrange[2]{\babelsublr{\texthe{\ref{#1}}-\texthe{\ref{#2}}}}
 \end{verbatim}
 
-  In the future a more complete method, reading recursively boxed text, may
-  be added.
+  In the future a more complete method, reading recursively boxed text,
+  may be added.
 \end{note}
 
 \Describe{layout=}{\texttt{sectioning} $\string|$
@@ -3729,9 +3771,10 @@
 adapted in bidi documents, including some text elements (except with
 options loading the |bidi| package, which provides its own mechanism to
 control these elements). You may use several options with a
-dot-separated list (eg, |layout=counters.contents.sectioning|). This
-list will be expanded in future releases. Note not all options are
-required by all engines.
+space-separated list, like |layout=counters contents sectioning| (in
+\New{3.85} spaces are to be preferred over dots, which was the former
+syntax). This list will be expanded in future releases. Note not all
+options are required by all engines.
 
 \begin{description}
 \renewcommand\makelabel[1]{%
@@ -3812,7 +3855,7 @@
   Typically, in an Arabic document you would need:
 \begin{verbatim}
 \usepackage[bidi=basic,
-            layout=counters.tabular]{babel}
+            layout=counters tabular]{babel}
 \end{verbatim}
 \end{example}
 
@@ -4747,6 +4790,11 @@
 |\bbl at remove@special|\meta{char} add and remove the character
 \meta{char} to these two sets.
 
+\DescribeMacro{\@safe at activestrue}
+\DescribeMacro{\@safe at activesfalse}
+Enables and disables the “safe” mode. It is a tool for package and class
+authors. See the description below.
+
 \subsection{Support for saving macro definitions}
 
 Language definition files may want to \emph{re}define macros that
@@ -5238,8 +5286,8 @@
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.84>>
-%<<date=2022/12/26>>
+%<<version=3.85>>
+%<<date=2022/01/23>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -6021,6 +6069,12 @@
 \ifx\bbl at opt@layout\@nnil
   \newcommand\IfBabelLayout[3]{#3}%
 \else
+  \bbl at exp{\\\bbl at forkv{\@nameuse{@raw at opt@babel.sty}}}{%
+    \in@{,layout,}{,#1,}%
+    \ifin@
+      \def\bbl at opt@layout{#2}%
+      \bbl at replace\bbl at opt@layout{ }{.}%
+    \fi}
   \newcommand\IfBabelLayout[1]{%
     \@expandtwoargs\in@{.#1.}{.\bbl at opt@layout.}%
     \ifin@
@@ -7830,11 +7884,17 @@
 %  \end{macro}
 %
 %  \begin{macro}{\if at safe@actives}
-%    In some circumstances it is necessary to be able to change the
-%    expansion of an active character on the fly. For this purpose the
-%    switch |@safe at actives| is available. The setting of this switch
-%    should be checked in the first level expansion of
-%    |\active at char|\m{char}.
+%  In some circumstances it is necessary to be able to reset the
+%  shorthand to its ‘normal’ value (usually the character with catcode
+%  ‘other’) on the fly. For this purpose the switch |@safe at actives| is
+%  available. The setting of this switch should be checked in the first
+%  level expansion of |\active at char|\m{char}. When this expansion mode
+%  is active (with |\@safe at activestrue|), something like
+%  |"|$\sb{13}$|"|$\sb{13}$ becomes |"|$\sb{12}$|"|$\sb{12}$ in an
+%  |\edef| (in other words, shorthands are |\string|’ed). This
+%  contrasts with |\protected at edef|, where catcodes are always left
+%  unchanged. Once converted, they can be used safely even after this
+%  expansion mode is deactivated (with |\@safe at activefalse|).
 %
 %    \begin{macrocode}
 \newif\if at safe@actives
@@ -7844,10 +7904,10 @@
 %  \end{macro}
 %
 %  \begin{macro}{\bbl at restore@actives}
-%    When the output routine kicks in while the
-%    active characters were made ``safe'' this must be undone in
-%    the headers to prevent unexpected typeset results. For this
-%    situation we define a command to make them ``unsafe'' again.
+% When the output routine kicks in while the active characters were
+% made ``safe'' this must be undone in the headers to prevent
+% unexpected typeset results. For this situation we define a command to
+% make them ``unsafe'' again.
 %
 %    \begin{macrocode}
 \def\bbl at restore@actives{\if at safe@actives\@safe at activesfalse\fi}
@@ -7858,10 +7918,10 @@
 %  \begin{macro}{\bbl at activate}
 %  \begin{macro}{\bbl at deactivate}
 %
-%    Both macros take one argument, like |\initiate at active@char|. The
-%    macro is used to change the definition of an active character to
-%    expand to |\active at char|\m{char} in the case of |\bbl at activate|,
-%    or |\normal at char|\m{char} in the case of |\bbl at deactivate|.
+% Both macros take one argument, like |\initiate at active@char|. The
+% macro is used to change the definition of an active character to
+% expand to |\active at char|\m{char} in the case of |\bbl at activate|,
+% or |\normal at char|\m{char} in the case of |\bbl at deactivate|.
 %
 %    \begin{macrocode}
 \chardef\bbl at activated\z@
@@ -7891,16 +7951,16 @@
 %  \end{macro}
 %  \end{macro}
 %
-%  \begin{macro}{\declare at shorthand}
-%    The command |\declare at shorthand| is used to declare a shorthand
-%    on a certain level. It takes three arguments:
-%    \begin{enumerate}
-%    \item a name for the collection of shorthands, i.e. `system', or
-%      `dutch';
-%    \item the character (sequence) that makes up the shorthand,
-%      i.e. |~| or |"a|;
-%    \item the code to be executed when the shorthand is encountered.
-%    \end{enumerate}
+% \begin{macro}{\declare at shorthand}
+% The command |\declare at shorthand| is used to declare a shorthand
+% on a certain level. It takes three arguments:
+% \begin{enumerate}
+% \item a name for the collection of shorthands, i.e. `system', or
+%   `dutch';
+% \item the character (sequence) that makes up the shorthand,
+%   i.e. |~| or |"a|;
+% \item the code to be executed when the shorthand is encountered.
+% \end{enumerate}
 %
 % The auxiliary macro |\babel at texpdf| improves the interoperativity with
 % \textsf{hyperref} and takes 4 arguments: (1) The \TeX{} code in text
@@ -8182,6 +8242,7 @@
 \def\bbl at putsh@i#1#2\@nnil{%
   \csname\language at group @sh@\string#1@%
     \ifx\@empty#2\else\string#2@\fi\endcsname}
+%
 \ifx\bbl at opt@shorthands\@nnil\else
   \let\bbl at s@initiate at active@char\initiate at active@char
   \def\initiate at active@char#1{%
@@ -8776,26 +8837,6 @@
       {\bbl at tolower\@empty}{\bbl at toupper\@empty}}%
     \gdef\bbl at tolower{\csname\languagename @bbl at lc\endcsname}%
     \gdef\bbl at toupper{\csname\languagename @bbl at uc\endcsname}}}
-% A temporary hack, for testing purposes:
-\def\BabelRestoreCase{%
-  \DeclareRobustCommand{\MakeUppercase}[1]{{%
-    \def\reserved at a####1####2{\let####1####2\reserved at a}%
-    \def\i{I}\def\j{J}%
-    \expandafter\reserved at a\@uclclist\reserved at b{\reserved at b\@gobble}%
-    \let\UTF at two@octets at noexpand\@empty
-    \let\UTF at three@octets at noexpand\@empty
-    \let\UTF at four@octets at noexpand\@empty
-    \protected at edef\reserved at a{\uppercase{##1}}%
-    \reserved at a
-  }}%
-  \DeclareRobustCommand{\MakeLowercase}[1]{{%
-    \def\reserved at a####1####2{\let####2####1\reserved at a}%
-    \expandafter\reserved at a\@uclclist\reserved at b{\reserved at b\@gobble}%
-    \let\UTF at two@octets at noexpand\@empty
-    \let\UTF at three@octets at noexpand\@empty
-    \let\UTF at four@octets at noexpand\@empty
-    \protected at edef\reserved at a{\lowercase{##1}}%
-    \reserved at a}}}
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -9802,7 +9843,7 @@
   % \ifx\bbl at KVP@date\@nnil\else
   % \fi
   % ==
-  \let\bbl at lbkflag\relax % \@empty = do setup linebreak
+  \let\bbl at lbkflag\relax % \@empty = do setup linebreak, only in 3 cases:
   \ifcase\bbl at howloaded
     \let\bbl at lbkflag\@empty % new
   \else
@@ -9827,6 +9868,7 @@
       {}%
     \let\bbl at KVP@date\@empty
   \fi
+  \let\bbl at KVP@captions@@\bbl at KVP@captions % TODO. A dirty hack
   \ifx\bbl at KVP@captions\@nnil
     \let\bbl at KVP@captions\bbl at KVP@import
   \fi
@@ -9891,7 +9933,7 @@
     \directlua{
       if Babel.locale_mapped == nil then
         Babel.locale_mapped = true
-        Babel.linebreaking.add_before(Babel.locale_map)
+        Babel.linebreaking.add_before(Babel.locale_map, 1)
         Babel.loc_to_scr = {}
         Babel.chr_to_loc = Babel.chr_to_loc or {}
       end
@@ -10230,48 +10272,49 @@
     {}}
 %    \end{macrocode}
 %
-% The |hyphenrules| option is handled with an auxiliary macro.
+% The |hyphenrules| option is handled with an auxiliary macro. This
+% macro is called in three cases: when a language is first declared
+% with |\babelprovide|, with |hyphenrules| and with |import|.
 %
 %    \begin{macrocode}
 \def\bbl at provide@hyphens#1{%
-  \let\bbl at tempa\relax
+  \@tempcnta\m at ne  % a flag
   \ifx\bbl at KVP@hyphenrules\@nnil\else
     \bbl at replace\bbl at KVP@hyphenrules{ }{,}%
     \bbl at foreach\bbl at KVP@hyphenrules{%
-      \ifx\bbl at tempa\relax    %  if not yet found
-        \bbl at ifsamestring{##1}{+}%
-          {{\bbl at exp{\\\addlanguage\<l@##1>}}}%
+      \ifnum\@tempcnta=\m at ne   % if not yet found
+        \bbl at ifsamestring{##1}{+}%  
+          {\bbl at carg\addlanguage{l@##1}}%
           {}%
-        \bbl at ifunset{l@##1}%
+        \bbl at ifunset{l@##1}% After a possible +
           {}%
-          {\bbl at exp{\let\bbl at tempa\<l@##1>}}%
+          {\@tempcnta\@nameuse{l@##1}}%
       \fi}%
-    \ifx\bbl at tempa\relax 
+    \ifnum\@tempcnta=\m at ne
       \bbl at warning{%
         Requested 'hyphenrules=' for '\languagename' not found.\\%
         Using the default value. Reported}%
     \fi
   \fi
-  \ifx\bbl at tempa\relax %         if no opt or no language in opt found
-    \ifx\bbl at KVP@import\@nnil
-      \ifx\bbl at initoload\relax\else
-        \bbl at exp{%               and hyphenrules is not empty
-          \\\bbl at ifblank{\bbl at cs{hyphr@#1}}%
-            {}%
-            {\let\\\bbl at tempa\<l@\bbl at cl{hyphr}>}}%
-      \fi 
-    \else % if importing
-      \bbl at exp{%                    and hyphenrules is not empty
-        \\\bbl at ifblank{\bbl at cs{hyphr@#1}}%
-          {}%
-          {\let\\\bbl at tempa\<l@\bbl at cl{hyphr}>}}%
+  \ifnum\@tempcnta=\m at ne          % if no opt or no language in opt found
+    \ifx\bbl at KVP@captions@@\@nnil % TODO. Hackish. See above.
+      \bbl at ifunset{bbl at hyphr@#1}{}% use value in ini, if exists
+        {\bbl at exp{\\\bbl at ifblank{\bbl at cs{hyphr@#1}}}%
+           {}%
+           {\bbl at ifunset{l@\bbl at cl{hyphr}}%
+             {}%                   if hyphenrules found:
+             {\@tempcnta\@nameuse{l@\bbl at cl{hyphr}}}}}%
     \fi
   \fi
-  \bbl at ifunset{bbl at tempa}%       ie, relax or undefined
-    {\bbl at ifunset{l@#1}%         no hyphenrules found - fallback
-       {\bbl at exp{\\\adddialect\<l@#1>\language}}%
-       {}}%                      so, l@<lang> is ok - nothing to do
-    {\bbl at exp{\\\adddialect\<l@#1>\bbl at tempa}}}% found in opt list or ini
+  \bbl at ifunset{l@#1}%
+    {\ifnum\@tempcnta=\m at ne
+       \bbl at carg\adddialect{l@#1}\language
+     \else
+       \bbl at carg\adddialect{l@#1}\@tempcnta
+     \fi}%
+    {\ifnum\@tempcnta=\m at ne\else
+       \global\bbl at carg\chardef{l@#1}\@tempcnta
+     \fi}}
 %    \end{macrocode}
 %
 % The reader of |babel-...tex| files. We reset temporarily some
@@ -10952,10 +10995,26 @@
     \directlua{
        local str = [==[#2]==]
        str = str:gsub('%.%d+%.%d+$', '')
-       tex.print([[\def\string\babeltempa{]] .. str .. [[}]])
+       token.set_macro('babeltempa', str)
     }&%
+    \def\babeltempc{}&%
     \bbl at xin@{,\babeltempa,}{,\bbl at KVP@transforms,}&%
+    \ifin@\else
+      \bbl at xin@{:\babeltempa,}{,\bbl at KVP@transforms,}&%
+    \fi
     \ifin@
+      \bbl at foreach\bbl at KVP@transforms{&%
+        \bbl at xin@{:\babeltempa,}{,##1,}&%
+        \ifin@  &% font:font:transform syntax
+          \directlua{
+            local t = {}
+            for m in string.gmatch('##1'..':', '(.-):') do
+              table.insert(t, m)
+            end
+            table.remove(t)
+            token.set_macro('babeltempc', ',fonts=' .. table.concat(t, ' '))
+          }&%
+        \fi}&%
       \in@{.0$}{#2$}&%
       \ifin@
         \directlua{&% (\attribute) syntax
@@ -10962,17 +11021,18 @@
           local str = string.match([[\bbl at KVP@transforms]],
                         '%(([^%(]-)%)[^%)]-\babeltempa')
           if str == nil then
-            tex.print([[\def\string\babeltempb{}]])
+            token.set_macro('babeltempb', '')
           else
-            tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]])
+            token.set_macro('babeltempb', ',attribute=' .. str)
           end
-        }
+        }&%
         \toks@{#3}&%
         \bbl at exp{&%
           \\\g at addto@macro\\\bbl at release@transforms{&%
             \relax  &% Closes previous \bbl at transforms@aux
             \\\bbl at transforms@aux
-              \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&%
+              \\#1{label=\babeltempa\babeltempb\babeltempc}&%
+                 {\languagename}{\the\toks@}}}&%
       \else
         \g at addto@macro\bbl at release@transforms{, {#3}}&%
       \fi
@@ -12011,8 +12071,7 @@
 %
 % For several functions, we need to execute some code with
 % |\selectfont|. With \LaTeX\ 2021-06-01, there is a hook for this
-% purpose, but in older versions the \LaTeX{} command is patched (the
-% latter solution will be eventually removed).
+% purpose.
 %
 %    \begin{macrocode}
 \def\bbl at patchfont#1{\AddToHook{selectfont}{#1}}
@@ -12112,8 +12171,8 @@
 \def\bbl at alscripts{,Arabic,Syriac,Thaana,}
 \def\bbl at rscripts{% TODO. Base on codes ??
   ,Imperial Aramaic,Avestan,Cypriot,Hatran,Hebrew,%
-  Old Hungarian,Old Hungarian,Lydian,Mandaean,Manichaean,%
-  Manichaean,Meroitic Cursive,Meroitic,Old North Arabian,%
+  Old Hungarian,Lydian,Mandaean,Manichaean,%
+  Meroitic Cursive,Meroitic,Old North Arabian,%
   Nabataean,N'Ko,Orkhon,Palmyrene,Inscriptional Pahlavi,%
   Psalter Pahlavi,Phoenician,Inscriptional Parthian,Samaritan,%
   Old South Arabian,}%
@@ -12951,8 +13010,8 @@
 % At the time of this writing, \textsf{fontspec} shows a warning about
 % there are languages not available, which some people think refers to
 % \babel{}, even if there is nothing wrong. Here is hack to patch
-% \textsf{fontspec} to avoid the misleading message, which is replaced
-% ba a more explanatory one.
+% \textsf{fontspec} to avoid the misleading (and mostly unuseful)
+% message.
 %
 %    \begin{macrocode}
 %<<*Font selection>>
@@ -13051,7 +13110,7 @@
             \global\let\<bbl@##1dflt@\languagename>%
                        \<bbl@##1dflt@*\bbl at tempa>}}}%
       {}}%                               1=T - language, already defined
-  \def\bbl at tempa{\bbl at nostdfont{}}%
+  \def\bbl at tempa{\bbl at nostdfont{}}%  TODO. Don't use \bbl at tempa
   \bbl at foreach\bbl at font@fams{%     don't gather with prev for
     \bbl at ifunset{bbl@##1dflt@\languagename}%
       {\bbl at cs{famrst@##1}%
@@ -13884,9 +13943,13 @@
   Babel.linebreaking.before = {}
   Babel.linebreaking.after = {}
   Babel.locale = {} % Free to use, indexed by \localeid
-  function Babel.linebreaking.add_before(func)
+  function Babel.linebreaking.add_before(func, pos)
     tex.print([[\noexpand\csname bbl at luahyphenate\endcsname]])
-    table.insert(Babel.linebreaking.before, func)
+    if pos == nil then
+      table.insert(Babel.linebreaking.before, func)
+    else
+      table.insert(Babel.linebreaking.before, pos, func)
+    end
   end
   function Babel.linebreaking.add_after(func)
     tex.print([[\noexpand\csname bbl at luahyphenate\endcsname]])
@@ -14615,8 +14678,36 @@
         \fi}}&% 
     \let\bbl at kv@attribute\relax
     \let\bbl at kv@label\relax
+    \let\bbl at kv@fonts\@empty
     \bbl at forkv{#2}{\bbl at csarg\edef{kv@##1}{##2}}&%
-    \ifx\bbl at kv@attribute\relax\else
+    \ifx\bbl at kv@fonts\@empty\else\bbl at settransfont\fi
+    \ifx\bbl at kv@attribute\relax
+      \ifx\bbl at kv@label\relax\else  
+        \bbl at exp{\\\bbl at trim@def\\\bbl at kv@fonts{\bbl at kv@fonts}}&%
+        \bbl at replace\bbl at kv@fonts{ }{,}&%
+        \edef\bbl at kv@attribute{bbl at ATR@\bbl at kv@label @#3@\bbl at kv@fonts}&%
+        \count@\z@
+        \def\bbl at elt##1##2##3{&%
+          \bbl at ifsamestring{#3,\bbl at kv@label}{##1,##2}&%
+            {\bbl at ifsamestring{\bbl at kv@fonts}{##3}&%
+               {\count@\@ne}&%
+               {\bbl at error
+                 {Transforms cannot be re-assigned to different\\&%
+                  fonts. The conflict is in '\bbl at kv@label'.\\&%
+                  Apply the same fonts or use a different label}&%
+                 {See the manual for further details.}}}&%
+            {}}&%
+        \bbl at transfont@list
+        \ifnum\count@=\z@
+          \bbl at exp{\global\\\bbl at add\\\bbl at transfont@list
+            {\\\bbl at elt{#3}{\bbl at kv@label}{\bbl at kv@fonts}}}&%
+        \fi
+        \bbl at ifunset{\bbl at kv@attribute}&%
+          {\global\bbl at carg\newattribute{\bbl at kv@attribute}}&%
+          {}&%
+        \global\bbl at carg\setattribute{\bbl at kv@attribute}\@ne
+      \fi
+    \else
       \edef\bbl at kv@attribute{\expandafter\bbl at stripslash\bbl at kv@attribute}&%
     \fi
     \directlua{
@@ -14662,6 +14753,49 @@
     }&%
   \endgroup}
 \endgroup
+\let\bbl at transfont@list\@empty
+\def\bbl at settransfont{%
+  \global\let\bbl at settransfont\relax % Execute only once
+  \gdef\bbl at transfont{%
+    \def\bbl at elt####1####2####3{%
+      \bbl at ifblank{####3}%
+         {\count@\tw@}% Do nothing if no fonts
+         {\count@\z@
+          \bbl at vforeach{####3}{%
+            \def\bbl at tempd{########1}%
+            \edef\bbl at tempe{\bbl at transfam/\f at series/\f at shape}%
+            \ifx\bbl at tempd\bbl at tempe
+              \count@\@ne
+            \else\ifx\bbl at tempd\bbl at transfam
+              \count@\@ne
+            \fi\fi}%
+         \ifcase\count@
+           \bbl at csarg\unsetattribute{ATR@####2@####1@####3}%
+         \or
+           \bbl at csarg\setattribute{ATR@####2@####1@####3}\@ne
+         \fi}}%
+      \bbl at transfont@list}%
+  \AddToHook{selectfont}{\bbl at transfont}% Hooks are global.
+  \gdef\bbl at transfam{-unknown-}%
+  \bbl at foreach\bbl at font@fams{%
+    \AddToHook{##1family}{\def\bbl at transfam{##1}}%
+    \bbl at ifsamestring{\@nameuse{##1default}}\familydefault
+      {\xdef\bbl at transfam{##1}}%
+      {}}}
+\DeclareRobustCommand\enablelocaletransform[1]{%
+  \bbl at ifunset{bbl at ATR@#1@\languagename @}%
+    {\bbl at error
+       {'#1' for '\languagename' cannot be enabled.\\%
+        Maybe there is a typo or it’s a font-dependent transform}%
+       {See the manual for further details.}}% 
+    {\bbl at csarg\setattribute{ATR@#1@\languagename @}\@ne}}
+\DeclareRobustCommand\disablelocaletransform[1]{%
+  \bbl at ifunset{bbl at ATR@#1@\languagename @}%
+    {\bbl at error
+       {'#1' for '\languagename' cannot be disabled.\\%
+        Maybe there is a typo or it’s a font-dependent transform}%
+       {See the manual for further details.}}% 
+    {\bbl at csarg\unsetattribute{ATR@#1@\languagename @}}}
 \def\bbl at activateposthyphen{%
   \let\bbl at activateposthyphen\relax
   \directlua{
@@ -14771,6 +14905,7 @@
 \def\bbl at textdir#1{%
   \bbl at setluadir{text}\textdir{#1}%
   \chardef\bbl at thetextdir#1\relax
+  % par/text 0..8 = l/l l/r l/al r/l r/r r/al al/l al/r al/al
   \edef\bbl at thedir{\the\numexpr\bbl at thepardir*3+#1}%
   \setattribute\bbl at attr@dir{\numexpr\bbl at thepardir*3+#1}}
 \def\bbl at pardir#1{%
@@ -14782,8 +14917,18 @@
 %
 \ifnum\bbl at bidimode>\z@
   \def\bbl at insidemath{0}%
-  \def\bbl at everymath{\def\bbl at insidemath{1}}
-  \def\bbl at everydisplay{\def\bbl at insidemath{2}}
+  \def\bbl at mathboxdir{%
+    \ifcase\bbl at thetextdir\relax
+      \everyhbox{\bbl at mathboxdir@aux L}%
+    \else
+      \everyhbox{\bbl at mathboxdir@aux R}%
+     \fi}
+  \def\bbl at mathboxdir@aux#1{%
+    \@ifnextchar\egroup{}{\textdir T#1T\relax}}
+  \def\bbl at everymath{\bbl at mathboxdir}
+  \def\bbl at everydisplay{%
+    \bbl at mathboxdir
+    \def\bbl at everymath{\bbl at mathboxdir}}
   \frozen at everymath\expandafter{%
     \expandafter\bbl at everymath\the\frozen at everymath}
   \frozen at everydisplay\expandafter{%
@@ -14790,15 +14935,18 @@
     \expandafter\bbl at everydisplay\the\frozen at everydisplay}
   \AtBeginDocument{
     \directlua{
+      Babel.use_math_box_dir = true
       function Babel.math_box_dir(head)
-        if not (token.get_macro('bbl at insidemath') == '0') then
-          if Babel.hlist_has_bidi(head) then
-            local d = node.new(node.id'dir')
-            d.dir = '+TRT'
-            node.insert_before(head, node.has_glyph(head), d)
-            for item in node.traverse(head) do
-              node.set_attribute(item,
-                Babel.attr_dir, token.get_macro('bbl at thedir'))
+        if Babel.use_math_box_dir then
+          if not (token.get_macro('bbl at insidemath') == '0') then
+            if Babel.hlist_has_bidi(head) then
+              local d = node.new(node.id'dir')
+              d.dir = '+TRT'
+              node.insert_before(head, node.has_glyph(head), d)
+              for item in node.traverse(head) do
+                node.set_attribute(item,
+                  Babel.attr_dir, token.get_macro('bbl at thedir'))
+              end
             end
           end
         end
@@ -14874,6 +15022,7 @@
     \ifx\maketag@@@\@undefined % Normal equation, eqnarray
       \AddToHook{env/equation/begin}{%
         \ifnum\bbl at thetextdir>\z@
+          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \let\@eqnnum\bbl at eqnum
           \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
           \chardef\bbl at thetextdir\z@
@@ -14889,6 +15038,8 @@
       \fi
       \AddToHook{env/eqnarray/begin}{%
         \ifnum\bbl at thetextdir>\z@
+          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}
+          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
           \chardef\bbl at thetextdir\z@
           \bbl at add\normalfont{\bbl at eqnodir}%
@@ -14926,6 +15077,7 @@
             \hbox to 0.01pt{\hbox to\displaywidth{\hss{#1}}\hss}}%
         \fi
         \def\bbl at ams@preset#1{%
+          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \ifnum\bbl at thetextdir>\z@
             \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
             \bbl at sreplace\textdef@{\hbox}{\bbl at ams@tagbox\hbox}%
@@ -14933,6 +15085,7 @@
           \fi}%
         \ifnum\bbl at eqnpos=\tw@\else
           \def\bbl at ams@equation{%
+            \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
             \ifnum\bbl at thetextdir>\z@
               \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
               \chardef\bbl at thetextdir\z@
@@ -14958,6 +15111,7 @@
           \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
         \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
         \AddToHook{env/split/before}{%
+          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \ifnum\bbl at thetextdir>\z@
             \bbl at ifsamestring\@currenvir{equation}%
               {\ifx\bbl at ams@lap\hbox % leqno
@@ -22317,6 +22471,7 @@
 
     elseif item.id == DIR then
       d = nil
+      -- new_d = true
       if head ~= item then new_d = true end
 
     elseif item.id == node.id'glue' and item.subtype == 13 then

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.ins	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.ins	2023-01-23 20:51:12 UTC (rev 65611)
@@ -3,7 +3,7 @@
 %% driver files from the doc files in this package when run through
 %% LaTeX or TeX.
 %%
-%% Copyright 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright 1989-2008 Johannes L. Braams and any individual authors
 %% listed elsewhere in this file.  All rights reserved.
 %% 
@@ -26,7 +26,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 %%
-\def\filedate{2022/12/26}
+\def\filedate{2022/01/23}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 

Modified: trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2023-01-23 20:51:12 UTC (rev 65611)
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/12/26 v3.84]
+\ProvidesFile{bbcompat.dtx}[2022/01/23 v3.85]
 %</dtx>
 %
 %% File 'bbcompat.dtx'

Modified: trunk/Master/texmf-dist/source/latex/babel/locale.zip
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 -- babel.dtx  (with options: `basic-r')
 -- 
 --
--- Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+-- Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 -- Copyright (C) 1989-2012 Johannes L. Braams and
 --           any individual authors listed elsewhere in this file.
 -- All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 -- babel.dtx  (with options: `basic')
 -- 
 --
--- Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+-- Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 -- Copyright (C) 1989-2012 Johannes L. Braams and
 --           any individual authors listed elsewhere in this file.
 -- All rights reserved.
@@ -211,6 +211,7 @@
 
     elseif item.id == DIR then
       d = nil
+      -- new_d = true
       if head ~= item then new_d = true end
 
     elseif item.id == node.id'glue' and item.subtype == 13 then

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-buddhist.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-buddhist.tex	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-buddhist.tex	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `ca-buddhist')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-coptic.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-coptic.tex	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-coptic.tex	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `ca-coptic')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-ethiopic.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-ethiopic.tex	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-ethiopic.tex	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `ca-ethiopic')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-hebrew.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-hebrew.tex	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-hebrew.tex	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `ca-hebrew')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-islamic.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-islamic.tex	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-islamic.tex	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `ca-islamic')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-persian.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-persian.tex	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-persian.tex	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `ca-persian')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-data-bidi.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-data-bidi.lua	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-data-bidi.lua	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 -- babel.dtx  (with options: `bididata')
 -- 
 --
--- Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+-- Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 -- Copyright (C) 1989-2012 Johannes L. Braams and
 --           any individual authors listed elsewhere in this file.
 -- All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-data-cjk.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-data-cjk.lua	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-data-cjk.lua	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 -- babel.dtx  (with options: `cjkdata')
 -- 
 --
--- Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+-- Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 -- Copyright (C) 1989-2012 Johannes L. Braams and
 --           any individual authors listed elsewhere in this file.
 -- All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 -- babel.dtx  (with options: `transforms')
 -- 
 --
--- Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+-- Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 -- Copyright (C) 1989-2012 Johannes L. Braams and
 --           any individual authors listed elsewhere in this file.
 -- All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.def	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.def	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `core')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.
@@ -40,7 +40,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{babel.def}[2022/12/26 3.84 Babel common definitions]
+\ProvidesFile{babel.def}[2022/01/23 3.85 Babel common definitions]
 \ifx\AtBeginDocument\@undefined  % TODO. change test.
   \def\@empty{}
 \def\loadlocalcfg#1{%
@@ -406,8 +406,8 @@
 \expandafter\newif\csname ifbbl at single\endcsname
 \chardef\bbl at bidimode\z@
 \fi
-\def\bbl at version{3.84}
-\def\bbl at date{2022/12/26}
+\def\bbl at version{3.85}
+\def\bbl at date{2022/01/23}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi
@@ -1901,25 +1901,6 @@
       {\bbl at tolower\@empty}{\bbl at toupper\@empty}}%
     \gdef\bbl at tolower{\csname\languagename @bbl at lc\endcsname}%
     \gdef\bbl at toupper{\csname\languagename @bbl at uc\endcsname}}}
-\def\BabelRestoreCase{%
-  \DeclareRobustCommand{\MakeUppercase}[1]{{%
-    \def\reserved at a####1####2{\let####1####2\reserved at a}%
-    \def\i{I}\def\j{J}%
-    \expandafter\reserved at a\@uclclist\reserved at b{\reserved at b\@gobble}%
-    \let\UTF at two@octets at noexpand\@empty
-    \let\UTF at three@octets at noexpand\@empty
-    \let\UTF at four@octets at noexpand\@empty
-    \protected at edef\reserved at a{\uppercase{##1}}%
-    \reserved at a
-  }}%
-  \DeclareRobustCommand{\MakeLowercase}[1]{{%
-    \def\reserved at a####1####2{\let####2####1\reserved at a}%
-    \expandafter\reserved at a\@uclclist\reserved at b{\reserved at b\@gobble}%
-    \let\UTF at two@octets at noexpand\@empty
-    \let\UTF at three@octets at noexpand\@empty
-    \let\UTF at four@octets at noexpand\@empty
-    \protected at edef\reserved at a{\lowercase{##1}}%
-    \reserved at a}}}
 \@onlypreamble\StartBabelCommands
 \def\StartBabelCommands{%
   \begingroup
@@ -2454,7 +2435,7 @@
   % \ifx\bbl at KVP@date\@nnil\else
   % \fi
   % ==
-  \let\bbl at lbkflag\relax % \@empty = do setup linebreak
+  \let\bbl at lbkflag\relax % \@empty = do setup linebreak, only in 3 cases:
   \ifcase\bbl at howloaded
     \let\bbl at lbkflag\@empty % new
   \else
@@ -2479,6 +2460,7 @@
       {}%
     \let\bbl at KVP@date\@empty
   \fi
+  \let\bbl at KVP@captions@@\bbl at KVP@captions % TODO. A dirty hack
   \ifx\bbl at KVP@captions\@nnil
     \let\bbl at KVP@captions\bbl at KVP@import
   \fi
@@ -2543,7 +2525,7 @@
     \directlua{
       if Babel.locale_mapped == nil then
         Babel.locale_mapped = true
-        Babel.linebreaking.add_before(Babel.locale_map)
+        Babel.linebreaking.add_before(Babel.locale_map, 1)
         Babel.loc_to_scr = {}
         Babel.chr_to_loc = Babel.chr_to_loc or {}
       end
@@ -2865,44 +2847,43 @@
      \endgroup}%
     {}}
 \def\bbl at provide@hyphens#1{%
-  \let\bbl at tempa\relax
+  \@tempcnta\m at ne  % a flag
   \ifx\bbl at KVP@hyphenrules\@nnil\else
     \bbl at replace\bbl at KVP@hyphenrules{ }{,}%
     \bbl at foreach\bbl at KVP@hyphenrules{%
-      \ifx\bbl at tempa\relax    %  if not yet found
+      \ifnum\@tempcnta=\m at ne   % if not yet found
         \bbl at ifsamestring{##1}{+}%
-          {{\bbl at exp{\\\addlanguage\<l@##1>}}}%
+          {\bbl at carg\addlanguage{l@##1}}%
           {}%
-        \bbl at ifunset{l@##1}%
+        \bbl at ifunset{l@##1}% After a possible +
           {}%
-          {\bbl at exp{\let\bbl at tempa\<l@##1>}}%
+          {\@tempcnta\@nameuse{l@##1}}%
       \fi}%
-    \ifx\bbl at tempa\relax
+    \ifnum\@tempcnta=\m at ne
       \bbl at warning{%
         Requested 'hyphenrules=' for '\languagename' not found.\\%
         Using the default value. Reported}%
     \fi
   \fi
-  \ifx\bbl at tempa\relax %         if no opt or no language in opt found
-    \ifx\bbl at KVP@import\@nnil
-      \ifx\bbl at initoload\relax\else
-        \bbl at exp{%               and hyphenrules is not empty
-          \\\bbl at ifblank{\bbl at cs{hyphr@#1}}%
-            {}%
-            {\let\\\bbl at tempa\<l@\bbl at cl{hyphr}>}}%
-      \fi
-    \else % if importing
-      \bbl at exp{%                    and hyphenrules is not empty
-        \\\bbl at ifblank{\bbl at cs{hyphr@#1}}%
-          {}%
-          {\let\\\bbl at tempa\<l@\bbl at cl{hyphr}>}}%
+  \ifnum\@tempcnta=\m at ne          % if no opt or no language in opt found
+    \ifx\bbl at KVP@captions@@\@nnil % TODO. Hackish. See above.
+      \bbl at ifunset{bbl at hyphr@#1}{}% use value in ini, if exists
+        {\bbl at exp{\\\bbl at ifblank{\bbl at cs{hyphr@#1}}}%
+           {}%
+           {\bbl at ifunset{l@\bbl at cl{hyphr}}%
+             {}%                   if hyphenrules found:
+             {\@tempcnta\@nameuse{l@\bbl at cl{hyphr}}}}}%
     \fi
   \fi
-  \bbl at ifunset{bbl at tempa}%       ie, relax or undefined
-    {\bbl at ifunset{l@#1}%         no hyphenrules found - fallback
-       {\bbl at exp{\\\adddialect\<l@#1>\language}}%
-       {}}%                      so, l@<lang> is ok - nothing to do
-    {\bbl at exp{\\\adddialect\<l@#1>\bbl at tempa}}}% found in opt list or ini
+  \bbl at ifunset{l@#1}%
+    {\ifnum\@tempcnta=\m at ne
+       \bbl at carg\adddialect{l@#1}\language
+     \else
+       \bbl at carg\adddialect{l@#1}\@tempcnta
+     \fi}%
+    {\ifnum\@tempcnta=\m at ne\else
+       \global\bbl at carg\chardef{l@#1}\@tempcnta
+     \fi}}
 \def\bbl at input@texini#1{%
   \bbl at bsphack
     \bbl at exp{%
@@ -3438,10 +3419,26 @@
     \directlua{
        local str = [==[#2]==]
        str = str:gsub('%.%d+%.%d+$', '')
-       tex.print([[\def\string\babeltempa{]] .. str .. [[}]])
+       token.set_macro('babeltempa', str)
     }&%
+    \def\babeltempc{}&%
     \bbl at xin@{,\babeltempa,}{,\bbl at KVP@transforms,}&%
+    \ifin@\else
+      \bbl at xin@{:\babeltempa,}{,\bbl at KVP@transforms,}&%
+    \fi
     \ifin@
+      \bbl at foreach\bbl at KVP@transforms{&%
+        \bbl at xin@{:\babeltempa,}{,##1,}&%
+        \ifin@  &% font:font:transform syntax
+          \directlua{
+            local t = {}
+            for m in string.gmatch('##1'..':', '(.-):') do
+              table.insert(t, m)
+            end
+            table.remove(t)
+            token.set_macro('babeltempc', ',fonts=' .. table.concat(t, ' '))
+          }&%
+        \fi}&%
       \in@{.0$}{#2$}&%
       \ifin@
         \directlua{&% (\attribute) syntax
@@ -3448,17 +3445,18 @@
           local str = string.match([[\bbl at KVP@transforms]],
                         '%(([^%(]-)%)[^%)]-\babeltempa')
           if str == nil then
-            tex.print([[\def\string\babeltempb{}]])
+            token.set_macro('babeltempb', '')
           else
-            tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]])
+            token.set_macro('babeltempb', ',attribute=' .. str)
           end
-        }
+        }&%
         \toks@{#3}&%
         \bbl at exp{&%
           \\\g at addto@macro\\\bbl at release@transforms{&%
             \relax  &% Closes previous \bbl at transforms@aux
             \\\bbl at transforms@aux
-              \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&%
+              \\#1{label=\babeltempa\babeltempb\babeltempc}&%
+                 {\languagename}{\the\toks@}}}&%
       \else
         \g at addto@macro\bbl at release@transforms{, {#3}}&%
       \fi

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `package')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.
@@ -34,7 +34,7 @@
 %%
 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{babel}[2022/12/26 3.84 The Babel package]
+\ProvidesPackage{babel}[2022/01/23 3.85 The Babel package]
 \@ifpackagewith{babel}{debug}
   {\providecommand\bbl at trace[1]{\message{^^J[ #1 ]}}%
    \let\bbl at debug\@firstofone
@@ -449,6 +449,12 @@
 \ifx\bbl at opt@layout\@nnil
   \newcommand\IfBabelLayout[3]{#3}%
 \else
+  \bbl at exp{\\\bbl at forkv{\@nameuse{@raw at opt@babel.sty}}}{%
+    \in@{,layout,}{,#1,}%
+    \ifin@
+      \def\bbl at opt@layout{#2}%
+      \bbl at replace\bbl at opt@layout{ }{.}%
+    \fi}
   \newcommand\IfBabelLayout[1]{%
     \@expandtwoargs\in@{.#1.}{.\bbl at opt@layout.}%
     \ifin@
@@ -457,8 +463,8 @@
       \expandafter\@secondoftwo
     \fi}
 \fi
-\def\bbl at version{3.84}
-\def\bbl at date{2022/12/26}
+\def\bbl at version{3.85}
+\def\bbl at date{2022/01/23}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi
@@ -1952,25 +1958,6 @@
       {\bbl at tolower\@empty}{\bbl at toupper\@empty}}%
     \gdef\bbl at tolower{\csname\languagename @bbl at lc\endcsname}%
     \gdef\bbl at toupper{\csname\languagename @bbl at uc\endcsname}}}
-\def\BabelRestoreCase{%
-  \DeclareRobustCommand{\MakeUppercase}[1]{{%
-    \def\reserved at a####1####2{\let####1####2\reserved at a}%
-    \def\i{I}\def\j{J}%
-    \expandafter\reserved at a\@uclclist\reserved at b{\reserved at b\@gobble}%
-    \let\UTF at two@octets at noexpand\@empty
-    \let\UTF at three@octets at noexpand\@empty
-    \let\UTF at four@octets at noexpand\@empty
-    \protected at edef\reserved at a{\uppercase{##1}}%
-    \reserved at a
-  }}%
-  \DeclareRobustCommand{\MakeLowercase}[1]{{%
-    \def\reserved at a####1####2{\let####2####1\reserved at a}%
-    \expandafter\reserved at a\@uclclist\reserved at b{\reserved at b\@gobble}%
-    \let\UTF at two@octets at noexpand\@empty
-    \let\UTF at three@octets at noexpand\@empty
-    \let\UTF at four@octets at noexpand\@empty
-    \protected at edef\reserved at a{\lowercase{##1}}%
-    \reserved at a}}}
 \@onlypreamble\StartBabelCommands
 \def\StartBabelCommands{%
   \begingroup
@@ -2505,7 +2492,7 @@
   % \ifx\bbl at KVP@date\@nnil\else
   % \fi
   % ==
-  \let\bbl at lbkflag\relax % \@empty = do setup linebreak
+  \let\bbl at lbkflag\relax % \@empty = do setup linebreak, only in 3 cases:
   \ifcase\bbl at howloaded
     \let\bbl at lbkflag\@empty % new
   \else
@@ -2530,6 +2517,7 @@
       {}%
     \let\bbl at KVP@date\@empty
   \fi
+  \let\bbl at KVP@captions@@\bbl at KVP@captions % TODO. A dirty hack
   \ifx\bbl at KVP@captions\@nnil
     \let\bbl at KVP@captions\bbl at KVP@import
   \fi
@@ -2594,7 +2582,7 @@
     \directlua{
       if Babel.locale_mapped == nil then
         Babel.locale_mapped = true
-        Babel.linebreaking.add_before(Babel.locale_map)
+        Babel.linebreaking.add_before(Babel.locale_map, 1)
         Babel.loc_to_scr = {}
         Babel.chr_to_loc = Babel.chr_to_loc or {}
       end
@@ -2916,44 +2904,43 @@
      \endgroup}%
     {}}
 \def\bbl at provide@hyphens#1{%
-  \let\bbl at tempa\relax
+  \@tempcnta\m at ne  % a flag
   \ifx\bbl at KVP@hyphenrules\@nnil\else
     \bbl at replace\bbl at KVP@hyphenrules{ }{,}%
     \bbl at foreach\bbl at KVP@hyphenrules{%
-      \ifx\bbl at tempa\relax    %  if not yet found
+      \ifnum\@tempcnta=\m at ne   % if not yet found
         \bbl at ifsamestring{##1}{+}%
-          {{\bbl at exp{\\\addlanguage\<l@##1>}}}%
+          {\bbl at carg\addlanguage{l@##1}}%
           {}%
-        \bbl at ifunset{l@##1}%
+        \bbl at ifunset{l@##1}% After a possible +
           {}%
-          {\bbl at exp{\let\bbl at tempa\<l@##1>}}%
+          {\@tempcnta\@nameuse{l@##1}}%
       \fi}%
-    \ifx\bbl at tempa\relax
+    \ifnum\@tempcnta=\m at ne
       \bbl at warning{%
         Requested 'hyphenrules=' for '\languagename' not found.\\%
         Using the default value. Reported}%
     \fi
   \fi
-  \ifx\bbl at tempa\relax %         if no opt or no language in opt found
-    \ifx\bbl at KVP@import\@nnil
-      \ifx\bbl at initoload\relax\else
-        \bbl at exp{%               and hyphenrules is not empty
-          \\\bbl at ifblank{\bbl at cs{hyphr@#1}}%
-            {}%
-            {\let\\\bbl at tempa\<l@\bbl at cl{hyphr}>}}%
-      \fi
-    \else % if importing
-      \bbl at exp{%                    and hyphenrules is not empty
-        \\\bbl at ifblank{\bbl at cs{hyphr@#1}}%
-          {}%
-          {\let\\\bbl at tempa\<l@\bbl at cl{hyphr}>}}%
+  \ifnum\@tempcnta=\m at ne          % if no opt or no language in opt found
+    \ifx\bbl at KVP@captions@@\@nnil % TODO. Hackish. See above.
+      \bbl at ifunset{bbl at hyphr@#1}{}% use value in ini, if exists
+        {\bbl at exp{\\\bbl at ifblank{\bbl at cs{hyphr@#1}}}%
+           {}%
+           {\bbl at ifunset{l@\bbl at cl{hyphr}}%
+             {}%                   if hyphenrules found:
+             {\@tempcnta\@nameuse{l@\bbl at cl{hyphr}}}}}%
     \fi
   \fi
-  \bbl at ifunset{bbl at tempa}%       ie, relax or undefined
-    {\bbl at ifunset{l@#1}%         no hyphenrules found - fallback
-       {\bbl at exp{\\\adddialect\<l@#1>\language}}%
-       {}}%                      so, l@<lang> is ok - nothing to do
-    {\bbl at exp{\\\adddialect\<l@#1>\bbl at tempa}}}% found in opt list or ini
+  \bbl at ifunset{l@#1}%
+    {\ifnum\@tempcnta=\m at ne
+       \bbl at carg\adddialect{l@#1}\language
+     \else
+       \bbl at carg\adddialect{l@#1}\@tempcnta
+     \fi}%
+    {\ifnum\@tempcnta=\m at ne\else
+       \global\bbl at carg\chardef{l@#1}\@tempcnta
+     \fi}}
 \def\bbl at input@texini#1{%
   \bbl at bsphack
     \bbl at exp{%
@@ -3489,10 +3476,26 @@
     \directlua{
        local str = [==[#2]==]
        str = str:gsub('%.%d+%.%d+$', '')
-       tex.print([[\def\string\babeltempa{]] .. str .. [[}]])
+       token.set_macro('babeltempa', str)
     }&%
+    \def\babeltempc{}&%
     \bbl at xin@{,\babeltempa,}{,\bbl at KVP@transforms,}&%
+    \ifin@\else
+      \bbl at xin@{:\babeltempa,}{,\bbl at KVP@transforms,}&%
+    \fi
     \ifin@
+      \bbl at foreach\bbl at KVP@transforms{&%
+        \bbl at xin@{:\babeltempa,}{,##1,}&%
+        \ifin@  &% font:font:transform syntax
+          \directlua{
+            local t = {}
+            for m in string.gmatch('##1'..':', '(.-):') do
+              table.insert(t, m)
+            end
+            table.remove(t)
+            token.set_macro('babeltempc', ',fonts=' .. table.concat(t, ' '))
+          }&%
+        \fi}&%
       \in@{.0$}{#2$}&%
       \ifin@
         \directlua{&% (\attribute) syntax
@@ -3499,17 +3502,18 @@
           local str = string.match([[\bbl at KVP@transforms]],
                         '%(([^%(]-)%)[^%)]-\babeltempa')
           if str == nil then
-            tex.print([[\def\string\babeltempb{}]])
+            token.set_macro('babeltempb', '')
           else
-            tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]])
+            token.set_macro('babeltempb', ',attribute=' .. str)
           end
-        }
+        }&%
         \toks@{#3}&%
         \bbl at exp{&%
           \\\g at addto@macro\\\bbl at release@transforms{&%
             \relax  &% Closes previous \bbl at transforms@aux
             \\\bbl at transforms@aux
-              \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&%
+              \\#1{label=\babeltempa\babeltempb\babeltempc}&%
+                 {\languagename}{\the\toks@}}}&%
       \else
         \g at addto@macro\bbl at release@transforms{, {#3}}&%
       \fi
@@ -4121,8 +4125,8 @@
 \def\bbl at alscripts{,Arabic,Syriac,Thaana,}
 \def\bbl at rscripts{% TODO. Base on codes ??
   ,Imperial Aramaic,Avestan,Cypriot,Hatran,Hebrew,%
-  Old Hungarian,Old Hungarian,Lydian,Mandaean,Manichaean,%
-  Manichaean,Meroitic Cursive,Meroitic,Old North Arabian,%
+  Old Hungarian,Lydian,Mandaean,Manichaean,%
+  Meroitic Cursive,Meroitic,Old North Arabian,%
   Nabataean,N'Ko,Orkhon,Palmyrene,Inscriptional Pahlavi,%
   Psalter Pahlavi,Phoenician,Inscriptional Parthian,Samaritan,%
   Old South Arabian,}%

Modified: trunk/Master/texmf-dist/tex/generic/babel/blplain.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/blplain.tex	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/blplain.tex	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `blplain')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/bplain.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/bplain.tex	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/bplain.tex	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `bplain')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `patterns')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.
@@ -38,10 +38,10 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{hyphen.cfg}[2022/12/26 3.84 Babel hyphens]
+\ProvidesFile{hyphen.cfg}[2022/01/23 3.85 Babel hyphens]
 \xdef\bbl at format{\jobname}
-\def\bbl at version{3.84}
-\def\bbl at date{2022/12/26}
+\def\bbl at version{3.85}
+\def\bbl at date{2022/01/23}
 \ifx\AtBeginDocument\@undefined
   \def\@empty{}
 \fi

Modified: trunk/Master/texmf-dist/tex/generic/babel/luababel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `luatex')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.
@@ -379,9 +379,13 @@
   Babel.linebreaking.before = {}
   Babel.linebreaking.after = {}
   Babel.locale = {} % Free to use, indexed by \localeid
-  function Babel.linebreaking.add_before(func)
+  function Babel.linebreaking.add_before(func, pos)
     tex.print([[\noexpand\csname bbl at luahyphenate\endcsname]])
-    table.insert(Babel.linebreaking.before, func)
+    if pos == nil then
+      table.insert(Babel.linebreaking.before, func)
+    else
+      table.insert(Babel.linebreaking.before, pos, func)
+    end
   end
   function Babel.linebreaking.add_after(func)
     tex.print([[\noexpand\csname bbl at luahyphenate\endcsname]])
@@ -896,7 +900,7 @@
             \global\let\<bbl@##1dflt@\languagename>%
                        \<bbl@##1dflt@*\bbl at tempa>}}}%
       {}}%                               1=T - language, already defined
-  \def\bbl at tempa{\bbl at nostdfont{}}%
+  \def\bbl at tempa{\bbl at nostdfont{}}%  TODO. Don't use \bbl at tempa
   \bbl at foreach\bbl at font@fams{%     don't gather with prev for
     \bbl at ifunset{bbl@##1dflt@\languagename}%
       {\bbl at cs{famrst@##1}%
@@ -1196,8 +1200,36 @@
         \fi}}&%
     \let\bbl at kv@attribute\relax
     \let\bbl at kv@label\relax
+    \let\bbl at kv@fonts\@empty
     \bbl at forkv{#2}{\bbl at csarg\edef{kv@##1}{##2}}&%
-    \ifx\bbl at kv@attribute\relax\else
+    \ifx\bbl at kv@fonts\@empty\else\bbl at settransfont\fi
+    \ifx\bbl at kv@attribute\relax
+      \ifx\bbl at kv@label\relax\else
+        \bbl at exp{\\\bbl at trim@def\\\bbl at kv@fonts{\bbl at kv@fonts}}&%
+        \bbl at replace\bbl at kv@fonts{ }{,}&%
+        \edef\bbl at kv@attribute{bbl at ATR@\bbl at kv@label @#3@\bbl at kv@fonts}&%
+        \count@\z@
+        \def\bbl at elt##1##2##3{&%
+          \bbl at ifsamestring{#3,\bbl at kv@label}{##1,##2}&%
+            {\bbl at ifsamestring{\bbl at kv@fonts}{##3}&%
+               {\count@\@ne}&%
+               {\bbl at error
+                 {Transforms cannot be re-assigned to different\\&%
+                  fonts. The conflict is in '\bbl at kv@label'.\\&%
+                  Apply the same fonts or use a different label}&%
+                 {See the manual for further details.}}}&%
+            {}}&%
+        \bbl at transfont@list
+        \ifnum\count@=\z@
+          \bbl at exp{\global\\\bbl at add\\\bbl at transfont@list
+            {\\\bbl at elt{#3}{\bbl at kv@label}{\bbl at kv@fonts}}}&%
+        \fi
+        \bbl at ifunset{\bbl at kv@attribute}&%
+          {\global\bbl at carg\newattribute{\bbl at kv@attribute}}&%
+          {}&%
+        \global\bbl at carg\setattribute{\bbl at kv@attribute}\@ne
+      \fi
+    \else
       \edef\bbl at kv@attribute{\expandafter\bbl at stripslash\bbl at kv@attribute}&%
     \fi
     \directlua{
@@ -1243,6 +1275,49 @@
     }&%
   \endgroup}
 \endgroup
+\let\bbl at transfont@list\@empty
+\def\bbl at settransfont{%
+  \global\let\bbl at settransfont\relax % Execute only once
+  \gdef\bbl at transfont{%
+    \def\bbl at elt####1####2####3{%
+      \bbl at ifblank{####3}%
+         {\count@\tw@}% Do nothing if no fonts
+         {\count@\z@
+          \bbl at vforeach{####3}{%
+            \def\bbl at tempd{########1}%
+            \edef\bbl at tempe{\bbl at transfam/\f at series/\f at shape}%
+            \ifx\bbl at tempd\bbl at tempe
+              \count@\@ne
+            \else\ifx\bbl at tempd\bbl at transfam
+              \count@\@ne
+            \fi\fi}%
+         \ifcase\count@
+           \bbl at csarg\unsetattribute{ATR@####2@####1@####3}%
+         \or
+           \bbl at csarg\setattribute{ATR@####2@####1@####3}\@ne
+         \fi}}%
+      \bbl at transfont@list}%
+  \AddToHook{selectfont}{\bbl at transfont}% Hooks are global.
+  \gdef\bbl at transfam{-unknown-}%
+  \bbl at foreach\bbl at font@fams{%
+    \AddToHook{##1family}{\def\bbl at transfam{##1}}%
+    \bbl at ifsamestring{\@nameuse{##1default}}\familydefault
+      {\xdef\bbl at transfam{##1}}%
+      {}}}
+\DeclareRobustCommand\enablelocaletransform[1]{%
+  \bbl at ifunset{bbl at ATR@#1@\languagename @}%
+    {\bbl at error
+       {'#1' for '\languagename' cannot be enabled.\\%
+        Maybe there is a typo or it’s a font-dependent transform}%
+       {See the manual for further details.}}%
+    {\bbl at csarg\setattribute{ATR@#1@\languagename @}\@ne}}
+\DeclareRobustCommand\disablelocaletransform[1]{%
+  \bbl at ifunset{bbl at ATR@#1@\languagename @}%
+    {\bbl at error
+       {'#1' for '\languagename' cannot be disabled.\\%
+        Maybe there is a typo or it’s a font-dependent transform}%
+       {See the manual for further details.}}%
+    {\bbl at csarg\unsetattribute{ATR@#1@\languagename @}}}
 \def\bbl at activateposthyphen{%
   \let\bbl at activateposthyphen\relax
   \directlua{
@@ -1334,6 +1409,7 @@
 \def\bbl at textdir#1{%
   \bbl at setluadir{text}\textdir{#1}%
   \chardef\bbl at thetextdir#1\relax
+  % par/text 0..8 = l/l l/r l/al r/l r/r r/al al/l al/r al/al
   \edef\bbl at thedir{\the\numexpr\bbl at thepardir*3+#1}%
   \setattribute\bbl at attr@dir{\numexpr\bbl at thepardir*3+#1}}
 \def\bbl at pardir#1{%
@@ -1344,8 +1420,18 @@
 \def\bbl at dirparastext{\pardir\the\textdir\relax}%   %%%%
 \ifnum\bbl at bidimode>\z@
   \def\bbl at insidemath{0}%
-  \def\bbl at everymath{\def\bbl at insidemath{1}}
-  \def\bbl at everydisplay{\def\bbl at insidemath{2}}
+  \def\bbl at mathboxdir{%
+    \ifcase\bbl at thetextdir\relax
+      \everyhbox{\bbl at mathboxdir@aux L}%
+    \else
+      \everyhbox{\bbl at mathboxdir@aux R}%
+     \fi}
+  \def\bbl at mathboxdir@aux#1{%
+    \@ifnextchar\egroup{}{\textdir T#1T\relax}}
+  \def\bbl at everymath{\bbl at mathboxdir}
+  \def\bbl at everydisplay{%
+    \bbl at mathboxdir
+    \def\bbl at everymath{\bbl at mathboxdir}}
   \frozen at everymath\expandafter{%
     \expandafter\bbl at everymath\the\frozen at everymath}
   \frozen at everydisplay\expandafter{%
@@ -1352,15 +1438,18 @@
     \expandafter\bbl at everydisplay\the\frozen at everydisplay}
   \AtBeginDocument{
     \directlua{
+      Babel.use_math_box_dir = true
       function Babel.math_box_dir(head)
-        if not (token.get_macro('bbl at insidemath') == '0') then
-          if Babel.hlist_has_bidi(head) then
-            local d = node.new(node.id'dir')
-            d.dir = '+TRT'
-            node.insert_before(head, node.has_glyph(head), d)
-            for item in node.traverse(head) do
-              node.set_attribute(item,
-                Babel.attr_dir, token.get_macro('bbl at thedir'))
+        if Babel.use_math_box_dir then
+          if not (token.get_macro('bbl at insidemath') == '0') then
+            if Babel.hlist_has_bidi(head) then
+              local d = node.new(node.id'dir')
+              d.dir = '+TRT'
+              node.insert_before(head, node.has_glyph(head), d)
+              for item in node.traverse(head) do
+                node.set_attribute(item,
+                  Babel.attr_dir, token.get_macro('bbl at thedir'))
+              end
             end
           end
         end
@@ -1403,6 +1492,7 @@
     \ifx\maketag@@@\@undefined % Normal equation, eqnarray
       \AddToHook{env/equation/begin}{%
         \ifnum\bbl at thetextdir>\z@
+          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \let\@eqnnum\bbl at eqnum
           \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
           \chardef\bbl at thetextdir\z@
@@ -1418,6 +1508,8 @@
       \fi
       \AddToHook{env/eqnarray/begin}{%
         \ifnum\bbl at thetextdir>\z@
+          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}
+          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
           \chardef\bbl at thetextdir\z@
           \bbl at add\normalfont{\bbl at eqnodir}%
@@ -1455,6 +1547,7 @@
             \hbox to 0.01pt{\hbox to\displaywidth{\hss{#1}}\hss}}%
         \fi
         \def\bbl at ams@preset#1{%
+          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \ifnum\bbl at thetextdir>\z@
             \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
             \bbl at sreplace\textdef@{\hbox}{\bbl at ams@tagbox\hbox}%
@@ -1462,6 +1555,7 @@
           \fi}%
         \ifnum\bbl at eqnpos=\tw@\else
           \def\bbl at ams@equation{%
+            \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
             \ifnum\bbl at thetextdir>\z@
               \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
               \chardef\bbl at thetextdir\z@
@@ -1487,6 +1581,7 @@
           \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
         \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
         \AddToHook{env/split/before}{%
+          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \ifnum\bbl at thetextdir>\z@
             \bbl at ifsamestring\@currenvir{equation}%
               {\ifx\bbl at ams@lap\hbox % leqno

Modified: trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `nil')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.
@@ -33,7 +33,7 @@
 %% extension |.ins|) which are part of the distribution.
 %%
 
-\ProvidesLanguage{nil}[2022/12/26 3.84 Nil language]
+\ProvidesLanguage{nil}[2022/01/23 3.85 Nil language]
 \LdfInit{nil}{datenil}
 \ifx\l at nil\@undefined
   \newlanguage\l at nil

Modified: trunk/Master/texmf-dist/tex/generic/babel/plain.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/plain.def	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/plain.def	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `plain')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/switch.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/switch.def	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/switch.def	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `kernel')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `texxet')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.

Modified: trunk/Master/texmf-dist/tex/generic/babel/xebabel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/xebabel.def	2023-01-23 20:49:38 UTC (rev 65610)
+++ trunk/Master/texmf-dist/tex/generic/babel/xebabel.def	2023-01-23 20:51:12 UTC (rev 65611)
@@ -7,7 +7,7 @@
 %% babel.dtx  (with options: `xetex')
 %% 
 %%
-%% Copyright (C) 2012-2022 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 2012-2023 Javier Bezos and Johannes L. Braams.
 %% Copyright (C) 1989-2012 Johannes L. Braams and
 %%           any individual authors listed elsewhere in this file.
 %% All rights reserved.
@@ -176,7 +176,7 @@
             \global\let\<bbl@##1dflt@\languagename>%
                        \<bbl@##1dflt@*\bbl at tempa>}}}%
       {}}%                               1=T - language, already defined
-  \def\bbl at tempa{\bbl at nostdfont{}}%
+  \def\bbl at tempa{\bbl at nostdfont{}}%  TODO. Don't use \bbl at tempa
   \bbl at foreach\bbl at font@fams{%     don't gather with prev for
     \bbl at ifunset{bbl@##1dflt@\languagename}%
       {\bbl at cs{famrst@##1}%



More information about the tex-live-commits mailing list.