[latex3-commits] [git/LaTeX3-latex3-latex3] text-map: Support Regional Indicators (612c8fe3f)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Aug 9 08:50:57 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : text-map
Link       : https://github.com/latex3/latex3/commit/612c8fe3fd35833b24d7db70dee98671cd3cc34c

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

commit 612c8fe3fd35833b24d7db70dee98671cd3cc34c
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Aug 9 07:50:57 2022 +0100

    Support Regional Indicators


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

612c8fe3fd35833b24d7db70dee98671cd3cc34c
 l3kernel/l3text-map.dtx                 | 49 +++++++++++++++++++++++++++++++++
 l3kernel/l3text.dtx                     |  6 ++--
 l3kernel/testfiles/m3text006.luatex.tlg | 12 ++++----
 l3kernel/testfiles/m3text006.ptex.tlg   | 12 ++++----
 l3kernel/testfiles/m3text006.tlg        | 12 ++++----
 l3kernel/testfiles/m3text006.xetex.tlg  | 12 ++++----
 6 files changed, 76 insertions(+), 27 deletions(-)

diff --git a/l3kernel/l3text-map.dtx b/l3kernel/l3text-map.dtx
index 3753c2874..c9d7961a4 100644
--- a/l3kernel/l3text-map.dtx
+++ b/l3kernel/l3text-map.dtx
@@ -121,6 +121,10 @@
 %     \@@_map_hangul_LVT:Nnn ,
 %     \@@_map_hangul_T:Nnn
 %   }
+% \begin{macro}[EXP]{\@@_map_Regional_Indicator:Nnn}
+% \begin{macro}[EXP]{\@@_map_RI:Nnw}
+% \begin{macro}[EXP]{\@@_map_RI:NnN}
+% \begin{macro}[EXP]{\@@_map_RI:Nnn}
 % \begin{macro}[EXP]{\@@_map_output:Nn}
 % \begin{macro}[EXP]{\text_map_break:}
 % \begin{macro}[EXP]{\text_map_break:n}
@@ -313,6 +317,8 @@
 \cs_new:Npn \@@_map_not_LVT:Nnn #1#2#3
   { \@@_map_class:Nnnn #1 {#2} {#3} { T } }
 \cs_new:Npn \@@_map_not_T:Nnn #1#2#3
+  { \@@_map_class:Nnnn #1 {#2} {#3} { Regional_Indicator } }
+\cs_new:Npn \@@_map_not_Regional_Indicator:Nnn #1#2#3
   {
     \@@_map_output:Nn #1 {#2}
     \@@_map_loop:Nnw #1 {#3}
@@ -429,6 +435,45 @@
   }
 \cs_new_eq:NN \@@_map_hangul_T:Nnn \@@_map_hangul_LVT:Nnn
 %    \end{macrocode}
+%  The Regional Indicator rule means looking ahead and dealing with the
+%  case where there are two in a row. So we use a look ahead to pick them
+%  off. As there is only one range the values are hard-coded.
+%    \begin{macrocode}
+\cs_new:Npn \@@_map_Regional_Indicator:Nnn #1#2#3
+  {
+    \@@_map_output:Nn #1 {#2}
+    \@@_map_RI:Nnw #1 {#3}
+  }
+\cs_new:Npn \@@_map_RI:Nnw
+  #1#2#3 \q_@@_recursion_stop
+  {
+    \tl_if_head_is_N_type:nTF {#3}
+      { \@@_map_RI:NnN #1 {#2} }
+      { \@@_map_loop:Nnw #1 {#2} }
+    #3 \q_@@_recursion_stop
+  }
+\cs_new:Npn \@@_map_RI:NnN #1#2#3
+  {
+    \@@_if_q_recursion_tail_stop_do:Nn #3 { #1 {#2} }
+    \token_if_cs:NTF #3
+      {
+        #1 {#2}
+        \@@_map_loop:Nnw #1 { }
+      }
+      { \@@_codepoint_process:nN { \@@_map_RI:Nnn #1 {#2} } }
+        #3
+  }
+\cs_new:Npn \@@_map_RI:Nnn #1#2#3
+  {
+    \bool_lazy_or:nnTF
+      { \@@_codepoint_compare_p:nNn {#3} < { "1F1E6 } }
+      { \@@_codepoint_compare_p:nNn {#3} > { "1F1FF } }
+      {
+        \@@_map_loop:Nnw #1 {#2} #3
+      }
+      { \@@_map_loop:Nnw #1 {#2#3} }
+  }
+%    \end{macrocode}
 %   For the end of the process.
 %    \begin{macrocode}
 \cs_new:Npn \@@_map_output:Nn #1#2
@@ -466,6 +511,10 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\text_map_inline:nn}
 %   The standard non-expandable inline version.
diff --git a/l3kernel/l3text.dtx b/l3kernel/l3text.dtx
index 3cd8668bd..56d54b8f4 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -680,7 +680,7 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}[EXP, TF]{\@@_codepoint_compare:nNn}
+% \begin{macro}[EXP, pTF]{\@@_codepoint_compare:nNn}
 % \begin{macro}[EXP]{\@@_codepoint_compare:N, \@@_codepoint_compare_aux:N}
 % \begin{macro}[EXP]{\@@_codepoint_compare:NN}
 % \begin{macro}[EXP]{\@@_codepoint_compare:NNN}
@@ -693,7 +693,7 @@
   { \sys_if_engine_xetex_p: }
   {
     \prg_new_conditional:Npnn
-      \@@_codepoint_compare:nNn #1#2#3 { TF }
+      \@@_codepoint_compare:nNn #1#2#3 { TF , p }
       {
         \int_compare:nNnTF { `#1 } #2 {#3}
           \prg_return_true: \prg_return_false:
@@ -701,7 +701,7 @@
   }
   {
     \prg_new_conditional:Npnn
-      \@@_codepoint_compare:nNn #1#2#3 { TF }
+      \@@_codepoint_compare:nNn #1#2#3 { TF , p }
       {
         \int_compare:nNnTF { \@@_codepoint_compare:N #1 }
             #2 {#3}
diff --git a/l3kernel/testfiles/m3text006.luatex.tlg b/l3kernel/testfiles/m3text006.luatex.tlg
index 0024a3a07..b269efe70 100644
--- a/l3kernel/testfiles/m3text006.luatex.tlg
+++ b/l3kernel/testfiles/m3text006.luatex.tlg
@@ -116,7 +116,7 @@ TRUE
 TRUE
 TRUE
 TRUE
-  ^^f7 [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [12.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^f7 [0.3]
+TRUE
 TRUE
 TRUE
 TRUE
@@ -520,11 +520,11 @@ TRUE
 TRUE
 TRUE
 TRUE
-  ^^f7 [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [12.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^d7 [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER D (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
 TRUE
 TRUE
 TRUE
diff --git a/l3kernel/testfiles/m3text006.ptex.tlg b/l3kernel/testfiles/m3text006.ptex.tlg
index 0024a3a07..b269efe70 100644
--- a/l3kernel/testfiles/m3text006.ptex.tlg
+++ b/l3kernel/testfiles/m3text006.ptex.tlg
@@ -116,7 +116,7 @@ TRUE
 TRUE
 TRUE
 TRUE
-  ^^f7 [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [12.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^f7 [0.3]
+TRUE
 TRUE
 TRUE
 TRUE
@@ -520,11 +520,11 @@ TRUE
 TRUE
 TRUE
 TRUE
-  ^^f7 [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [12.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^d7 [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER D (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
 TRUE
 TRUE
 TRUE
diff --git a/l3kernel/testfiles/m3text006.tlg b/l3kernel/testfiles/m3text006.tlg
index ac95a15b8..ab3b55f36 100644
--- a/l3kernel/testfiles/m3text006.tlg
+++ b/l3kernel/testfiles/m3text006.tlg
@@ -116,7 +116,7 @@ TRUE
 TRUE
 TRUE
 TRUE
-  ^^c3^^b7 [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^c3^^97 [12.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^c3^^b7 [0.3]
+TRUE
 TRUE
 TRUE
 TRUE
@@ -520,11 +520,11 @@ TRUE
 TRUE
 TRUE
 TRUE
-  ^^c3^^b7 [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^c3^^97 [12.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^c3^^b7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^c3^^b7 [999.0] LATIN SMALL LETTER B (Other) ^^c3^^b7 [0.3]
-  ^^c3^^b7 [0.2] LATIN SMALL LETTER A (Other) ^^c3^^b7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^c3^^97 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^c3^^b7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^c3^^b7 [999.0] LATIN SMALL LETTER B (Other) ^^c3^^b7 [0.3]
-  ^^c3^^b7 [0.2] LATIN SMALL LETTER A (Other) ^^c3^^b7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^c3^^97 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^c3^^97 [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ^^c3^^b7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^c3^^b7 [999.0] LATIN SMALL LETTER B (Other) ^^c3^^b7 [0.3]
-  ^^c3^^b7 [0.2] LATIN SMALL LETTER A (Other) ^^c3^^b7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^c3^^97 [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ^^c3^^b7 [999.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^c3^^97 [13.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^c3^^b7 [999.0] LATIN SMALL LETTER B (Other) ^^c3^^b7 [0.3]
-  ^^c3^^b7 [0.2] LATIN SMALL LETTER A (Other) ^^c3^^b7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^c3^^97 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^c3^^b7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^c3^^97 [13.0] REGIONAL INDICATOR SYMBOL LETTER D (RI) ^^c3^^b7 [999.0] LATIN SMALL LETTER B (Other) ^^c3^^b7 [0.3]
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
 TRUE
 TRUE
 TRUE
diff --git a/l3kernel/testfiles/m3text006.xetex.tlg b/l3kernel/testfiles/m3text006.xetex.tlg
index 0024a3a07..b269efe70 100644
--- a/l3kernel/testfiles/m3text006.xetex.tlg
+++ b/l3kernel/testfiles/m3text006.xetex.tlg
@@ -116,7 +116,7 @@ TRUE
 TRUE
 TRUE
 TRUE
-  ^^f7 [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [12.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^f7 [0.3]
+TRUE
 TRUE
 TRUE
 TRUE
@@ -520,11 +520,11 @@ TRUE
 TRUE
 TRUE
 TRUE
-  ^^f7 [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [12.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^d7 [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
-  ^^f7 [0.2] LATIN SMALL LETTER A (Other) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ^^f7 [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ^^d7 [13.0] REGIONAL INDICATOR SYMBOL LETTER D (RI) ^^f7 [999.0] LATIN SMALL LETTER B (Other) ^^f7 [0.3]
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
 TRUE
 TRUE
 TRUE





More information about the latex3-commits mailing list.