[latex3-commits] [git/LaTeX3-latex3-latex3] master: Extend final-sigma support to 8-bit engines (937bcb6af)
Joseph Wright
joseph.wright at morningstar2.co.uk
Thu Oct 15 14:51:00 CEST 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/937bcb6af4cfd0212cfcbc2e25ad141730ae07cb
>---------------------------------------------------------------
commit 937bcb6af4cfd0212cfcbc2e25ad141730ae07cb
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Thu Oct 15 13:51:00 2020 +0100
Extend final-sigma support to 8-bit engines
>---------------------------------------------------------------
937bcb6af4cfd0212cfcbc2e25ad141730ae07cb
l3kernel/l3text-case.dtx | 77 ++++++++++++++++++++++++++++++++++++++----------
1 file changed, 62 insertions(+), 15 deletions(-)
diff --git a/l3kernel/l3text-case.dtx b/l3kernel/l3text-case.dtx
index febd34ccd..a0840cc85 100644
--- a/l3kernel/l3text-case.dtx
+++ b/l3kernel/l3text-case.dtx
@@ -155,6 +155,9 @@
% \begin{macro}[EXP]{\@@_change_case_lower_sigma:nnnN}
% \begin{macro}[EXP]{\@@_change_case_lower_sigma:nnNw}
% \begin{macro}[EXP]{\@@_change_case_lower_sigma:NnnN}
+% \begin{macro}[EXP]{\@@_change_case_lower_sigma:nnnNN}
+% \begin{macro}[EXP]{\@@_change_case_lower_sigma:nnw}
+% \begin{macro}[EXP]{\@@_change_case_lower_sigma:nnN}
% \begin{macro}[EXP]
% {\@@_change_case_char_title:nnN, \@@_change_case_char_titleonly:nnN}
% \begin{macro}[EXP]
@@ -461,16 +464,10 @@
% is there the special case of a terminal sigma. If not, then we pass to
% a simple character mapping.
% \begin{macrocode}
-\cs_new:Npx \@@_change_case_char_lower:nnN #1#2#3
+\cs_new:Npn \@@_change_case_char_lower:nnN #1#2#3
{
- \exp_not:N \cs_if_exist_use:cF { @@_change_case_lower_ #2 :nnnN }
- {
- \bool_lazy_or:nnTF
- { \sys_if_engine_luatex_p: }
- { \sys_if_engine_xetex_p: }
- { \exp_not:N \@@_change_case_lower_sigma:nnnN }
- { \exp_not:N \@@_change_case_char:nnnN }
- }
+ \cs_if_exist_use:cF { @@_change_case_lower_ #2 :nnnN }
+ { \@@_change_case_lower_sigma:nnnN }
{#1} {#1} {#2} #3
}
\cs_new:Npn \@@_change_case_char_upper:nnN #1#2#3
@@ -485,7 +482,7 @@
% then there is a look-ahead phase: the logic here is simply based on letters.
% The one exception is Dutch: see below.
% \begin{macrocode}
-\bool_lazy_or:nnT
+\bool_lazy_or:nnTF
{ \sys_if_engine_luatex_p: }
{ \sys_if_engine_xetex_p: }
{
@@ -518,6 +515,48 @@
}
}
% \end{macrocode}
+% In the $8$-bit engines, we have to look ahead once we find the first byte of the
+% possible hit.
+% \begin{macrocode}
+ {
+ \cs_new:Npn \@@_change_case_lower_sigma:nnnN #1#2#3#4
+ {
+ \int_compare:nNnTF { `#4 } = { "CE }
+ { \@@_change_case_lower_sigma:nnnNN }
+ { \@@_change_case_char:nnnN }
+ {#1} {#2} {#3} #4
+ }
+ \cs_new:Npn \@@_change_case_lower_sigma:nnnNN #1#2#3#4#5
+ {
+ \int_compare:nNnTF { `#5 } = { "A3 }
+ { \@@_change_case_lower_sigma:nnw {#2} {#3} }
+ { \@@_change_case_char:nnnN {#1} {#2} {#3} #4#5 }
+ }
+ \cs_new:Npn \@@_change_case_lower_sigma:nnw #1#2#3 \q_@@_recursion_stop
+ {
+ \tl_if_head_is_N_type:nTF {#3}
+ { \@@_change_case_lower_sigma:nnN }
+ {
+ \@@_change_case_store:V \c_@@_final_sigma_tl
+ \@@_change_case_loop:nnw
+ }
+ {#1} {#2} #3 \q_@@_recursion_stop
+ }
+ \cs_new:Npn \@@_change_case_lower_sigma:nnN #1#2#3
+ {
+ \bool_lazy_or:nnTF
+ { \token_if_letter_p:N #3 }
+ {
+ \bool_lazy_and_p:nn
+ { \token_if_active_p:N #3 }
+ { \int_compare_p:nNn { `#3 } > { "80 } }
+ }
+ { \@@_change_case_store:V \c_@@_sigma_tl }
+ { \@@_change_case_store:V \c_@@_final_sigma_tl }
+ \@@_change_case_loop:nnw {#1} {#2} #3
+ }
+ }
+% \end{macrocode}
% For titlecasing, we need to fully expand the new character to see if it
% is a letter (or active) But that means looking ahead in the $8$-bit case, so
% we have to grab the required tokens up-front. Life is a lot easier for Unicode
@@ -664,6 +703,9 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}[EXP]{\@@_change_case_upper_de-alt:nnnN}
% \begin{macro}[EXP]{\@@_change_case_upper_de-alt:nnnNN}
@@ -1198,14 +1240,17 @@
%
% \begin{variable}
% {
-% \c_@@_dotless_i_tl ,
-% \c_@@_dotted_I_tl ,
-% \c_@@_i_ogonek_tl ,
-% \c_@@_I_ogonek_tl ,
+% \c_@@_dotless_i_tl ,
+% \c_@@_dotted_I_tl ,
+% \c_@@_i_ogonek_tl ,
+% \c_@@_I_ogonek_tl ,
+% \c_@@_final_sigma_tl ,
+% \c_@@_sigma_tl ,
% \c_@@_grosses_Eszett_tl
% }
% For cases where there is an $8$-bit option in the |T1| font set up,
-% a variant is provided in both cases.
+% a variant is provided in both cases. There are also a few extras for
+% |LGR|.
% \begin{macrocode}
\group_begin:
\bool_lazy_or:nnF
@@ -1238,6 +1283,8 @@
\@@_tmp:w \c_@@_dotted_I_tl { 0130 }
\@@_tmp:w \c_@@_i_ogonek_tl { 012F }
\@@_tmp:w \c_@@_I_ogonek_tl { 012E }
+ \@@_tmp:w \c_@@_final_sigma_tl { 03C2 }
+ \@@_tmp:w \c_@@_sigma_tl { 03C3 }
\@@_tmp:w \c_@@_grosses_Eszett_tl { 1E9E }
}
\group_end:
More information about the latex3-commits
mailing list.