[latex3-commits] [latex3/latex3] main: Retain stress diacritics when uppercasing Greek (closes #1230) (3b39f36c1)

github at latex-project.org github at latex-project.org
Tue Jun 13 00:19:05 CEST 2023


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/3b39f36c179215c50fca88af80d3fa1671119952

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

commit 3b39f36c179215c50fca88af80d3fa1671119952
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Jun 12 23:19:05 2023 +0100

     Retain stress diacritics when uppercasing Greek (closes #1230)


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

3b39f36c179215c50fca88af80d3fa1671119952
 l3kernel/CHANGELOG.md                   |  2 +-
 l3kernel/l3text-case.dtx                | 98 ++++++++++++++++++++++++++-------
 l3kernel/testfiles/m3text002.luatex.tlg |  2 +
 l3kernel/testfiles/m3text002.lvt        |  1 +
 l3kernel/testfiles/m3text002.ptex.tlg   |  2 +
 l3kernel/testfiles/m3text002.tlg        |  2 +
 l3kernel/testfiles/m3text002.uptex.tlg  |  2 +
 l3kernel/testfiles/m3text002.xetex.tlg  |  2 +
 8 files changed, 91 insertions(+), 20 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 4e18afb2e..7ca79b487 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -12,7 +12,7 @@ this project uses date-based 'snapshot' version identifiers.
   (latex3/latex2e\#904)
 - Generate _dialytika_ if appropriate when uppercasing Greek words starting with a
   vowel taking a breathing mark (issue \#1228)
-
+- Retain stress diacritics when uppercasing Greek (issue \#1230)
 ## [2023-06-05]
 
 ### Added
diff --git a/l3kernel/l3text-case.dtx b/l3kernel/l3text-case.dtx
index ab154ae51..4b48927de 100644
--- a/l3kernel/l3text-case.dtx
+++ b/l3kernel/l3text-case.dtx
@@ -989,6 +989,7 @@
 %     \@@_change_case_upper_el_ypogegrammeni:n        ,
 %     \@@_change_case_upper_el-x-iota_ypogegrammeni:n
 %   }
+% \begin{macro}[EXP]{\@@_change_case_upper_el_stress:nn}
 % \begin{macro}[EXP]{\@@_change_case_upper_el_gobble:nnw}
 % \begin{macro}[EXP]{\@@_change_case_upper_el_gobble:nnN}
 % \begin{macro}[EXP]{\@@_change_case_upper_el_gobble:nnn}
@@ -997,7 +998,8 @@
 %     \@@_change_case_if_greek:n                   ,
 %     \@@_change_case_if_greek_spacing_diacritic:n ,
 %     \@@_change_case_if_greek_accent:n            ,
-%     \@@_change_case_if_greek_diacritic:n         ,
+%     \@@_change_case_if_greek_breathing:n         ,
+%     \@@_change_case_if_greek_stress:n            ,
 %     \@@_change_case_if_takes_dialytika:n         ,
 %     \@@_change_case_if_takes_ypogegrammeni:n
 %   }
@@ -1134,7 +1136,7 @@
       {
         \bool_lazy_or:nnTF
           { \@@_change_case_if_greek_accent_p:n {#6} }
-          { \@@_change_case_if_greek_diacritic_p:n {#6} }
+          { \@@_change_case_if_greek_breathing_p:n {#6} }
           {
             \@@_change_case_upper_el_ypogegrammeni:nnnnnw
               {#1} {#2} {#3} {#4#6} {#5}
@@ -1155,7 +1157,7 @@
         \@@_change_case_if_greek_accent:nTF {#4}
           { \@@_change_case_upper_el_hiatus:nnnw {#2} {#3} {#1} }
           {
-            \@@_change_case_if_greek_diacritic:nTF {#4}
+            \@@_change_case_if_greek_breathing:nTF {#4}
               { \@@_change_case_upper_el:nnn {#1} {#2} {#3} }
               {
                 \@@_codepoint_compare:nNnTF {#4} = { "0345 }
@@ -1165,9 +1167,18 @@
                     \@@_change_case_loop:nnw {#2} {#3}
                   }
                   {
-                    \@@_change_case_store:e
-                      { \@@_change_case_codepoint:nn { upper } {#1} }
-                    \@@_change_case_loop:nnw {#2} {#3} #4
+                    \@@_change_case_if_greek_stress:nTF {#4}
+                      {
+                        \@@_change_case_store:e
+                          { \@@_change_case_upper_el_stress:nn {#1} {#4} }
+                        \@@_change_case_loop:nnw {#2} {#3}
+
+                      }
+                      {
+                        \@@_change_case_store:e
+                          { \@@_change_case_codepoint:nn { upper } {#1} }
+                        \@@_change_case_loop:nnw {#2} {#3} #4
+                      }
                   }
               }
           }
@@ -1271,6 +1282,44 @@
       { \char_value_catcode:n { "0399 } }
   }
 %    \end{macrocode}
+%   We choose to retain stress diacritics, but we also need to recombine
+%   them for pdf\TeX{}. That is handled here.
+%    \begin{macrocode}
+\cs_new:Npn \_@@_change_case_upper_el_stress:nn #1#2
+  {
+    \exp_args:Ne \@@_change_case_generate:n
+      {
+        \int_case:nn
+          { \@@_codepoint_from_chars:Nw #2 }
+          {
+            { "0304 }
+              {
+                \int_case:nn { \@@_codepoint_from_chars:Nw #1 }
+                  {
+                    { "0391 } { "1FB9 }
+                    { "03B1 } { "1FB9 }
+                    { "0399 } { "1FD9 }
+                    { "03B9 } { "1FD9 }
+                    { "03A5 } { "1FE9 }
+                    { "03C5 } { "1FE9 }
+                  }
+              }
+            { "0306 }
+              {
+                \int_case:nn { \@@_codepoint_from_chars:Nw #1 }
+                  {
+                    { "0391 } { "1FB8 }
+                    { "03B1 } { "1FB8 }
+                    { "0399 } { "1FD8 }
+                    { "03B9 } { "1FD8 }
+                    { "03A5 } { "1FE8 }
+                    { "03C5 } { "1FE8 }
+                  }
+              }
+          }
+      }
+  }
+%    \end{macrocode}
 %   For clearing out trailing combining marks after we have dealt with
 %   the first one.
 %    \begin{macrocode}
@@ -1296,7 +1345,7 @@
   {
     \bool_lazy_or:nnTF
       { \@@_change_case_if_greek_accent_p:n {#3} }
-      { \@@_change_case_if_greek_diacritic_p:n {#3} }
+      { \@@_change_case_if_greek_breathing_p:n {#3} }
       { \@@_change_case_upper_el_gobble:nnw {#1} {#2} }
       { \@@_change_case_loop:nnw {#1} {#2} #3 }
   }
@@ -1446,13 +1495,31 @@
       \fi:
     \fi:
   }
-\prg_new_conditional:Npnn \@@_change_case_if_greek_diacritic:n
+\prg_new_conditional:Npnn \@@_change_case_if_greek_breathing:n
   #1 { TF , p }
   {
-    \exp_args:Nf \@@_change_case_if_greek_diacritic:n
+    \exp_args:Nf \@@_change_case_if_greek_breathing:n
       { \int_eval:n { \@@_codepoint_from_chars:Nw #1 } }
   }
-\cs_new:Npn \@@_change_case_if_greek_diacritic:n #1
+\cs_new:Npn \@@_change_case_if_greek_breathing:n #1
+  {
+    \if_int_compare:w #1 = "0313 \exp_stop_f:
+      \prg_return_true:
+    \else:
+      \if_int_compare:w #1 = "0314 \exp_stop_f:
+        \prg_return_true:
+      \else:
+        \prg_return_false:
+      \fi:
+    \fi:
+  }
+\prg_new_conditional:Npnn \@@_change_case_if_greek_stress:n
+  #1 { TF , p }
+  {
+    \exp_args:Nf \@@_change_case_if_greek_stress:n
+      { \int_eval:n { \@@_codepoint_from_chars:Nw #1 } }
+  }
+\cs_new:Npn \@@_change_case_if_greek_stress:n #1
   {
     \if_int_compare:w #1 = "0304 \exp_stop_f:
       \prg_return_true:
@@ -1460,15 +1527,7 @@
       \if_int_compare:w #1 = "0306 \exp_stop_f:
         \prg_return_true:
       \else:
-        \if_int_compare:w #1 = "0313 \exp_stop_f:
-          \prg_return_true:
-        \else:
-          \if_int_compare:w #1 = "0314 \exp_stop_f:
-            \prg_return_true:
-          \else:
-            \prg_return_false:
-          \fi:
-        \fi:
+        \prg_return_false:
       \fi:
     \fi:
   }
@@ -1536,6 +1595,7 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 % \begin{macro}[EXP]
 %   {\@@_change_case_boundary_upper_el:Nnnw, \@@_change_case_boundary_upper_el-x-iota:Nnnw}
 % \begin{macro}[EXP]{\@@_change_case_boundary_upper_el:nnN}
diff --git a/l3kernel/testfiles/m3text002.luatex.tlg b/l3kernel/testfiles/m3text002.luatex.tlg
index 5cf750ace..bf84b1996 100644
--- a/l3kernel/testfiles/m3text002.luatex.tlg
+++ b/l3kernel/testfiles/m3text002.luatex.tlg
@@ -231,6 +231,8 @@ TEST 17: Greek
 ;
 ἈΥΠΝΊΑ
 ΑΫΠΝΙΑ
+ᾸᾹῘῙῨῩ
+ᾸᾹῘῙῨῩ
 ============================================================
 ============================================================
 TEST 18: Turkish/Azeri
diff --git a/l3kernel/testfiles/m3text002.lvt b/l3kernel/testfiles/m3text002.lvt
index 25f275d27..b932985df 100644
--- a/l3kernel/testfiles/m3text002.lvt
+++ b/l3kernel/testfiles/m3text002.lvt
@@ -225,6 +225,7 @@
     \greektest:n { ͺ ῀ ` ´ ῾ ᾽ ᾿ ῍ ῎ ῝ ῞ ῟ ῏ ῭ ΅ ῁ }      \NEWLINE
     \greektest:n { ; }                                    \NEWLINE
     \greektest:n { ἀυπνία }                               \NEWLINE
+    \greektest:n { ᾰᾱ ῐῑ ῠῡ }                             \NEWLINE
   }
 
 \TESTEXP { Turkish/Azeri }
diff --git a/l3kernel/testfiles/m3text002.ptex.tlg b/l3kernel/testfiles/m3text002.ptex.tlg
index 87cbc82f4..5ec6dc401 100644
--- a/l3kernel/testfiles/m3text002.ptex.tlg
+++ b/l3kernel/testfiles/m3text002.ptex.tlg
@@ -231,6 +231,8 @@ TEST 17: Greek
 ^^cd^^be
 ^^e1^^bc^^88υπν^^ce^^8aα
 ^^ce^^91υπν^^ce^^99α
+^^e1^^be^^b8^^e1^^be^^b9^^e1^^bf^^98^^e1^^bf^^99^^e1^^bf^^a8^^e1^^bf^^a9
+^^e1^^be^^b8^^e1^^be^^b9^^e1^^bf^^98^^e1^^bf^^99^^e1^^bf^^a8^^e1^^bf^^a9
 ============================================================
 ============================================================
 TEST 18: Turkish/Azeri
diff --git a/l3kernel/testfiles/m3text002.tlg b/l3kernel/testfiles/m3text002.tlg
index a7e2085eb..87cc6719b 100644
--- a/l3kernel/testfiles/m3text002.tlg
+++ b/l3kernel/testfiles/m3text002.tlg
@@ -231,6 +231,8 @@ TEST 17: Greek
 ^^cd^^be
 ^^e1^^bc^^88^^ce^^a5^^ce^^a0^^ce^^9d^^ce^^8a^^ce^^91
 ^^ce^^91^^ce^^ab^^ce^^a0^^ce^^9d^^ce^^99^^ce^^91
+^^e1^^be^^b8^^e1^^be^^b9^^e1^^bf^^98^^e1^^bf^^99^^e1^^bf^^a8^^e1^^bf^^a9
+^^e1^^be^^b8^^e1^^be^^b9^^e1^^bf^^98^^e1^^bf^^99^^e1^^bf^^a8^^e1^^bf^^a9
 ============================================================
 ============================================================
 TEST 18: Turkish/Azeri
diff --git a/l3kernel/testfiles/m3text002.uptex.tlg b/l3kernel/testfiles/m3text002.uptex.tlg
index 15182e2e6..9d59f0f6f 100644
--- a/l3kernel/testfiles/m3text002.uptex.tlg
+++ b/l3kernel/testfiles/m3text002.uptex.tlg
@@ -231,6 +231,8 @@ TEST 17: Greek
 ;
 ^^e1^^bc^^88^^ce^^a5^^ce^^a0^^ce^^9d^^ce^^8a^^ce^^91
 ^^ce^^91^^ce^^ab^^ce^^a0^^ce^^9d^^ce^^99^^ce^^91
+^^e1^^be^^b8^^e1^^be^^b9^^e1^^bf^^98^^e1^^bf^^99^^e1^^bf^^a8^^e1^^bf^^a9
+^^e1^^be^^b8^^e1^^be^^b9^^e1^^bf^^98^^e1^^bf^^99^^e1^^bf^^a8^^e1^^bf^^a9
 ============================================================
 ============================================================
 TEST 18: Turkish/Azeri
diff --git a/l3kernel/testfiles/m3text002.xetex.tlg b/l3kernel/testfiles/m3text002.xetex.tlg
index 5cf750ace..bf84b1996 100644
--- a/l3kernel/testfiles/m3text002.xetex.tlg
+++ b/l3kernel/testfiles/m3text002.xetex.tlg
@@ -231,6 +231,8 @@ TEST 17: Greek
 ;
 ἈΥΠΝΊΑ
 ΑΫΠΝΙΑ
+ᾸᾹῘῙῨῩ
+ᾸᾹῘῙῨῩ
 ============================================================
 ============================================================
 TEST 18: Turkish/Azeri





More information about the latex3-commits mailing list.