[latex3-commits] [latex3/latex3] gh1232-titlecase-2: Enable per-word titlecasing (56698d577)

github at latex-project.org github at latex-project.org
Sat Jul 8 17:08:19 CEST 2023


Repository : https://github.com/latex3/latex3
On branch  : gh1232-titlecase-2
Link       : https://github.com/latex3/latex3/commit/56698d5778c639c44a46f403e7dc698bd773796d

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

commit 56698d5778c639c44a46f403e7dc698bd773796d
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sat Jul 8 15:59:52 2023 +0100

    Enable per-word titlecasing
    
    This deprecates \text_titlecase:n(n) and \text_titlecase_first:n(n), and avoids any
    terms other than titlecasing.


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

56698d5778c639c44a46f403e7dc698bd773796d
 l3kernel/doc/l3obsolete.txt             |   4 ++
 l3kernel/l3deprecation.dtx              |  21 +++++++
 l3kernel/l3text-case.dtx                | 100 ++++++++++++++++++--------------
 l3kernel/l3text.dtx                     |  24 ++++----
 l3kernel/testfiles/m3text002.luatex.tlg |  58 +++++++++---------
 l3kernel/testfiles/m3text002.lvt        |  84 +++++++++++++--------------
 l3kernel/testfiles/m3text002.ptex.tlg   |  58 +++++++++---------
 l3kernel/testfiles/m3text002.tlg        |  58 +++++++++---------
 l3kernel/testfiles/m3text002.uptex.tlg  |  58 +++++++++---------
 l3kernel/testfiles/m3text002.xetex.tlg  |  58 +++++++++---------
 10 files changed, 280 insertions(+), 243 deletions(-)

diff --git a/l3kernel/doc/l3obsolete.txt b/l3kernel/doc/l3obsolete.txt
index 3efe2a869..5e24e0388 100644
--- a/l3kernel/doc/l3obsolete.txt
+++ b/l3kernel/doc/l3obsolete.txt
@@ -53,6 +53,10 @@ Function                            Date deprecated
 \seq_indexed_map_inline:Nn               2020-06-18
 \seq_indexed_map_function:NN             2020-06-18
 \sys_load_deprecation:                   2021-01-11
+\text_titlecase:n                        2023-07-08
+\text_titlecase:nn                       2023-07-08
+\text_titlecase_first:n                  2023-07-08
+\text_titlecase_first:nn                 2023-07-08
 \tl_case:cn                              2023-05-23
 \tl_case:cnF                             2023-05-23
 \tl_case:cnT                             2023-05-23
diff --git a/l3kernel/l3deprecation.dtx b/l3kernel/l3deprecation.dtx
index 66785fe4a..2fcb7c180 100644
--- a/l3kernel/l3deprecation.dtx
+++ b/l3kernel/l3deprecation.dtx
@@ -549,6 +549,27 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \subsection{Deprecated \pkg{l3text} functions}
+%
+% \begin{macro}[EXP]{\text_titlecase:n, \text_titlecase_first:n}
+% \begin{macro}[EXP]{\text_titlecase:nn, \text_titlecase_first:nn}
+%    \begin{macrocode}
+\__kernel_patch_deprecation:nnNNpn { 2023-07-08 } { \text_titlecase_once:n }
+\cs_gset:Npn \text_titlecase:n #1
+  { \text_titlecase_once:n { \text_lowercase:n {#1} } }
+\__kernel_patch_deprecation:nnNNpn { 2023-07-08 } { \text_titlecase_once:n }
+\cs_gset:Npn \text_titlecase:n #1
+  { \text_titlecase_once:n {#1} }
+\__kernel_patch_deprecation:nnNNpn { 2023-07-08 } { \text_titlecase_once:nn }
+\cs_gset:Npn \text_titlecase:nn #1#2
+  { \text_titlecase_once:nn {#1} { \text_lowercase:n {#2} } }
+\__kernel_patch_deprecation:nnNNpn { 2023-07-08 } { \text_titlecase_once:nn }
+\cs_gset:Npn \text_titlecase_first:nn #1#2
+  { \text_titlecase_once:nn {#1} {#2} }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 % \subsection{Deprecated \pkg{l3tl} functions}
 %
 %    \begin{macrocode}
diff --git a/l3kernel/l3text-case.dtx b/l3kernel/l3text-case.dtx
index d7f834781..c1ad855e9 100644
--- a/l3kernel/l3text-case.dtx
+++ b/l3kernel/l3text-case.dtx
@@ -77,16 +77,17 @@
 %   {
 %     \text_lowercase:n,
 %     \text_uppercase:n,
-%     \text_titlecase:n,
-%     \text_titlecase_first:n
+%     \text_titlecase_all:n,
+%     \text_titlecase_once:n
 %   }
 % \begin{macro}[EXP]
 %   {
 %     \text_lowercase:nn,
 %     \text_uppercase:nn,
-%     \text_titlecase:nn,
-%     \text_titlecase_first:nn
+%     \text_titlecase_all:nn,
+%     \text_titlecase_once:nn
 %   }
+% \begin{macro}[EXP]{\@@_change_case:nnn}
 %   The user level functions here are all wrappers around the internal
 %   functions for case changing.
 %    \begin{macrocode}
@@ -94,31 +95,34 @@
   { \@@_change_case:nnn { lower } { } {#1} }
 \cs_new:Npn \text_uppercase:n #1
   { \@@_change_case:nnn { upper } { } {#1} }
-\cs_new:Npn \text_titlecase:n #1
-  { \@@_change_case:nnn { title } { } {#1} }
-\cs_new:Npn \text_titlecase_first:n #1
+\cs_new:Npn \text_titlecase_all:n #1
   { \@@_change_case:nnn { title } { } {#1} }
+\cs_new:Npn \text_titlecase_once:n #1
+  { \@@_change_case:nnnn { title } { break } { } {#1} }
 \cs_new:Npn \text_lowercase:nn #1#2
   { \@@_change_case:nnn { lower } {#1} {#2} }
 \cs_new:Npn \text_uppercase:nn #1#2
   { \@@_change_case:nnn { upper } {#1} {#2} }
-\cs_new:Npn \text_titlecase:nn #1#2
-  { \@@_change_case:nnn { title } {#1} {#2} }
-\cs_new:Npn \text_titlecase_first:nn #1#2
+\cs_new:Npn \text_titlecase_all:nn #1#2
   { \@@_change_case:nnn { title } {#1} {#2} }
+\cs_new:Npn \text_titlecase_once:nn #1#2
+  { \@@_change_case:nnnn { title } { break } {#1} {#2} }
+\cs_new:Npn \@@_change_case:nnn #1#2#3
+  { \@@_change_case:nnnn {#1} {#1} {#2} {#3} }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}[EXP]
 %   {
-%     \@@_change_case:nnn      ,
-%     \@@_change_case_auxi:nnn ,
-%     \@@_change_case_auxii:nnn
+%     \@@_change_case:nnnn       ,
+%     \@@_change_case_auxi:nnnn  ,
+%     \@@_change_case_auxii:nnnn
 %   }
-% \begin{macro}[EXP]{\@@_change_case_BCP:nnn}
-% \begin{macro}[EXP]{\@@_change_case_BCP:nnw}
+% \begin{macro}[EXP]{\@@_change_case_BCP:nnnn}
 % \begin{macro}[EXP]{\@@_change_case_BCP:nnnnw}
+% \begin{macro}[EXP]{\@@_change_case_BCP:nnnnnw}
 % \begin{macro}[EXP]
 %   {
 %     \@@_change_case_store:n, \@@_change_case_store:o,
@@ -136,7 +140,8 @@
 %     \@@_change_case_group_upper:nnnn ,
 %     \@@_change_case_group_title:nnnn
 %   }
-% \begin{macro}[EXP]{\@@_change_case_space:nnnw}
+% \begin{macro}[EXP]
+%   {\@@_change_case_space:nnnw, \@@_change_case_space_break:nnnw}
 % \begin{macro}[EXP]
 %   {\@@_change_case_N_type:nnnN, \@@_change_case_N_type_aux:nnnN}
 % \begin{macro}[EXP]{\@@_change_case_N_type:nnnnN}
@@ -227,45 +232,48 @@
 %   wrap the entire result in exactly one \cs{exp_not:n}, or rather in the
 %   kernel version.
 %    \begin{macrocode}
-\cs_new:Npn \@@_change_case:nnn #1#2#3
+\cs_new:Npn \@@_change_case:nnnn #1#2#3#4
   {
      \__kernel_exp_not:w \exp_after:wN
       {
         \exp:w
-        \exp_args:Ne \@@_change_case_auxi:nnn
-          { \text_expand:n {#3} }
-          {#1} {#2}
+        \exp_args:Ne \@@_change_case_auxi:nnnn
+          { \text_expand:n {#4} }
+          {#1} {#2} {#3}
       }
   }
-\cs_new:Npn \@@_change_case_auxi:nnn #1#2#3
-  { \exp_args:No \@@_change_case_BCP:nnn { \tl_to_str:n {#3} } {#1} {#2} }
-\cs_new:Npx \@@_change_case_BCP:nnn #1#2#3
+\cs_new:Npn \@@_change_case_auxi:nnnn #1#2#3#4
   {
-    \exp_not:N \@@_change_case_BCP:nnw
-      {#2} {#3} #1 \tl_to_str:n { -x- -x- } \exp_not:N \q_@@_stop
+    \exp_args:No \@@_change_case_BCP:nnnn
+      { \tl_to_str:n {#4} } {#1} {#2} {#3}
+  }
+\cs_new:Npx \@@_change_case_BCP:nnnn #1#2#3#4
+  {
+    \exp_not:N \@@_change_case_BCP:nnnw
+      {#2} {#3} {#4} #1 \tl_to_str:n { -x- -x- } \exp_not:N \q_@@_stop
   }
 \use:x
   {
-    \cs_new:Npn \exp_not:N \@@_change_case_BCP:nnw
-      ##1##2##3 \tl_to_str:n { -x- } ##4 \tl_to_str:n { -x- } ##5
+    \cs_new:Npn \exp_not:N \@@_change_case_BCP:nnnw
+      ##1##2##3##4 \tl_to_str:n { -x- } ##5 \tl_to_str:n { -x- } ##6
       \exp_not:N \q_@@_stop
   }
-  { \@@_change_case_BCP:nnnnw {#1} {#2} {#4} {#3} #3 - - \q_@@_stop }
-\cs_new:Npn \@@_change_case_BCP:nnnnw #1#2#3#4#5 - #6 - #7 \q_@@_stop
+  { \@@_change_case_BCP:nnnnnnw {#1} {#2} {#3} {#5} {#4} #4 - \q_@@_stop }
+\cs_new:Npn \@@_change_case_BCP:nnnnnnw #1#2#3#4#5#6 - #7 \q_@@_stop
   {
-    \cs_if_exist:cTF { @@_change_case_ #2 _ #5 -x- #3 :nnnnn }
-      { \@@_change_case_auxii:nnn {#1} {#2} { #5 -x- #3 } }
+    \cs_if_exist:cTF { @@_change_case_ #2 _ #6 -x- #4 :nnnnn }
+      { \@@_change_case_auxii:nnnn {#1} {#2} {#3} { #6 -x- #4 } }
       {
-        \cs_if_exist:cTF { @@_change_case_ #2 _ #5 :nnnnn }
-          { \@@_change_case_auxii:nnn {#1} {#2} {#5} }
-          { \@@_change_case_auxii:nnn {#1} {#2} {#4} }
+        \cs_if_exist:cTF { @@_change_case_ #2 _ #6 :nnnnn }
+          { \@@_change_case_auxii:nnnn {#1} {#2} {#3} {#6} }
+          { \@@_change_case_auxii:nnnn {#1} {#2} {#3} {#5} }
       }
   }
-\cs_new:Npn \@@_change_case_auxii:nnn #1#2#3
+\cs_new:Npn \@@_change_case_auxii:nnnn #1#2#3#4
   {
     \group_align_safe_begin:
-    \cs_if_exist_use:c { @@_change_case_boundary_ #2 _ #3 :Nnnnw }
-    \@@_change_case_loop:nnnw {#2} {#2} {#3} #1
+    \cs_if_exist_use:c { @@_change_case_boundary_ #2 _ #4 :Nnnnw }
+    \@@_change_case_loop:nnnw {#2} {#3} {#4} #1
       \q_@@_recursion_tail \q_@@_recursion_stop
     \@@_change_case_result:n { }
   }
@@ -318,7 +326,7 @@
         \exp_after:wN
           {
             \exp:w
-            \@@_change_case_auxii:nnn {#4} {#1} {#3}
+            \@@_change_case_auxii:nnnn {#4} {#1} {#2} {#3}
           }
       }
     \@@_change_case_loop:nnnw {#1} {#2} {#3}
@@ -332,10 +340,10 @@
         \exp_after:wN
           {
             \exp:w
-            \@@_change_case_auxii:nnn {#4} {#1} {#3}
+            \@@_change_case_auxii:nnnn {#4} {#1} {#2} {#3}
           }
       }
-    \@@_change_case_break:w
+    \@@_change_case_skip:nnw {#2} {#3}
   }
 \use:x
   {
@@ -343,9 +351,15 @@
   }
   {
     \@@_change_case_store:n { ~ }
-    \cs_if_exist_use:c { @@_change_case_boundary_ #1 _ #3 :Nnnnw }
-    \@@_change_case_loop:nnnw {#2} {#2} {#3}
+    \cs_if_exist_use:cF { @@_change_case_space_ #2 :nnn }
+      {
+        \cs_if_exist_use:c { @@_change_case_boundary_ #1 _ #3 :Nnnnw }
+        \@@_change_case_loop:nnnw
+      }
+        {#2} {#2} {#3}
   }
+\cs_new:Npn \@@_change_case_space_break:nnn #1#2#3
+  { \@@_change_case_break:w }
 %    \end{macrocode}
 %   The first step of handling \texttt{N}-type tokens is to filter out the
 %   end-of-loop. That has to be done separately from the first real step
@@ -476,7 +490,7 @@
         \@@_change_case_store:o
           {
             \exp_after:wN #4
-              \exp:w \@@_change_case_auxii:nnn {#5} {#1} {#2}
+              \exp:w \@@_change_case_auxii:nnnn {#5} {#1} {#2} {#3}
               {#6}
           }
       }
diff --git a/l3kernel/l3text.dtx b/l3kernel/l3text.dtx
index eb97fca1f..a4d42378e 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -94,12 +94,12 @@
 %
 % \section{Case changing}
 %
-% \begin{function}[EXP, added = 2019-11-20, updated = 2022-10-13]
+% \begin{function}[EXP, added = 2019-11-20, updated = 2023-07-08]
 %   {
-%     \text_lowercase:n,  \text_uppercase:n,  \text_titlecase:n,
-%       \text_titlecase_first:n,
-%     \text_lowercase:nn, \text_uppercase:nn, \text_titlecase:nn,
-%       \text_titlecase_first:nn
+%     \text_lowercase:n,  \text_uppercase:n,  \text_titlecase_all:n,
+%       \text_titlecase_once:n,
+%     \text_lowercase:nn, \text_uppercase:nn, \text_titlecase_all:nn,
+%       \text_titlecase_once:nn
 %   }
 %   \begin{syntax}
 %     \cs{text_uppercase:n}  \Arg{tokens}
@@ -115,11 +115,13 @@
 %
 %   Upper- and lowercase have the obvious meanings. Titlecasing may be regarded
 %   informally as converting the first character of the \meta{tokens} to
-%   uppercase and the rest to lowercase. However, the process is more complex
+%   uppercase. However, the process is more complex
 %   than this as there are some situations where a single lowercase character
 %   maps to a special form, for example \texttt{ij} in Dutch which becomes
-%   \texttt{IJ}. The \texttt{titlecase_first} variant does not attempt
-%   any case changing at all after the first letter has been processed.
+%   \texttt{IJ}. There are two functions available for titlecasing: one which
+%   applies the change to each \enquote{word} and a second which only applies
+%   at the start of the input. (Here, \enquote{word} boundaries are spaces:
+%   at present full Unicode word breaking is not attempted.)
 %
 %   Importantly, notice that these functions are intended for working with
 %   user \emph{text for typesetting}. For case changing programmatic data see
@@ -190,11 +192,7 @@
 %       available using \pdfTeX{}.
 %   \end{itemize}
 %
-%  For titlecasing, note that there are two functions available. The
-%  function \cs{text_titlecase:n} applies (broadly) uppercasing to the first
-%  letter of the input, then lowercasing to the remainder. In contrast,
-%  \cs{text_titlecase_first:n} \emph{only} carries out the uppercasing operation,
-%  and leaves the balance of the input unchanged. Determining whether
+%  Determining whether
 %  non-letter characters at the start of text should switch from upper- to
 %  lowercasing is controllable. When \cs{l_text_titlecase_check_letter_bool} is
 %  \texttt{true}, characters which are not letters (category code~$11$) are
diff --git a/l3kernel/testfiles/m3text002.luatex.tlg b/l3kernel/testfiles/m3text002.luatex.tlg
index 629e69d9f..82cced878 100644
--- a/l3kernel/testfiles/m3text002.luatex.tlg
+++ b/l3kernel/testfiles/m3text002.luatex.tlg
@@ -7,14 +7,14 @@ TEST 1: Basic case changing
 hello world \par with \ERROR &##
 HELLO WORLD \par WITH \ERROR &##
 Hello World \par With \ERROR &##
-Hello World \par With \ERROR &##
+Hello world \par with \ERROR &##
 ============================================================
 ============================================================
 TEST 2: Case changes in braces
 ============================================================
 {hello} world \par with \ERROR &##
 {HELLO} WORLD \par WITH \ERROR &##
-{Hello} world \par with \ERROR &##
+{Hello} World \par With \ERROR &##
 {Hello} world \par with \ERROR &##
 ============================================================
 ============================================================
@@ -23,45 +23,45 @@ TEST 3: Case change exclusions
 some text \cite {WithFun}
 SOME TEXT \cite {WithFun}
 Some Text \cite {WithFun}
-Some Text \cite {WithFun}
+Some text \cite {WithFun}
 ============================================================
 ============================================================
 TEST 4: Titlecase basics
 ============================================================
 Hello World
-Hello World
+Hello world
 HELLO WORLD
 HELLO WORLD
 " Hello World"
-" Hello World"
+" hello world"
 " HELLO WORLD"
 " HELLO WORLD"
-{H}ello world
+{H}ello World
 {H}ello world
 {H}ELLO WORLD
 {H}ELLO WORLD
+{}hello World
 {}hello world
-{}hello world
-{}hello world
+{}hello World
 {}hello world
 ============================================================
 ============================================================
 TEST 5: Titlecase skipping chars
 ============================================================
 `Hic Sunt Leones'
-`Hic Sunt Leones'
-``Hic Sunt Leones''
+`Hic sunt leones'
 ``Hic Sunt Leones''
+``Hic sunt leones''
 ([Hic Sunt Leones])
-([Hic Sunt Leones])
+([Hic sunt leones])
 ============================================================
 ============================================================
 TEST 6: Titlecase first
 ============================================================
 `Hic SUNT Leones'
-`Hic SUNT Leones'
-`HIC SUNT Leones'
+`Hic SUNT leones'
 `HIC SUNT Leones'
+`HIC SUNT leones'
 E PLURIBUS UNUM
 E PLURIBUS UNUM
 ============================================================
@@ -69,9 +69,9 @@ E PLURIBUS UNUM
 TEST 7: Titlecase control
 ============================================================
 `hic SUNT Leones'
-`hic SUNT Leones'
-`HIC SUNT Leones'
+`hic SUNT leones'
 `HIC SUNT Leones'
+`HIC SUNT leones'
 E PLURIBUS UNUM
 E PLURIBUS UNUM
 ============================================================
@@ -81,11 +81,11 @@ TEST 8: Language based case changing but nothing
 no problems
 NO PROBLEMS
 No Problems
-No Problems
+No problems
 no problems
 NO PROBLEMS
 No Problems
-No Problems
+No problems
 ============================================================
 ============================================================
 TEST 9: (u)pTeX-based tests
@@ -133,7 +133,7 @@ TEST 13: Cyrillic
 доклады академии наук
 ДОКЛАДЫ АКАДЕМИИ НАУК
 Доклады Академии Наук
-Доклады Академии Наук
+Доклады Академии наук
 ============================================================
 ============================================================
 TEST 14: BCP47 parts
@@ -300,7 +300,7 @@ FOO \emph {BAR} {BAZ}
 \emph {BAR} {baz}
 \emph {BAR} {BAZ}
 \emph {BAR} {BAZ}
-\emph {BAR} {BAZ}
+\emph {BAR} BAZ
 ============================================================
 ============================================================
 TEST 24: Expanding content
@@ -308,27 +308,27 @@ TEST 24: Expanding content
 some text hello
 SOME TEXT HELLO
 Some Text Hello
-Some Text Hello
+Some text Hello
 hello sometext
 HELLO SOMETEXT
 Hello Sometext
-Hello Sometext
+Hello sometext
 some text hello
 SOME TEXT HELLO
 Some Text Hello
-Some Text Hello
+Some text Hello
 hello sometext
 HELLO SOMETEXT
 Hello Sometext
-Hello Sometext
+Hello sometext
 some text \cs_tmp:w 
 SOME TEXT \cs_tmp:w 
 Some Text \cs_tmp:w 
-Some Text \cs_tmp:w 
+Some text \cs_tmp:w 
 \cs_tmp:w  sometext
 \cs_tmp:w  SOMETEXT
 \cs_tmp:w  Sometext
-\cs_tmp:w  Sometext
+\cs_tmp:w  sometext
 ============================================================
 ============================================================
 TEST 25: Math-mode escape
@@ -336,15 +336,15 @@ TEST 25: Math-mode escape
 some text $y = mx + c$
 SOME TEXT $y = mx + c$
 Some Text $y = mx + c$
-Some Text $y = mx + c$
+Some text $y = mx + c$
 $y = mx + c$ text
 $y = mx + c$ TEXT
 $y = mx + c$ Text
-$y = mx + c$ Text
+$y = mx + c$ text
 opps not close token in $y = mx + c
 OPPS NOT CLOSE TOKEN IN $y = mx + c
 Opps Not Close Token In $y = mx + c
-Opps Not Close Token In $y = mx + c
+Opps not close token in $y = mx + c
 ============================================================
 ============================================================
 TEST 26: Nesting
@@ -399,7 +399,7 @@ Title
 WORDS lower
 words UPPER
 Words Title
-Words Title
+Words \text_case_switch:nnnn {normal}{lower}{UPPER}{Title}
 ============================================================
 ============================================================
 TEST 32: Case change replacements
diff --git a/l3kernel/testfiles/m3text002.lvt b/l3kernel/testfiles/m3text002.lvt
index 3e6bf50c7..37ecd33f0 100644
--- a/l3kernel/testfiles/m3text002.lvt
+++ b/l3kernel/testfiles/m3text002.lvt
@@ -18,9 +18,9 @@
       \NEWLINE
       \text_uppercase:n {#1}
       \NEWLINE
-      \text_titlecase:n {#1}
+      \text_titlecase_all:n {#1}
       \NEWLINE
-      \text_titlecase_first:n {#1}
+      \text_titlecase_once:n {#1}
     }
   \cs_set:Npn \test:nn #1#2
     {
@@ -28,9 +28,9 @@
       \NEWLINE
       \text_uppercase:nn {#1} {#2}
       \NEWLINE
-      \text_titlecase:nn {#1} {#2}
+      \text_titlecase_all:nn {#1} {#2}
       \NEWLINE
-      \text_titlecase_first:nn {#1} {#2}
+      \text_titlecase_once:nn {#1} {#2}
     }
 \TIMO
 
@@ -52,9 +52,9 @@
 \OMIT
   \cs_set:Npn \testii:n #1
     {
-      \text_titlecase:n {#1}
+      \text_titlecase_all:n {#1}
       \NEWLINE
-      \text_titlecase_first:n {#1}
+      \text_titlecase_once:n {#1}
     }
 \TIMO
 
@@ -64,13 +64,13 @@
     \NEWLINE
     \testii:n { HELLO~WORLD }
     \NEWLINE
-    "\text_titlecase:n { ~hello~world }"
+    "\text_titlecase_all:n { ~hello~world }"
     \NEWLINE
-    "\text_titlecase_first:n { ~hello~world }"
+    "\text_titlecase_once:n { ~hello~world }"
     \NEWLINE
-    "\text_titlecase:n { ~HELLO~WORLD }"
+    "\text_titlecase_all:n { ~HELLO~WORLD }"
     \NEWLINE
-    "\text_titlecase_first:n { ~HELLO~WORLD }"
+    "\text_titlecase_once:n { ~HELLO~WORLD }"
     \NEWLINE
     \testii:n { {h}ello~world }
     \NEWLINE
@@ -155,12 +155,12 @@
 
 \TESTEXP { Armenian }
   {
-    \text_uppercase:n                { Երևան } \NEWLINE
-    \text_uppercase:nn { hy }        { Երևան } \NEWLINE
-    \text_uppercase:nn { hy-x-yiwn } { Երևան } \NEWLINE
-    \text_titlecase:n                { Երևան } \NEWLINE
-    \text_titlecase:nn { hy }        { ևան } \NEWLINE
-    \text_titlecase:nn { hy-x-yiwn } { ևան }
+    \text_uppercase:n                    { Երևան } \NEWLINE
+    \text_uppercase:nn { hy }            { Երևան } \NEWLINE
+    \text_uppercase:nn { hy-x-yiwn }     { Երևան } \NEWLINE
+    \text_titlecase_all:n                { Երևան } \NEWLINE
+    \text_titlecase_all:nn { hy }        { ևան } \NEWLINE
+    \text_titlecase_all:nn { hy-x-yiwn } { ևան }
   }
 
 \TESTEXP { German-alternative }
@@ -202,8 +202,8 @@
     \greektest:n { Μαΐου,~τρόλεϊ }                        \NEWLINE
     \greektest:n { Το~ένα~ή~το~άλλο. }                    \NEWLINE
     \greektest:n { ρωμέικα }                              \NEWLINE
-    \text_titlecase:n         { ὈΔΥΣΣΕΎΣ } \NEWLINE
-    \text_titlecase:nn { el } { ὈΔΥΣΣΕΎΣ } \NEWLINE
+    \text_titlecase_all:n         { ὈΔΥΣΣΕΎΣ } \NEWLINE
+    \text_titlecase_all:nn { el } { ὈΔΥΣΣΕΎΣ } \NEWLINE
     % Taken from luaotfload tests
     \greektest:n { ῄ }                                    \NEWLINE
     \text_uppercase:nn { el-x-iota } { ῄ }                \NEWLINE
@@ -237,11 +237,11 @@
     \text_uppercase:nn { tr } { Ragıp~Hulûsi~Özdem } \NEWLINE
     \text_uppercase:n         { Ragıp~Hulûsi~Özdem }
     \NEWLINE
-    \text_titlecase:nn { tr } { Ragıp~Hulûsi~Özdem } \NEWLINE
-    \text_titlecase:n         { Ragıp~Hulûsi~Özdem }
+    \text_titlecase_all:nn { tr } { Ragıp~Hulûsi~Özdem } \NEWLINE
+    \text_titlecase_all:n         { Ragıp~Hulûsi~Özdem }
     \NEWLINE
-    \text_titlecase:nn { tr } { ıp~Hulûsi~Özdem } \NEWLINE
-    \text_titlecase:n         { ıp~Hulûsi~Özdem }
+    \text_titlecase_all:nn { tr } { ıp~Hulûsi~Özdem } \NEWLINE
+    \text_titlecase_all:n         { ıp~Hulûsi~Özdem }
   }
 
 \TESTEXP { Lithuanian }
@@ -252,10 +252,10 @@
     \text_uppercase:nn { lt } { i̇̀i̇̀i̇̃i̇̀i̇́i̇̃j̇̀j̇́j̇̃į̇̀į̇́į̇̃ } \NEWLINE
     \text_uppercase:n         { i̇̀i̇̀i̇̃i̇̀i̇́i̇̃j̇̀j̇́j̇̃į̇̀į̇́į̇̃ }
     \NEWLINE
-    \text_titlecase:nn { lt } { ÌÍĨÌÍĨJ̀J́J̃Į̀Į́Į̃ } \NEWLINE
-    \text_titlecase:nn { lt } { i̇̀i̇̀i̇̃i̇̀i̇́i̇̃j̇̀j̇́j̇̃į̇̀į̇́į̇̃ } \NEWLINE
-    \text_titlecase:n         { ÌÍĨÌÍĨJ̀J́J̃Į̀Į́Į̃ } \NEWLINE
-    \text_titlecase:n         { i̇̀i̇̀i̇̃i̇̀i̇́i̇̃j̇̀j̇́j̇̃į̇̀į̇́į̇̃ }
+    \text_titlecase_all:nn { lt } { ÌÍĨÌÍĨJ̀J́J̃Į̀Į́Į̃ } \NEWLINE
+    \text_titlecase_all:nn { lt } { i̇̀i̇̀i̇̃i̇̀i̇́i̇̃j̇̀j̇́j̇̃į̇̀į̇́į̇̃ } \NEWLINE
+    \text_titlecase_all:n         { ÌÍĨÌÍĨJ̀J́J̃Į̀Į́Į̃ } \NEWLINE
+    \text_titlecase_all:n         { i̇̀i̇̀i̇̃i̇̀i̇́i̇̃j̇̀j̇́j̇̃į̇̀į̇́į̇̃ }
   }
 
 \TESTEXP { Medieval~Latin }
@@ -275,24 +275,24 @@
     \text_uppercase:nn { nl } { ijsselmeer } \NEWLINE
     \text_uppercase:n         { ijsselmeer }
     \NEWLINE
-    \text_titlecase:nn { nl } { ijsselmeer } \NEWLINE
-    \text_titlecase:n         { ijsselmeer }
+    \text_titlecase_all:nn { nl } { ijsselmeer } \NEWLINE
+    \text_titlecase_all:n         { ijsselmeer }
     \NEWLINE
-    \text_titlecase:nn { nl } { Ijsselmeer } \NEWLINE
-    \text_titlecase:n         { Ijsselmeer }
+    \text_titlecase_all:nn { nl } { Ijsselmeer } \NEWLINE
+    \text_titlecase_all:n         { Ijsselmeer }
     \NEWLINE
-    \text_titlecase:nn { nl } { IJsselmeer } \NEWLINE
-    \text_titlecase:n         { IJsselmeer }
+    \text_titlecase_all:nn { nl } { IJsselmeer } \NEWLINE
+    \text_titlecase_all:n         { IJsselmeer }
     \NEWLINE
-    \text_titlecase:nn { nl } { im } \NEWLINE
-    \text_titlecase:n         { im }
+    \text_titlecase_all:nn { nl } { im } \NEWLINE
+    \text_titlecase_all:n         { im }
   }
 
 \TESTEXP { Titlecase~exceptions }
   {
-    \text_titlecase:n { ßoo }
+    \text_titlecase_all:n { ßoo }
     \NEWLINE
-    \text_titlecase:n { Dž! }
+    \text_titlecase_all:n { Dž! }
     \NEWLINE
   }
 
@@ -388,8 +388,8 @@
   {
     \text_uppercase:n {#1} \NEWLINE
     \text_lowercase:n {#1} \NEWLINE
-    \text_titlecase:n {#1} \NEWLINE
-    \text_titlecase_first:n {#1} \NEWLINE
+    \text_titlecase_all:n {#1} \NEWLINE
+    \text_titlecase_once:n {#1} \NEWLINE
   }
 
 \TESTEXP { Case~change~switching }
@@ -417,12 +417,12 @@
       {
         \text_lowercase:n { ǰ }
         \text_uppercase:n { ǰ }
-        \text_titlecase:n { ǰ }
-        \text_titlecase:n { xǰ }
+        \text_titlecase_all:n { ǰ }
+        \text_titlecase_all:n { xǰ }
         \text_lowercase:nn { xx } { ǰ }
         \text_uppercase:nn { xx } { ǰ }
-        \text_titlecase:nn { xx } { ǰ }
-        \text_titlecase:nn { xx } { xǰ }
+        \text_titlecase_all:nn { xx } { ǰ }
+        \text_titlecase_all:nn { xx } { xǰ }
       }
   }
 
diff --git a/l3kernel/testfiles/m3text002.ptex.tlg b/l3kernel/testfiles/m3text002.ptex.tlg
index c2be163c5..29338ebab 100644
--- a/l3kernel/testfiles/m3text002.ptex.tlg
+++ b/l3kernel/testfiles/m3text002.ptex.tlg
@@ -7,14 +7,14 @@ TEST 1: Basic case changing
 hello world \par with \ERROR &##
 HELLO WORLD \par WITH \ERROR &##
 Hello World \par With \ERROR &##
-Hello World \par With \ERROR &##
+Hello world \par with \ERROR &##
 ============================================================
 ============================================================
 TEST 2: Case changes in braces
 ============================================================
 {hello} world \par with \ERROR &##
 {HELLO} WORLD \par WITH \ERROR &##
-{Hello} world \par with \ERROR &##
+{Hello} World \par With \ERROR &##
 {Hello} world \par with \ERROR &##
 ============================================================
 ============================================================
@@ -23,45 +23,45 @@ TEST 3: Case change exclusions
 some text \cite {WithFun}
 SOME TEXT \cite {WithFun}
 Some Text \cite {WithFun}
-Some Text \cite {WithFun}
+Some text \cite {WithFun}
 ============================================================
 ============================================================
 TEST 4: Titlecase basics
 ============================================================
 Hello World
-Hello World
+Hello world
 HELLO WORLD
 HELLO WORLD
 " Hello World"
-" Hello World"
+" hello world"
 " HELLO WORLD"
 " HELLO WORLD"
-{H}ello world
+{H}ello World
 {H}ello world
 {H}ELLO WORLD
 {H}ELLO WORLD
+{}hello World
 {}hello world
-{}hello world
-{}hello world
+{}hello World
 {}hello world
 ============================================================
 ============================================================
 TEST 5: Titlecase skipping chars
 ============================================================
 `Hic Sunt Leones'
-`Hic Sunt Leones'
-``Hic Sunt Leones''
+`Hic sunt leones'
 ``Hic Sunt Leones''
+``Hic sunt leones''
 ([Hic Sunt Leones])
-([Hic Sunt Leones])
+([Hic sunt leones])
 ============================================================
 ============================================================
 TEST 6: Titlecase first
 ============================================================
 `Hic SUNT Leones'
-`Hic SUNT Leones'
-`HIC SUNT Leones'
+`Hic SUNT leones'
 `HIC SUNT Leones'
+`HIC SUNT leones'
 E PLURIBUS UNUM
 E PLURIBUS UNUM
 ============================================================
@@ -69,9 +69,9 @@ E PLURIBUS UNUM
 TEST 7: Titlecase control
 ============================================================
 `hic SUNT Leones'
-`hic SUNT Leones'
-`HIC SUNT Leones'
+`hic SUNT leones'
 `HIC SUNT Leones'
+`HIC SUNT leones'
 E PLURIBUS UNUM
 E PLURIBUS UNUM
 ============================================================
@@ -81,11 +81,11 @@ TEST 8: Language based case changing but nothing
 no problems
 NO PROBLEMS
 No Problems
-No Problems
+No problems
 no problems
 NO PROBLEMS
 No Problems
-No Problems
+No problems
 ============================================================
 ============================================================
 TEST 9: (u)pTeX-based tests
@@ -133,7 +133,7 @@ TEST 13: Cyrillic
 Доклады Акад^^ea^^9f^^97мии наук
 ^^ea^^9e^^a4окл^^ea^^9f^^90ды ^^ea^^9e^^a0к^^ea^^9f^^90демии н^^ea^^9f^^90ук
 ^^ea^^9e^^a4окл^^ea^^9f^^90ды ^^ea^^9e^^a0к^^ea^^9f^^90демии н^^ea^^9f^^90ук
-^^ea^^9e^^a4окл^^ea^^9f^^90ды ^^ea^^9e^^a0к^^ea^^9f^^90демии н^^ea^^9f^^90ук
+^^ea^^9e^^a4окл^^ea^^9f^^90ды Академии наук
 ============================================================
 ============================================================
 TEST 14: BCP47 parts
@@ -300,7 +300,7 @@ FOO \emph {BAR} {BAZ}
 \emph {BAR} {baz}
 \emph {BAR} {BAZ}
 \emph {BAR} {BAZ}
-\emph {BAR} {BAZ}
+\emph {BAR} BAZ
 ============================================================
 ============================================================
 TEST 24: Expanding content
@@ -308,27 +308,27 @@ TEST 24: Expanding content
 some text hello
 SOME TEXT HELLO
 Some Text Hello
-Some Text Hello
+Some text Hello
 hello sometext
 HELLO SOMETEXT
 Hello Sometext
-Hello Sometext
+Hello sometext
 some text hello
 SOME TEXT HELLO
 Some Text Hello
-Some Text Hello
+Some text Hello
 hello sometext
 HELLO SOMETEXT
 Hello Sometext
-Hello Sometext
+Hello sometext
 some text \cs_tmp:w 
 SOME TEXT \cs_tmp:w 
 Some Text \cs_tmp:w 
-Some Text \cs_tmp:w 
+Some text \cs_tmp:w 
 \cs_tmp:w  sometext
 \cs_tmp:w  SOMETEXT
 \cs_tmp:w  Sometext
-\cs_tmp:w  Sometext
+\cs_tmp:w  sometext
 ============================================================
 ============================================================
 TEST 25: Math-mode escape
@@ -336,15 +336,15 @@ TEST 25: Math-mode escape
 some text $y = mx + c$
 SOME TEXT $y = mx + c$
 Some Text $y = mx + c$
-Some Text $y = mx + c$
+Some text $y = mx + c$
 $y = mx + c$ text
 $y = mx + c$ TEXT
 $y = mx + c$ Text
-$y = mx + c$ Text
+$y = mx + c$ text
 opps not close token in $y = mx + c
 OPPS NOT CLOSE TOKEN IN $y = mx + c
 Opps Not Close Token In $y = mx + c
-Opps Not Close Token In $y = mx + c
+Opps not close token in $y = mx + c
 ============================================================
 ============================================================
 TEST 26: Nesting
@@ -399,7 +399,7 @@ Title
 WORDS lower
 words UPPER
 Words Title
-Words Title
+Words \text_case_switch:nnnn {normal}{lower}{UPPER}{Title}
 ============================================================
 ============================================================
 TEST 32: Case change replacements
diff --git a/l3kernel/testfiles/m3text002.tlg b/l3kernel/testfiles/m3text002.tlg
index 16d039c75..1ec2766a2 100644
--- a/l3kernel/testfiles/m3text002.tlg
+++ b/l3kernel/testfiles/m3text002.tlg
@@ -7,14 +7,14 @@ TEST 1: Basic case changing
 hello world \par with \ERROR &##
 HELLO WORLD \par WITH \ERROR &##
 Hello World \par With \ERROR &##
-Hello World \par With \ERROR &##
+Hello world \par with \ERROR &##
 ============================================================
 ============================================================
 TEST 2: Case changes in braces
 ============================================================
 {hello} world \par with \ERROR &##
 {HELLO} WORLD \par WITH \ERROR &##
-{Hello} world \par with \ERROR &##
+{Hello} World \par With \ERROR &##
 {Hello} world \par with \ERROR &##
 ============================================================
 ============================================================
@@ -23,45 +23,45 @@ TEST 3: Case change exclusions
 some text \cite {WithFun}
 SOME TEXT \cite {WithFun}
 Some Text \cite {WithFun}
-Some Text \cite {WithFun}
+Some text \cite {WithFun}
 ============================================================
 ============================================================
 TEST 4: Titlecase basics
 ============================================================
 Hello World
-Hello World
+Hello world
 HELLO WORLD
 HELLO WORLD
 " Hello World"
-" Hello World"
+" hello world"
 " HELLO WORLD"
 " HELLO WORLD"
-{H}ello world
+{H}ello World
 {H}ello world
 {H}ELLO WORLD
 {H}ELLO WORLD
+{}hello World
 {}hello world
-{}hello world
-{}hello world
+{}hello World
 {}hello world
 ============================================================
 ============================================================
 TEST 5: Titlecase skipping chars
 ============================================================
 `Hic Sunt Leones'
-`Hic Sunt Leones'
-``Hic Sunt Leones''
+`Hic sunt leones'
 ``Hic Sunt Leones''
+``Hic sunt leones''
 ([Hic Sunt Leones])
-([Hic Sunt Leones])
+([Hic sunt leones])
 ============================================================
 ============================================================
 TEST 6: Titlecase first
 ============================================================
 `Hic SUNT Leones'
-`Hic SUNT Leones'
-`HIC SUNT Leones'
+`Hic SUNT leones'
 `HIC SUNT Leones'
+`HIC SUNT leones'
 E PLURIBUS UNUM
 E PLURIBUS UNUM
 ============================================================
@@ -69,9 +69,9 @@ E PLURIBUS UNUM
 TEST 7: Titlecase control
 ============================================================
 `hic SUNT Leones'
-`hic SUNT Leones'
-`HIC SUNT Leones'
+`hic SUNT leones'
 `HIC SUNT Leones'
+`HIC SUNT leones'
 E PLURIBUS UNUM
 E PLURIBUS UNUM
 ============================================================
@@ -81,11 +81,11 @@ TEST 8: Language based case changing but nothing
 no problems
 NO PROBLEMS
 No Problems
-No Problems
+No problems
 no problems
 NO PROBLEMS
 No Problems
-No Problems
+No problems
 ============================================================
 ============================================================
 TEST 9: (u)pTeX-based tests
@@ -133,7 +133,7 @@ TEST 13: Cyrillic
 ^^d0^^b4^^d0^^be^^d0^^ba^^d0^^bb^^d0^^b0^^d0^^b4^^d1^^8b ^^d0^^b0^^d0^^ba^^d0^^b0^^d0^^b4^^d0^^b5^^d0^^bc^^d0^^b8^^d0^^b8 ^^d0^^bd^^d0^^b0^^d1^^83^^d0^^ba
 ^^d0^^94^^d0^^9e^^d0^^9a^^d0^^9b^^d0^^90^^d0^^94^^d0^^ab ^^d0^^90^^d0^^9a^^d0^^90^^d0^^94^^d0^^95^^d0^^9c^^d0^^98^^d0^^98 ^^d0^^9d^^d0^^90^^d0^^a3^^d0^^9a
 ^^d0^^94^^d0^^be^^d0^^ba^^d0^^bb^^d0^^b0^^d0^^b4^^d1^^8b ^^d0^^90^^d0^^ba^^d0^^b0^^d0^^b4^^d0^^b5^^d0^^bc^^d0^^b8^^d0^^b8 ^^d0^^9d^^d0^^b0^^d1^^83^^d0^^ba
-^^d0^^94^^d0^^be^^d0^^ba^^d0^^bb^^d0^^b0^^d0^^b4^^d1^^8b ^^d0^^90^^d0^^ba^^d0^^b0^^d0^^b4^^d0^^b5^^d0^^bc^^d0^^b8^^d0^^b8 ^^d0^^9d^^d0^^b0^^d1^^83^^d0^^ba
+^^d0^^94^^d0^^be^^d0^^ba^^d0^^bb^^d0^^b0^^d0^^b4^^d1^^8b ^^d0^^90^^d0^^ba^^d0^^b0^^d0^^b4^^d0^^b5^^d0^^bc^^d0^^b8^^d0^^b8 ^^d0^^bd^^d0^^b0^^d1^^83^^d0^^ba
 ============================================================
 ============================================================
 TEST 14: BCP47 parts
@@ -300,7 +300,7 @@ FOO \emph {BAR} {BAZ}
 \emph {BAR} {baz}
 \emph {BAR} {BAZ}
 \emph {BAR} {BAZ}
-\emph {BAR} {BAZ}
+\emph {BAR} BAZ
 ============================================================
 ============================================================
 TEST 24: Expanding content
@@ -308,27 +308,27 @@ TEST 24: Expanding content
 some text hello
 SOME TEXT HELLO
 Some Text Hello
-Some Text Hello
+Some text Hello
 hello sometext
 HELLO SOMETEXT
 Hello Sometext
-Hello Sometext
+Hello sometext
 some text hello
 SOME TEXT HELLO
 Some Text Hello
-Some Text Hello
+Some text Hello
 hello sometext
 HELLO SOMETEXT
 Hello Sometext
-Hello Sometext
+Hello sometext
 some text \cs_tmp:w 
 SOME TEXT \cs_tmp:w 
 Some Text \cs_tmp:w 
-Some Text \cs_tmp:w 
+Some text \cs_tmp:w 
 \cs_tmp:w  sometext
 \cs_tmp:w  SOMETEXT
 \cs_tmp:w  Sometext
-\cs_tmp:w  Sometext
+\cs_tmp:w  sometext
 ============================================================
 ============================================================
 TEST 25: Math-mode escape
@@ -336,15 +336,15 @@ TEST 25: Math-mode escape
 some text $y = mx + c$
 SOME TEXT $y = mx + c$
 Some Text $y = mx + c$
-Some Text $y = mx + c$
+Some text $y = mx + c$
 $y = mx + c$ text
 $y = mx + c$ TEXT
 $y = mx + c$ Text
-$y = mx + c$ Text
+$y = mx + c$ text
 opps not close token in $y = mx + c
 OPPS NOT CLOSE TOKEN IN $y = mx + c
 Opps Not Close Token In $y = mx + c
-Opps Not Close Token In $y = mx + c
+Opps not close token in $y = mx + c
 ============================================================
 ============================================================
 TEST 26: Nesting
@@ -399,7 +399,7 @@ Title
 WORDS lower
 words UPPER
 Words Title
-Words Title
+Words \text_case_switch:nnnn {normal}{lower}{UPPER}{Title}
 ============================================================
 ============================================================
 TEST 32: Case change replacements
diff --git a/l3kernel/testfiles/m3text002.uptex.tlg b/l3kernel/testfiles/m3text002.uptex.tlg
index f280bcaeb..3c64503c2 100644
--- a/l3kernel/testfiles/m3text002.uptex.tlg
+++ b/l3kernel/testfiles/m3text002.uptex.tlg
@@ -7,14 +7,14 @@ TEST 1: Basic case changing
 hello world \par with \ERROR &##
 HELLO WORLD \par WITH \ERROR &##
 Hello World \par With \ERROR &##
-Hello World \par With \ERROR &##
+Hello world \par with \ERROR &##
 ============================================================
 ============================================================
 TEST 2: Case changes in braces
 ============================================================
 {hello} world \par with \ERROR &##
 {HELLO} WORLD \par WITH \ERROR &##
-{Hello} world \par with \ERROR &##
+{Hello} World \par With \ERROR &##
 {Hello} world \par with \ERROR &##
 ============================================================
 ============================================================
@@ -23,45 +23,45 @@ TEST 3: Case change exclusions
 some text \cite {WithFun}
 SOME TEXT \cite {WithFun}
 Some Text \cite {WithFun}
-Some Text \cite {WithFun}
+Some text \cite {WithFun}
 ============================================================
 ============================================================
 TEST 4: Titlecase basics
 ============================================================
 Hello World
-Hello World
+Hello world
 HELLO WORLD
 HELLO WORLD
 " Hello World"
-" Hello World"
+" hello world"
 " HELLO WORLD"
 " HELLO WORLD"
-{H}ello world
+{H}ello World
 {H}ello world
 {H}ELLO WORLD
 {H}ELLO WORLD
+{}hello World
 {}hello world
-{}hello world
-{}hello world
+{}hello World
 {}hello world
 ============================================================
 ============================================================
 TEST 5: Titlecase skipping chars
 ============================================================
 `Hic Sunt Leones'
-`Hic Sunt Leones'
-``Hic Sunt Leones''
+`Hic sunt leones'
 ``Hic Sunt Leones''
+``Hic sunt leones''
 ([Hic Sunt Leones])
-([Hic Sunt Leones])
+([Hic sunt leones])
 ============================================================
 ============================================================
 TEST 6: Titlecase first
 ============================================================
 `Hic SUNT Leones'
-`Hic SUNT Leones'
-`HIC SUNT Leones'
+`Hic SUNT leones'
 `HIC SUNT Leones'
+`HIC SUNT leones'
 E PLURIBUS UNUM
 E PLURIBUS UNUM
 ============================================================
@@ -69,9 +69,9 @@ E PLURIBUS UNUM
 TEST 7: Titlecase control
 ============================================================
 `hic SUNT Leones'
-`hic SUNT Leones'
-`HIC SUNT Leones'
+`hic SUNT leones'
 `HIC SUNT Leones'
+`HIC SUNT leones'
 E PLURIBUS UNUM
 E PLURIBUS UNUM
 ============================================================
@@ -81,11 +81,11 @@ TEST 8: Language based case changing but nothing
 no problems
 NO PROBLEMS
 No Problems
-No Problems
+No problems
 no problems
 NO PROBLEMS
 No Problems
-No Problems
+No problems
 ============================================================
 ============================================================
 TEST 9: (u)pTeX-based tests
@@ -133,7 +133,7 @@ TEST 13: Cyrillic
 ^^d0^^b4оклады ^^d0^^b0кадемии наук
 Д^^d0^^9e^^d0^^9a^^d0^^9b^^d0^^90^^d0^^94^^d0^^ab А^^d0^^9a^^d0^^90^^d0^^94^^d0^^95^^d0^^9c^^d0^^98^^d0^^98 ^^d0^^9d^^d0^^90^^d0^^a3^^d0^^9a
 Д^^d0^^9e^^d0^^9a^^d0^^9b^^d0^^90^^d0^^94^^d0^^ab А^^d0^^9a^^d0^^90^^d0^^94^^d0^^95^^d0^^9c^^d0^^98^^d0^^98 ^^d0^^9d^^d0^^90^^d0^^a3^^d0^^9a
-Д^^d0^^9e^^d0^^9a^^d0^^9b^^d0^^90^^d0^^94^^d0^^ab А^^d0^^9a^^d0^^90^^d0^^94^^d0^^95^^d0^^9c^^d0^^98^^d0^^98 ^^d0^^9d^^d0^^90^^d0^^a3^^d0^^9a
+Д^^d0^^9e^^d0^^9a^^d0^^9b^^d0^^90^^d0^^94^^d0^^ab Академии наук
 ============================================================
 ============================================================
 TEST 14: BCP47 parts
@@ -300,7 +300,7 @@ FOO \emph {BAR} {BAZ}
 \emph {BAR} {baz}
 \emph {BAR} {BAZ}
 \emph {BAR} {BAZ}
-\emph {BAR} {BAZ}
+\emph {BAR} BAZ
 ============================================================
 ============================================================
 TEST 24: Expanding content
@@ -308,27 +308,27 @@ TEST 24: Expanding content
 some text hello
 SOME TEXT HELLO
 Some Text Hello
-Some Text Hello
+Some text Hello
 hello sometext
 HELLO SOMETEXT
 Hello Sometext
-Hello Sometext
+Hello sometext
 some text hello
 SOME TEXT HELLO
 Some Text Hello
-Some Text Hello
+Some text Hello
 hello sometext
 HELLO SOMETEXT
 Hello Sometext
-Hello Sometext
+Hello sometext
 some text \cs_tmp:w 
 SOME TEXT \cs_tmp:w 
 Some Text \cs_tmp:w 
-Some Text \cs_tmp:w 
+Some text \cs_tmp:w 
 \cs_tmp:w  sometext
 \cs_tmp:w  SOMETEXT
 \cs_tmp:w  Sometext
-\cs_tmp:w  Sometext
+\cs_tmp:w  sometext
 ============================================================
 ============================================================
 TEST 25: Math-mode escape
@@ -336,15 +336,15 @@ TEST 25: Math-mode escape
 some text $y = mx + c$
 SOME TEXT $y = mx + c$
 Some Text $y = mx + c$
-Some Text $y = mx + c$
+Some text $y = mx + c$
 $y = mx + c$ text
 $y = mx + c$ TEXT
 $y = mx + c$ Text
-$y = mx + c$ Text
+$y = mx + c$ text
 opps not close token in $y = mx + c
 OPPS NOT CLOSE TOKEN IN $y = mx + c
 Opps Not Close Token In $y = mx + c
-Opps Not Close Token In $y = mx + c
+Opps not close token in $y = mx + c
 ============================================================
 ============================================================
 TEST 26: Nesting
@@ -399,7 +399,7 @@ Title
 WORDS lower
 words UPPER
 Words Title
-Words Title
+Words \text_case_switch:nnnn {normal}{lower}{UPPER}{Title}
 ============================================================
 ============================================================
 TEST 32: Case change replacements
diff --git a/l3kernel/testfiles/m3text002.xetex.tlg b/l3kernel/testfiles/m3text002.xetex.tlg
index 629e69d9f..82cced878 100644
--- a/l3kernel/testfiles/m3text002.xetex.tlg
+++ b/l3kernel/testfiles/m3text002.xetex.tlg
@@ -7,14 +7,14 @@ TEST 1: Basic case changing
 hello world \par with \ERROR &##
 HELLO WORLD \par WITH \ERROR &##
 Hello World \par With \ERROR &##
-Hello World \par With \ERROR &##
+Hello world \par with \ERROR &##
 ============================================================
 ============================================================
 TEST 2: Case changes in braces
 ============================================================
 {hello} world \par with \ERROR &##
 {HELLO} WORLD \par WITH \ERROR &##
-{Hello} world \par with \ERROR &##
+{Hello} World \par With \ERROR &##
 {Hello} world \par with \ERROR &##
 ============================================================
 ============================================================
@@ -23,45 +23,45 @@ TEST 3: Case change exclusions
 some text \cite {WithFun}
 SOME TEXT \cite {WithFun}
 Some Text \cite {WithFun}
-Some Text \cite {WithFun}
+Some text \cite {WithFun}
 ============================================================
 ============================================================
 TEST 4: Titlecase basics
 ============================================================
 Hello World
-Hello World
+Hello world
 HELLO WORLD
 HELLO WORLD
 " Hello World"
-" Hello World"
+" hello world"
 " HELLO WORLD"
 " HELLO WORLD"
-{H}ello world
+{H}ello World
 {H}ello world
 {H}ELLO WORLD
 {H}ELLO WORLD
+{}hello World
 {}hello world
-{}hello world
-{}hello world
+{}hello World
 {}hello world
 ============================================================
 ============================================================
 TEST 5: Titlecase skipping chars
 ============================================================
 `Hic Sunt Leones'
-`Hic Sunt Leones'
-``Hic Sunt Leones''
+`Hic sunt leones'
 ``Hic Sunt Leones''
+``Hic sunt leones''
 ([Hic Sunt Leones])
-([Hic Sunt Leones])
+([Hic sunt leones])
 ============================================================
 ============================================================
 TEST 6: Titlecase first
 ============================================================
 `Hic SUNT Leones'
-`Hic SUNT Leones'
-`HIC SUNT Leones'
+`Hic SUNT leones'
 `HIC SUNT Leones'
+`HIC SUNT leones'
 E PLURIBUS UNUM
 E PLURIBUS UNUM
 ============================================================
@@ -69,9 +69,9 @@ E PLURIBUS UNUM
 TEST 7: Titlecase control
 ============================================================
 `hic SUNT Leones'
-`hic SUNT Leones'
-`HIC SUNT Leones'
+`hic SUNT leones'
 `HIC SUNT Leones'
+`HIC SUNT leones'
 E PLURIBUS UNUM
 E PLURIBUS UNUM
 ============================================================
@@ -81,11 +81,11 @@ TEST 8: Language based case changing but nothing
 no problems
 NO PROBLEMS
 No Problems
-No Problems
+No problems
 no problems
 NO PROBLEMS
 No Problems
-No Problems
+No problems
 ============================================================
 ============================================================
 TEST 9: (u)pTeX-based tests
@@ -133,7 +133,7 @@ TEST 13: Cyrillic
 доклады академии наук
 ДОКЛАДЫ АКАДЕМИИ НАУК
 Доклады Академии Наук
-Доклады Академии Наук
+Доклады Академии наук
 ============================================================
 ============================================================
 TEST 14: BCP47 parts
@@ -300,7 +300,7 @@ FOO \emph {BAR} {BAZ}
 \emph {BAR} {baz}
 \emph {BAR} {BAZ}
 \emph {BAR} {BAZ}
-\emph {BAR} {BAZ}
+\emph {BAR} BAZ
 ============================================================
 ============================================================
 TEST 24: Expanding content
@@ -308,27 +308,27 @@ TEST 24: Expanding content
 some text hello
 SOME TEXT HELLO
 Some Text Hello
-Some Text Hello
+Some text Hello
 hello sometext
 HELLO SOMETEXT
 Hello Sometext
-Hello Sometext
+Hello sometext
 some text hello
 SOME TEXT HELLO
 Some Text Hello
-Some Text Hello
+Some text Hello
 hello sometext
 HELLO SOMETEXT
 Hello Sometext
-Hello Sometext
+Hello sometext
 some text \cs_tmp:w 
 SOME TEXT \cs_tmp:w 
 Some Text \cs_tmp:w 
-Some Text \cs_tmp:w 
+Some text \cs_tmp:w 
 \cs_tmp:w  sometext
 \cs_tmp:w  SOMETEXT
 \cs_tmp:w  Sometext
-\cs_tmp:w  Sometext
+\cs_tmp:w  sometext
 ============================================================
 ============================================================
 TEST 25: Math-mode escape
@@ -336,15 +336,15 @@ TEST 25: Math-mode escape
 some text $y = mx + c$
 SOME TEXT $y = mx + c$
 Some Text $y = mx + c$
-Some Text $y = mx + c$
+Some text $y = mx + c$
 $y = mx + c$ text
 $y = mx + c$ TEXT
 $y = mx + c$ Text
-$y = mx + c$ Text
+$y = mx + c$ text
 opps not close token in $y = mx + c
 OPPS NOT CLOSE TOKEN IN $y = mx + c
 Opps Not Close Token In $y = mx + c
-Opps Not Close Token In $y = mx + c
+Opps not close token in $y = mx + c
 ============================================================
 ============================================================
 TEST 26: Nesting
@@ -399,7 +399,7 @@ Title
 WORDS lower
 words UPPER
 Words Title
-Words Title
+Words \text_case_switch:nnnn {normal}{lower}{UPPER}{Title}
 ============================================================
 ============================================================
 TEST 32: Case change replacements





More information about the latex3-commits mailing list.