[latex3-commits] [git/LaTeX3-latex3-babel] master: RTL text inside \put (with pict2e) and \tikz. (cb6adf3)

Javier email at dante.de
Sat Feb 20 16:48:58 CET 2021


Repository : https://github.com/latex3/babel
On branch  : master
Link       : https://github.com/latex3/babel/commit/cb6adf3b85ed0d2c50a4e5236dd6dbf0647dc362

>---------------------------------------------------------------

commit cb6adf3b85ed0d2c50a4e5236dd6dbf0647dc362
Author: Javier <email at localhost>
Date:   Sat Feb 20 16:48:58 2021 +0100

    RTL text inside \put (with pict2e) and \tikz.


>---------------------------------------------------------------

cb6adf3b85ed0d2c50a4e5236dd6dbf0647dc362
 README.md    |   7 +++++--
 babel.dtx    |  65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 babel.ins    |   2 +-
 babel.pdf    | Bin 816448 -> 818709 bytes
 bbcompat.dtx |   2 +-
 5 files changed, 69 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index 2995d1d..16f9fd2 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.53.2288
+## Babel 3.53.2289
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages.  Many
@@ -43,7 +43,10 @@ respective authors.
 
 ### Latest changes
 ```
-3.54   2021-02-??
+3.54   2021-02-23??
+       * RTL text inside \put (with pict2e) correctly rendered in
+         typical cases (#98).
+       * Same for \tikz.
        * 
        
 3.53   2021-01-26
diff --git a/babel.dtx b/babel.dtx
index 77e95e6..13d5be7 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -31,7 +31,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2021/02/19 v3.53.2288 The Babel package]
+\ProvidesFile{babel.dtx}[2021/02/20 v3.53.2289 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -4850,8 +4850,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.53.2288>>
-%<<date=2021/02/19>>
+%<<version=3.53.2289>>
+%<<date=2021/02/20>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -14298,6 +14298,65 @@ end
      \fi}%
    \ifx\AddToHook\@undefined\else
      \AddToHook{env/picture/begin}{\bbl at pictsetdir\z@}%
+     \directlua{
+       Babel.get_picture_dir = true
+       Babel.picture_has_bidi = 0
+       function Babel.picture_dir (head)
+         if not Babel.get_picture_dir then return head end
+         for item in node.traverse(head) do
+           if item.id == node.id'glyph' then
+             local itemchar = item.char
+             % TODO. Copypaste pattern from Babel.bidi (-r)
+             local chardata = Babel.characters[itemchar]
+             local dir = chardata and chardata.d or nil
+             if not dir then
+               for nn, et in ipairs(Babel.ranges) do
+                 if itemchar < et[1] then
+                   break
+                 elseif itemchar <= et[2] then
+                   dir = et[3]
+                   break
+                 end
+               end
+             end
+             if dir and (dir == 'al' or dir == 'r') then
+               Babel.picture_has_bidi = 1
+             end
+           end
+         end
+         return head
+       end
+       luatexbase.add_to_callback("hpack_filter", Babel.picture_dir,
+         "Babel.picture_dir")
+     }%
+   \long\def\put(#1,#2)#3{%
+     \@killglue 
+     % Try:
+     \ifx\bbl at pictresetdir\relax
+       \count@=\z@
+     \else
+       \directlua{
+         Babel.get_picture_dir = true
+         Babel.picture_has_bidi = 0
+       }%
+       \setbox\z@\hb at xt@\z@{%
+         \@defaultunitsset\@tempdimc{#1}\unitlength
+         \kern\@tempdimc
+         #3\hss}%
+       \directlua{
+         Babel.get_picture_dir = false;
+         tex.print( [[\string\count@=]] .. Babel.picture_has_bidi );
+       }%
+       \relax % 'Close' the number
+     \fi
+     % Do:
+     \@defaultunitsset\@tempdimc{#2}\unitlength
+     \raise\@tempdimc\hb at xt@\z@{%
+       \@defaultunitsset\@tempdimc{#1}\unitlength
+       \kern\@tempdimc
+       {\ifnum\count@>\z@\bbl at pictresetdir\fi#3}\hss}% 
+     \ignorespaces}
+     \MakeRobust\put
    \fi
    \AtBeginDocument
      {\ifx\tikz at atbegin@node\@undefined\else
diff --git a/babel.ins b/babel.ins
index eca8041..827cb7f 100644
--- a/babel.ins
+++ b/babel.ins
@@ -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{2021/02/19}
+\def\filedate{2021/02/20}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index fac53c4..005d08b 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 6a49d64..de51f14 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2021/02/19 v3.53.2288]
+\ProvidesFile{bbcompat.dtx}[2021/02/20 v3.53.2289]
 %</dtx>
 %
 %% File 'bbcompat.dtx'





More information about the latex3-commits mailing list.