diff options
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3text-case.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3text-case.dtx | 123 |
1 files changed, 109 insertions, 14 deletions
diff --git a/macros/latex/contrib/l3kernel/l3text-case.dtx b/macros/latex/contrib/l3kernel/l3text-case.dtx index e8e07d236c..b93243040d 100644 --- a/macros/latex/contrib/l3kernel/l3text-case.dtx +++ b/macros/latex/contrib/l3kernel/l3text-case.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-02-22} +% \date{Released 2023-03-30} % % \maketitle % @@ -885,6 +885,8 @@ % \begin{macro}[EXP,pTF]{\@@_change_case_if_greek:n} % \begin{macro}[EXP]{\@@_change_case_if_greek:n} % \begin{macro}[EXP,pTF]{\@@_change_case_if_greek:n} +% \begin{macro}[EXP,pTF]{\@@_change_case_if_greek_spacing_diacritic:n} +% \begin{macro}[EXP]{\@@_change_case_if_greek_spacing_diacritic:n} % \begin{macro}[EXP,pTF]{\@@_change_case_if_greek_accent:n} % \begin{macro}[EXP]{\@@_change_case_if_greek_accent:n} % \begin{macro}[EXP,pTF]{\@@_change_case_if_greek_diacritic:n} @@ -903,18 +905,31 @@ % although necessarily the implementation is somewhat different. The % \emph{ypogegrammeni} is filtered out here as it is not actually in the % Greek range, so gets lost if we leave until later. The one Greek codepoint -% we skip is the numeral sign: it's got an awkward NFD for \pdfTeX{} so is -% best left unchanged. +% we skip is the numeral sign and question mark: the first has an awkward NFD +% for \pdfTeX{} so is best left unchanged, and the latter has issues concerning +% how \texttt{LGR} outputs the input and output (differently!). % \begin{macrocode} \cs_new:Npn \@@_change_case_upper_el:nnnn #1#2#3#4 { \bool_lazy_and:nnTF { \@@_change_case_if_greek_p:n {#4} } - { ! \@@_codepoint_compare_p:nNn {#4} = { "0374 } } { - \exp_args:Ne \@@_change_case_upper_el:nnn + ! \bool_lazy_or_p:nn + { \@@_codepoint_compare_p:nNn {#4} = { "0374 } } + { \@@_codepoint_compare_p:nNn {#4} = { "037E } } + } + { + \@@_change_case_if_greek_spacing_diacritic:nTF {#4} + { + \@@_change_case_store:n {#4} + \@@_change_case_loop:nnw + } { - \codepoint_to_nfd:n { \@@_codepoint_from_chars:Nw #4 } + \exp_args:Ne \@@_change_case_upper_el:nnn + { + \codepoint_to_nfd:n + { \@@_codepoint_from_chars:Nw #4 } + } } {#2} {#3} } @@ -1247,6 +1262,84 @@ \fi: \fi: } +\prg_new_conditional:Npnn \@@_change_case_if_greek_spacing_diacritic:n + #1 { TF } + { + \exp_args:Nf \@@_change_case_if_greek_spacing_diacritic:n + { \int_eval:n { \@@_codepoint_from_chars:Nw #1 } } + } +\cs_new:Npn \@@_change_case_if_greek_spacing_diacritic:n #1 + { + \if_int_compare:w #1 < "1FBD \exp_stop_f: + \if_int_compare:w #1 = "037A \exp_stop_f: + \prg_return_true: + \else: + \prg_return_false: + \fi: + \else: + \if_int_compare:w #1 = "1FBD \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FBF \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FC0 \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FC1 \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FCD \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FCE \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FCF \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FDD \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FDE \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FDF \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FED \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FEE \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FEF \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FFD \exp_stop_f: + \prg_return_true: + \else: + \if_int_compare:w #1 = "1FFE \exp_stop_f: + \prg_return_true: + \else: + \prg_return_false: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + } \prg_new_conditional:Npnn \@@_change_case_if_greek_diacritic:n #1 { TF , p } { @@ -1267,11 +1360,7 @@ \if_int_compare:w #1 = "0314 \exp_stop_f: \prg_return_true: \else: - \if_int_compare:w #1 = "0343 \exp_stop_f: - \prg_return_true: - \else: - \prg_return_false: - \fi: + \prg_return_false: \fi: \fi: \fi: @@ -1351,6 +1440,8 @@ % \end{macro} % \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} @@ -1383,9 +1474,13 @@ } \cs_new:Npn \@@_change_case_boundary_upper_el:nnn #1#2#3 { - \bool_lazy_or:nnTF - { \@@_codepoint_compare_p:nNn {#3} = { "03AE } } - { \@@_codepoint_compare_p:nNn {#3} = { "1F22 } } + \bool_lazy_any:nTF + { + { \@@_codepoint_compare_p:nNn {#3} = { "0389 } } + { \@@_codepoint_compare_p:nNn {#3} = { "03AE } } + { \@@_codepoint_compare_p:nNn {#3} = { "1F22 } } + { \@@_codepoint_compare_p:nNn {#3} = { "1F2A } } + } { \@@_change_case_boundary_upper_el:nnnw {#1} {#2} {#3} } { \@@_change_case_loop:nnw {#1} {#2} #3 } } |