[latex3-commits] [latex3/babel] main: \BabelUppercaseMapping (and Lower). Removed some tentative code for kashida. (6eafdda)

github at latex-project.org github at latex-project.org
Sat Jun 24 19:04:23 CEST 2023


Repository : https://github.com/latex3/babel
On branch  : main
Link       : https://github.com/latex3/babel/commit/6eafdda2e997ff7e7a9dc726ed4ab00d89cd6ec8

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

commit 6eafdda2e997ff7e7a9dc726ed4ab00d89cd6ec8
Author: Javier <email at localhost>
Date:   Sat Jun 24 19:04:23 2023 +0200

    \BabelUppercaseMapping (and Lower). Removed some tentative code for kashida.


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

6eafdda2e997ff7e7a9dc726ed4ab00d89cd6ec8
 README.md                          |   6 +-
 babel-code.pdf                     | Bin 627189 -> 625415 bytes
 babel.dtx                          | 125 +++++++++++++------------------------
 babel.ins                          |   2 +-
 babel.pdf                          | Bin 403169 -> 402011 bytes
 bbcompat.dtx                       |   2 +-
 locale/la/babel-classicallatin.tex |   6 +-
 locale/la/babel-medievallatin.tex  |   7 ++-
 8 files changed, 54 insertions(+), 94 deletions(-)

diff --git a/README.md b/README.md
index 9129dec..ff2b714 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.89.14772
+## Babel 3.89.17574
 
 *Development.*
 
@@ -41,7 +41,7 @@ contact the developer, and not us!
 
 You may also report them to the current maintainer more informally on:
 
-   http://www.texnia.com/contact.html
+   https://latex3.github.io/babel/contact.html
 
 Bugs related to specific languages are best reported to their
 respective authors.
@@ -51,6 +51,8 @@ respective authors.
 3.90  (dev)
       * Main language selected at begindocument/before.
       * Option to limit the number of inserted tatweel.
+      * New macros `\BabelUppercaseMapping`, 
+        `\BabelLowercaseMapping`, and...
 
 3.89  2023-05-11
       * Deprecating \SetCase, \aliasshorthands, and 'strings' package
diff --git a/babel-code.pdf b/babel-code.pdf
index 69a98cd..53381d1 100644
Binary files a/babel-code.pdf and b/babel-code.pdf differ
diff --git a/babel.dtx b/babel.dtx
index b84ac70..155587f 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2023/05/27 v3.89.14772 The Babel package]
+\ProvidesFile{babel.dtx}[2023/06/24 v3.89.17574 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -2633,7 +2633,7 @@ languages loaded on the fly are not yet available in the preamble.
 Blah \foreignlanguage{ipa}{ɔːlˈðəʊ} Blah.
 \end{document}
 \end{verbatim}
-  Then you can define shorthands, transforms (if \luatex), and so on. 
+  Then you can define shorthands, transforms (with \luatex), and so on. 
 \end{example}
 
 \begin{example}
@@ -5416,8 +5416,8 @@ wouldn’t exist.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.89.14772>>
-%<<date=2023/05/27>>
+%<<version=3.89.17574>>
+%<<date=2023/06/24>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -10286,9 +10286,10 @@ wouldn’t exist.
         \let\\\@Alph\<bbl at cntr@\bbl at KVP@Alph @\languagename>}}%
   \fi
   % == Casing ==
-  \bbl at exp{\def\<bbl at casing@\languagename>%
-    {\<bbl at lbcp@\languagename>%
-     \ifx\bbl at KVP@casing\@nnil\else-x-\bbl at KVP@casing\fi}}%
+  \ifx\bbl at KVP@casing\@nnil\else
+    \bbl at csarg\xdef{casing@\languagename}%
+      {\@nameuse{bbl at casing@\languagename}-x-\bbl at KVP@casing}%
+  \fi
   % == Calendars ==
   \ifx\bbl at KVP@calendar\@nnil
     \edef\bbl at KVP@calendar{\bbl at cl{calpr}}%
@@ -10749,11 +10750,9 @@ wouldn’t exist.
   \bbl at exp{\\\bbl at exportkey{lname}{identification.name.opentype}%
     {\csname bbl at elname@\languagename\endcsname}}%
   \bbl at exportkey{tbcp}{identification.tag.bcp47}{}%
-  \bbl at exportkey{lbcp}{identification.language.tag.bcp47}{}%
   % Somewhat hackish. TODO
-  \bbl at exportkey{casing}{identification.language.tag.bcp47}{}%
-  \bbl at exp{\gdef\<bbl at casing@\languagename>%
-    {\<bbl at lbcp@\languagename>}}%
+  \bbl at exportkey{casing}{identification.tag.bcp47}{}%
+  \bbl at exportkey{lbcp}{identification.language.tag.bcp47}{}%
   \bbl at exportkey{lotf}{identification.tag.opentype}{dflt}%
   \bbl at exportkey{esname}{identification.script.name}{}%
   \bbl at exp{\\\bbl at exportkey{sname}{identification.script.name.opentype}%
@@ -11422,8 +11421,18 @@ wouldn’t exist.
       {\bbl at ifunset{bbl@\csname bbl at info@#1.tag.bcp47\endcsname @#2}{}%
         {\bbl at cs{\csname bbl at info@#1.tag.bcp47\endcsname @#2}}}}
 \fi
-% Still somewhat hackish:
+% Still somewhat hackish. WIP.
 \@namedef{bbl at info@casing.tag.bcp47}{casing}
+\newcommand\BabelUppercaseMapping[3]{%
+  \let\bbl at tempx\languagename
+  \edef\languagename{#1}%
+  \DeclareUppercaseMapping[\BCPdata{casing}]{#2}{#3}%
+  \let\languagename\bbl at tempx}
+\newcommand\BabelLowercaseMapping[3]{%
+  \let\bbl at tempx\languagename
+  \edef\languagename{#1}%
+  \DeclareLowercaseMapping[\BCPdata{casing}]{#2}{#3}%
+  \let\languagename\bbl at tempx}
 %    \end{macrocode}
 %
 % With version 3.75 |\BabelEnsureInfo| is executed always, but there is
@@ -12299,7 +12308,7 @@ wouldn’t exist.
 \bbl at trace{Loading basic (internal) bidi support}
 \ifodd\bbl at engine
 \else % TODO. Move to txtbabel
-  \ifnum\bbl at bidimode>100 \ifnum\bbl at bidimode<200
+  \ifnum\bbl at bidimode>100 \ifnum\bbl at bidimode<200 % Any lua bidi=
     \bbl at error
       {The bidi method 'basic' is available only in\\%
        luatex. I'll continue with 'bidi=default', so\\%
@@ -12317,7 +12326,7 @@ wouldn’t exist.
         \bbl at loadfontspec % bidi needs fontspec
         \usepackage#1{bidi}}%
     \fi}
-  \ifnum\bbl at bidimode>200
+  \ifnum\bbl at bidimode>200 % Any xe bidi=
     \ifcase\expandafter\@gobbletwo\the\bbl at bidimode\or
       \bbl at tentative{bidi=bidi}
       \bbl at loadxebidi{}
@@ -12329,7 +12338,7 @@ wouldn’t exist.
   \fi
 \fi
 % TODO? Separate:
-\ifnum\bbl at bidimode=\@ne
+\ifnum\bbl at bidimode=\@ne % Any bidi= except default=1
   \let\bbl at beforeforeign\leavevmode
   \ifodd\bbl at engine
     \newattribute\bbl at attr@dir
@@ -12462,7 +12471,7 @@ wouldn’t exist.
     \newtoks\everypar
     \everypar=\bbl at severypar
     \bbl at severypar{\bbl at xeeverypar\the\everypar}}
-  \ifnum\bbl at bidimode>200
+  \ifnum\bbl at bidimode>200 % Any xe bidi=
     \let\bbl at textdir@i\@gobbletwo
     \let\bbl at xebidipar\@empty
     \AddBabelHook{bidi}{foreign}{%
@@ -13428,7 +13437,7 @@ wouldn’t exist.
 %    \begin{macrocode}
 %<<*Footnote changes>>
 \bbl at trace{Bidi footnotes}
-\ifnum\bbl at bidimode>\z@
+\ifnum\bbl at bidimode>\z@ % Any bidi=
   \def\bbl at footnote#1#2#3{%
     \@ifnextchar[%
       {\bbl at footnote@o{#1}{#2}{#3}}%
@@ -14378,7 +14387,7 @@ end
   \let\bbl at arabicjust\relax
   \newattribute\bblar at kashida
   \newattribute\bblar at kashida@aux % 0, 1=tatweel, 2=diacritics
-  \directlua{
+  \directlua{%  WIP
     Babel.attr_kashida = luatexbase.registernumber'bblar at kashida' 
     Babel.attr_kashida_aux = luatexbase.registernumber'bblar at kashida@aux'
   }%
@@ -14452,7 +14461,6 @@ end
 \begingroup
 \catcode`#=11
 \catcode`~=11
-
 \directlua{
 
 Babel.arabic = Babel.arabic or {}
@@ -14494,7 +14502,6 @@ function Babel.arabic.justify_hlist(head, line, gc, size, pack)
   local GLYPH = node.id'glyph'
   local KASHIDA = Babel.attr_kashida
   local LOCALE = Babel.attr_locale
-  local k_middle = {}
 
   if line == nil then
     line = {}
@@ -14604,48 +14611,6 @@ function Babel.arabic.justify_hlist(head, line, gc, size, pack)
       end
     end
 
-    % WIP. Mostly works, but vertical placement requires more work. 
-    Babel.kashida_placement = Babel.kashida_placement or 'end'
-
-    if Babel.kashida_placement == 'center' then
-      local K_AUX = Babel.attr_kashida_aux
-      cnt = 0
-      for n in node.traverse_id(GLYPH, line.head) do
-        % print('>>', string.format("\@percentchar x", n.char),
-        %       node.get_attribute(n, K_AUX) )
-        if node.get_attribute(n, K_AUX) == 1 or
-            n.char == 0x0640 then
-          % if not(n.char == 0x0640) then print('----', n.char) end
-          cnt = cnt + 1
-          k_middle[cnt] = n
-        elseif node.get_attribute(n, K_AUX) == 2 and cnt > 0 then
-          local xn
-          xn = node.copy(n)
-          if (cnt \@percentchar 2 == 0) then
-            cnt = cnt/2
-            xn.xoffset = n.prev.width/2
-          else
-            cnt = (cnt + 1)/2
-            xn.xoffset = 0
-          end        
-          node.remove(line.head, n)
-          % xn.yoffset = 0
-          node.insert_after(line.head, k_middle[cnt], xn)
-        else
-          cnt = 0
-        end
-      end
-    end
-
-%     print('========')
-%     for n in node.traverse(line.head) do
-%       if n.id == GLYPH then
-%         print('>>', string.format("\@percentchar x", n.char), n.yoffset, n.xoffset)
-%       else
-%         print('[' .. n.id .. ']')
-%       end
-%     end
-
     ::next_line::
 
     % Must take into account marks and ins, see luatex manual.
@@ -15079,26 +15044,12 @@ end
   \directlua{
     Babel = Babel or {}
     %
-    function Babel.kashida_flag(head) % WIP
-      for n in node.traverse_id(node.id'glyph', head) do
-        if n.char == 0x064b or n.char == 0x064d or
-            n.char == 0x064e or n.char == 0x0640f or 
-            n.char == 0x0650  or n.char == 0x0670 then
-          node.set_attribute(n, Babel.attr_kashida_aux, 2)
-        elseif n.char == 0x0640 then
-          node.set_attribute(n, Babel.attr_kashida_aux, 1)
-        end
-      end 
-      return head
-    end
-    %
     function Babel.pre_otfload_v(head)
       if Babel.numbers and Babel.digits_mapped then
         head = Babel.numbers(head)
       end
       if Babel.bidi_enabled then
         head = Babel.bidi(head, false, dir)
-        head = Babel.kashida_flag(head)
       end
       return head
     end
@@ -15109,7 +15060,6 @@ end
       end
       if Babel.bidi_enabled then
         head = Babel.bidi(head, false, dir)
-        head = Babel.kashida_flag(head)
       end
       return head
     end
@@ -15134,7 +15084,7 @@ end
 % math with the package option bidi=.
 %
 %    \begin{macrocode}
-\ifnum\bbl at bidimode>\@ne % Excludes default=1
+\ifnum\bbl at bidimode>\@ne % Any bidi= except default=1
   \let\bbl at beforeforeign\leavevmode
   \AtEndOfPackage{\EnableBabelHook{babel-bidi}}
   \RequirePackage{luatexbase}
@@ -15189,7 +15139,7 @@ end
 % math.
 %
 %    \begin{macrocode}
-\ifnum\bbl at bidimode>\z@
+\ifnum\bbl at bidimode>\z@ % Any bidi=
   \def\bbl at insidemath{0}%
   \def\bbl at everymath{\def\bbl at insidemath{1}}
   \def\bbl at everydisplay{\def\bbl at insidemath{2}}
@@ -15227,6 +15177,17 @@ end
 % --, margins, etc.) with |bidi=basic|, without having to patch
 % almost any macro where text direction is relevant.
 %
+% Still, there are three areas deserving special attention, namely,
+% tabular, math, and graphics, text and intrinsically left-to-right
+% elements are intermingled. I've made some progress in graphics, but
+% they're essentially hacks; I've also made some progress in `tabular`,
+% but when I decided to tackle math (both standard math and `amsmath`)
+% the nightmare began. I'm still not sure how `amsmath` should be
+% modified, but the main problem is that, boxes are “generic”
+% containers that can hold text, math, and graphics (even at the same
+% time; remember that inline math is included in the list of text nodes
+% marked with 'math' (11) nodes too).
+%
 % |\@hangfrom| is useful in many contexts and it is redefined always
 % with the |layout| option.
 %
@@ -15251,7 +15212,7 @@ end
 \DeclareOption{fleqn}{\chardef\bbl at eqnpos\tw@}
 %<</More package options>>
 %
-\ifnum\bbl at bidimode>\z@
+\ifnum\bbl at bidimode>\z@ % Any bidi=
   \ifx\matheqdirmode\@undefined\else
     \matheqdirmode\@ne % A luatex primitive
   \fi
@@ -15449,7 +15410,7 @@ end
   {\IfBabelLayout{notabular}%
     {\chardef\bbl at tabular@mode\z@}%
     {\chardef\bbl at tabular@mode\@ne}}% Mixed, with LTR cols
-\ifnum\bbl at bidimode>\@ne
+\ifnum\bbl at bidimode>\@ne % Any bidi= except default=1
   \ifnum\bbl at tabular@mode=\@ne
     \let\bbl at parabefore\relax
     \AddToHook{para/before}{\bbl at parabefore}
@@ -15494,7 +15455,7 @@ end
 % |\@hangfrom|.
 %    
 %    \begin{macrocode}
-\ifnum\bbl at bidimode>\z@
+\ifnum\bbl at bidimode>\z@ % Any bidi=
   \def\bbl at nextfake#1{%  non-local changes, use always inside a group!
     \bbl at exp{%
       \def\\\bbl at insidemath{0}%
diff --git a/babel.ins b/babel.ins
index 3c79dfd..b93f13f 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{2023/05/27}
+\def\filedate{2023/06/24}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index e261d20..4e8a4c4 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index c874d12..0adbc42 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2023/05/27 v3.89.14772]
+\ProvidesFile{bbcompat.dtx}[2023/06/24 v3.89.17574]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
diff --git a/locale/la/babel-classicallatin.tex b/locale/la/babel-classicallatin.tex
index bdd9d98..f3df2a7 100644
--- a/locale/la/babel-classicallatin.tex
+++ b/locale/la/babel-classicallatin.tex
@@ -15,11 +15,7 @@
   \def\BabelDated#1{\@Roman{#1}}}
 
 \StartBabelCommands{\languagename}{}
-  \SetCase
-    {\uccode`u=`V\relax}
-    {\lccode`V=`u\relax}
-  \SetHyphenMap{%
-    \BabelLower{`V}{`u}}
+  \SetHyphenMap{\BabelLower{`V}{`u}}
 \EndBabelCommands
 
 \endinput
\ No newline at end of file
diff --git a/locale/la/babel-medievallatin.tex b/locale/la/babel-medievallatin.tex
index b380087..c99872f 100644
--- a/locale/la/babel-medievallatin.tex
+++ b/locale/la/babel-medievallatin.tex
@@ -15,11 +15,12 @@
   \def\BabelDated#1{\@Roman{#1}}}
 
 \StartBabelCommands{\languagename}{}
-  \SetCase
-    {\uccode`u=`V\relax}
-    {\lccode`V=`u\relax}
   \SetHyphenMap{%
     \BabelLower{`V}{`u}}
 \EndBabelCommands
 
+% TODO. Must be defined somehow in the ini file:
+\DeclareUppercaseMapping[la-x-medieval]{`u}{V}
+\DeclareLowercaseMapping[la-x-medieval]{`v}{U}
+
 \endinput
\ No newline at end of file





More information about the latex3-commits mailing list.