[latex3-commits] [git/LaTeX3-latex3-babel] master: New key 'justification'. Fix #130. kashida.plain for Persian. (97bc510)

Javier email at dante.de
Wed May 12 17:04:48 CEST 2021


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

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

commit 97bc51059bb26d2f7d595af0bd740e913f60fcc5
Author: Javier <email at localhost>
Date:   Wed May 12 17:04:48 2021 +0200

    New key 'justification'. Fix #130. kashida.plain for Persian.


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

97bc51059bb26d2f7d595af0bd740e913f60fcc5
 README.md                                          |   4 +-
 babel.dtx                                          |  31 ++++++---
 babel.ins                                          |   2 +-
 babel.pdf                                          | Bin 843054 -> 842532 bytes
 bbcompat.dtx                                       |   2 +-
 locale/fa/babel-fa.ini                             |   6 ++
 .../guides/non-standard-hyphenation-with-luatex.md |   2 +-
 news-guides/news/whats-new-in-babel-3.58.md        |   6 +-
 news-guides/news/whats-new-in-babel-3.59.md        |  71 +++++++++++++++------
 samples/lua-arabic.pdf                             | Bin 85278 -> 85285 bytes
 samples/lua-arabic.tex                             |   8 ++-
 11 files changed, 92 insertions(+), 40 deletions(-)

diff --git a/README.md b/README.md
index 70766fd..0d101be 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.58.2366
+## Babel 3.58.2370
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages. Many
@@ -48,6 +48,8 @@ respective authors.
 ```
 3.59   2021-05-??
        * Kashida with user-definable rules (via transforms).
+       * Fixes:
+         - \babel at texpdf inconsistently defined (#130)
        
 3.58   2021-04-26
        * More predefined transforms (lua):
diff --git a/babel.dtx b/babel.dtx
index b6eb2ba..2c44168 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -31,7 +31,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2021/05/08 v3.58.2366 The Babel package]
+\ProvidesFile{babel.dtx}[2021/05/12 v3.58.2370 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -3088,10 +3088,10 @@ four characters: \textit{!?:;}\,.}
 \textit{ssz}, \textit{tty} and \textit{zzs} as \textit{cs-cs},
 \textit{dz-dz}, etc.}
 
-\trans{Norsk}{doubleletter.hyphen}{Hyphenates the doble-letter groups
-\textit{bb}, \textit{dd}, \textit{ff}, \textit{gg}, \textit{ll},
-\textit{mm}, \textit{nn}, \textit{pp}, \textit{rr}, \textit{ss},
-\textit{tt} as \textit{bb-b}, \textit{dd-d}, etc.}
+\trans{Arabic, Persian}{kashida.plain}{Experimental. A very simple and
+basic transform for ‘plain’ Arabic fonts, which attempts to distribute
+the tatwil as evenly as possible (starting at the end of the line). See
+the news for version 3.59.}
 
 \trans{Serbian}{transliteration.gajica}{(Note |serbian| with |ini|
 files refers to the Cyrillic script, which is here the target.) The
@@ -4958,8 +4958,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.58.2366>>
-%<<date=2021/05/08>>
+%<<version=3.58.2370>>
+%<<date=2021/05/12>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -7665,7 +7665,6 @@ help from Bernd Raichle, for which I am grateful.
     \emergencystretch\maxdimen
     \babel at savevariable\hbadness
     \hbadness\@M
-    \hfuzz=10pt
   \else
     % other = select patterns
     \bbl at patterns{#1}%
@@ -8990,7 +8989,7 @@ help from Bernd Raichle, for which I am grateful.
 %    \begin{macrocode}
 \def\babel at texpdf#1#2#3#4{%
   \ifx\texorpdfstring\@undefined
-    \textormath{#1}{#2}%
+    \textormath{#1}{#3}%
   \else
     \texorpdfstring{\textormath{#1}{#3}}{#2}%
     % \texorpdfstring{\textormath{#1}{#3}}{\textormath{#2}{#4}}%
@@ -10793,6 +10792,7 @@ help from Bernd Raichle, for which I am grateful.
   \let\bbl at KVP@language\@nil
   \let\bbl at KVP@hyphenrules\@nil
   \let\bbl at KVP@linebreaking\@nil
+  \let\bbl at KVP@justification\@nil
   \let\bbl at KVP@mapfont\@nil
   \let\bbl at KVP@maparabic\@nil
   \let\bbl at KVP@mapdigits\@nil
@@ -10974,6 +10974,16 @@ help from Bernd Raichle, for which I am grateful.
   \fi
   \bbl at provide@intraspace
   %
+  \ifx\bbl at KVP@justification\@nil\else
+     \let\bbl at KVP@linebreaking\bbl at KVP@justification
+  \fi
+  \ifx\bbl at KVP@linebreaking\@nil\else
+    \bbl at xin@{,\bbl at KVP@linebreaking,}{,elongated,kashida,cjk,unhyphenated,}%
+    \ifin@
+      \bbl at csarg\xdef
+        {lnbrk@\languagename}{\expandafter\@car\bbl at KVP@linebreaking\@nil}%
+    \fi
+  \fi
   \bbl at xin@{/e}{/\bbl at cl{lnbrk}}
   \ifin@\else\bbl at xin@{/k}{/\bbl at cl{lnbrk}}\fi
   \ifin@\bbl at arabicjust\fi
@@ -13833,6 +13843,7 @@ function Babel.arabic.justify(head)
 
   for line in node.traverse_id(node.id'hlist', head) do
     % Exclude last line. todo. But-- it discards one-word lines, too!
+    % ? Look for glue = 12:15
     if (line.glue_sign == 1 and line.glue_order == 0) then
       elongs = {}     % Stores elongated candidates of each line
       k_list = {}     % And all letters with kashida
@@ -13854,7 +13865,7 @@ function Babel.arabic.justify(head)
         % Tatwil
         if Babel.kashida_wts then
           local k_wt = node.get_attribute(n, KASHIDA)
-          if k_wt > 0 then
+          if k_wt > 0 then % todo. parameter for multi inserts
             table.insert(k_list, {node = n, weight = k_wt, pos = pos_inline})
           end
         end
diff --git a/babel.ins b/babel.ins
index 5d94d37..4bc9959 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/05/08}
+\def\filedate{2021/05/12}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index 2c6399c..1b8889e 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 46f5169..1b91b53 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2021/05/08 v3.58.2366]
+\ProvidesFile{bbcompat.dtx}[2021/05/12 v3.58.2370]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
diff --git a/locale/fa/babel-fa.ini b/locale/fa/babel-fa.ini
index a931a40..ceedaf1 100644
--- a/locale/fa/babel-fa.ini
+++ b/locale/fa/babel-fa.ini
@@ -177,3 +177,9 @@ superscriptingExponent = ×
 abjad = ا ب ج د ه‍ و ز ح ط ی ک ل م ن س ع ف ص ق ر ش ت ث خ ذ ض ظ غ
 alphabetic = ا ب پ ت ث ج چ ح خ د ذ ر ز ژ س ش ص ض ط ظ ع غ ف ق ک گ ل م ن و ه‍ ی 
 
+[transforms.prehyphenation]
+kashida.plain.1.0 = { ()[يئهشسقفغعضصنمكلظطخحچجثتپب]()[يئهشسقفغعضصنمكلظطخحچجثتپباأإآوؤذدژزرة] }
+kashida.plain.1.1 = { kashida = 500 }
+kashida.plain.2.0 = { ()ل()[اأإآ] }
+kashida.plain.2.1 = { kashida = 0 }
+
diff --git a/news-guides/guides/non-standard-hyphenation-with-luatex.md b/news-guides/guides/non-standard-hyphenation-with-luatex.md
index b613f6e..cb6e5ae 100644
--- a/news-guides/guides/non-standard-hyphenation-with-luatex.md
+++ b/news-guides/guides/non-standard-hyphenation-with-luatex.md
@@ -138,7 +138,7 @@ with digraphs and trigraphs):
   points, the first one takes precedence (in other words, the second
   one is penalised):
 ```tex
-\babelposthyphenation{ngerman}{[aeiouáéíóú]|[aeiouáéíóú][aeiouáéíóú]|}{
+\babelposthyphenation{spanish}{[aeiouáéíóú]|[aeiouáéíóú][aeiouáéíóú]|}{
   {}, {}, {}, {},
   { pre=-, penalty=1000, data=4 },
 }
diff --git a/news-guides/news/whats-new-in-babel-3.58.md b/news-guides/news/whats-new-in-babel-3.58.md
index d62a9d3..3e1606b 100644
--- a/news-guides/news/whats-new-in-babel-3.58.md
+++ b/news-guides/news/whats-new-in-babel-3.58.md
@@ -9,7 +9,7 @@
 **Czech, Polish, Slovak** ▸  `oneletter.nobreak` ▸ Converts a space after a non-syllabic preposition or conjunction into a non-breaking space.
 
 **Hindi, Sanskrit** ▸ `punctuation.space` ▸ Inserts a space before the following
-four characters: \textit{!?:;}\,. Added `transliteration.hk` for
+four characters: `!?:;`. Added `transliteration.hk` for
 Sanskrit, too.
 
 **Norsk** ▸ `doubleletter.hyphen` ▸ Hyphenates the doble-letter groups `bb`, `dd`, `ff`, `gg`, `ll`, `mm`, `nn`, `pp`, `rr`, `ss`, `tt` as `bb-b`, `dd-d`, etc. 
@@ -52,7 +52,7 @@ because the patterns so called set the line breaking mode to
 So, currently there are two modes for scripts that separate words with
 spaces, and two modes for scripts with no word separator. Further modes
 could be added in the future, and there is work in progress for
-‘Justification alternates’ and tatwell in Arabic (see below).
+‘Justification alternates’ and tatwil in Arabic (see below).
 
 See also [here](whats-new-in-babel-3.57.md) for Uyghur hyphenation.
 
@@ -82,4 +82,4 @@ The last macro is temporary. It will be removed.
 
 ## Fixes
 
-## Other changes
+* `\shorthandoff*{^}` was not revertible (#126).
diff --git a/news-guides/news/whats-new-in-babel-3.59.md b/news-guides/news/whats-new-in-babel-3.59.md
index 96f4976..a0585f4 100644
--- a/news-guides/news/whats-new-in-babel-3.59.md
+++ b/news-guides/news/whats-new-in-babel-3.59.md
@@ -4,24 +4,28 @@
 
 ## More experimental Arabic justification
 
-But useable at your own rink, because the interface is unfinished and
-very likely will change. Note also there are still many pending issues –
-for example, lists just doesn't work.
-
-There are two modes: `elongated` and `kashida`. Actually the latter is the
-same as the former, but without real justification alternatives. If you
-only want elongated glyphs with ‘elongated’, just don’t define any
-kashida rule.
+But useable at your own rink, because there are still many pending issues –
+for example, lists or stretched hboxes doesn't work. Note also the
+interface is unfinished and very likely will change. 
 
 For practical reasons, currently `bidi=basic` is required.
 
+There are two modes: `elongated` and `kashida`. The latter is the same
+as the former, but without real justification alternatives (based on
+the OpenType `jalt` table). If you only want elongated glyphs with
+the ‘elongated’ mode, just don’t define any kashida rule.
+
 The points were kashida have to be inserted if necessary are defined by
-means of ‘transforms’. In other words, they are not hardcoded and you
-can define you own rules with different weights (including rules for
-words matching some patterns). A very simple and basic transform is
-included for ’plain’ Arabic fonts, which attempts to distribute the
-tatwil as evenly as possible, starting at the end of the line. Its
-named `kashida.plain` and no ligature is taken into account (except, of
+means of ‘transforms’. In other words, they are not hard coded and you
+can define your own rules with different weights (including rules for
+words matching some patterns). The insertion starts at the end of the
+line. The value sets a precedence: first attempt kashida with the
+highest values, then the following.
+
+A very simple and basic transform for `arabic` and `persian` is
+included for ‘plain’ Arabic fonts, which attempts to distribute the
+tatwil as evenly as possible. It’s named `kashida.plain` (with
+precedence 500) and no ligature is taken into account (except, of
 course, for the lam-alif).
 
 So:
@@ -29,27 +33,29 @@ So:
 \usepackage[bidi=basic]{babel}
 
 \babelprovide[import, main,
-  typography/linebreaking = k, % This will change for sure!
+  justification = kashida, % Or 'elongated'
   transforms = kashida.plain
   ]{arabic}
 
+  
 \babelfont{rm}{FreeSerif}
 ```
 
-An example of how to fine tune these rules is (with Sakkal Majalla):
-```
+An example of how to fine tune these rules is (with Sakkal Majalla,
+which inserts a joiner at some places):
+```tex
 \babelprehyphenation{arabic}{ () ب () ر }{ kashida = 0 }
 ```
 Of course, these setting must be also font dependent, but for the
 moment this is what it is.
 
 As an example, the following rule is applied to words with at least 3
-letters. A (probably long) kashida is added to the last but one
-char with certain combinations.
-```
+letters. With certain combinations, a (probably long) kashida is added
+to the last but one char.
+```tex
 \babelprehyphenation{arabic}{
   {a}
-  () [ي ئ ه ش س ق ف غ ع ض ص ن م ك ظ ط خ ح ج ث ت ب ] () % ل
+  () [ي ئ ه ش س ق ف غ ع ض ص ن م ل ك ظ ط خ ح ج ث ت ب ] () 
   [ي ئ ه ق ن ك ث ت ب ا أ إ آ و ؤ ذ د ز ر ة]
   [|،,.){]}] }
 { kashida = 500 }
@@ -61,3 +67,26 @@ This feature can be deactivated with:
 \babeladjust{ justify.arabic = off }
 ```
 Use `on` to reactivate it.
+
+A explained above, the are still open issues. There will be in addition
+further parameters (number of tatwils to be inserted, preference by
+position in the line...).
+
+There is some tolerance in the insertion of kashida, set with (syntax
+liable to change!):
+```
+\directlua{ Babel.arabic.justify_factor = 0.95 }
+```
+This is the default. 1 means no tolerance. With lower values, there are
+less tatwils and larger spaces.
+
+## New key for transforms
+
+`step = <num>` moves the pointer forward (if positive) or backwards (if
+negative). By default it's, of course, `0`, which leaves the pointer
+just after the last replacement. It can be set in any non-empty
+replacement (eg, `{ string = a, step = -1 }`)
+
+# Fixes
+
+* \babel at texpdf inconsistently defined (#130).
diff --git a/samples/lua-arabic.pdf b/samples/lua-arabic.pdf
index 6ee50a0..d532cfb 100644
Binary files a/samples/lua-arabic.pdf and b/samples/lua-arabic.pdf differ
diff --git a/samples/lua-arabic.tex b/samples/lua-arabic.tex
index b8e6bd8..fb3e9b2 100644
--- a/samples/lua-arabic.tex
+++ b/samples/lua-arabic.tex
@@ -2,19 +2,23 @@
 \documentclass[a4paper]{book}
 
 % ===================
+
 \usepackage[english, arabic, provide=*,
             bidi=basic, 
             headfoot=arabic,  % an alternative is layout=sectioning
             layout=counters.tabular]{babel}
+            
 % == Alternative for kashida ==    
+
 % \usepackage[english,
 %             bidi=basic, 
 %             headfoot=arabic,  % an alternative is layout=sectioning
 %             layout=counters.tabular]{babel}        
 % \babelprovide[import, main,
-%   % typography/linebreaking = k,
-%   % transforms = kashida.plain
+%   justification = kashida,
+%   transforms = kashida.plain
 %   ]{arabic}
+
 % =====================
 
 \babelfont{rm}





More information about the latex3-commits mailing list.