Skip to content

Commit

Permalink
Correct handling of Hangul runs
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Aug 8, 2022
1 parent 47099cc commit 9f6c061
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 27 deletions.
40 changes: 22 additions & 18 deletions l3kernel/l3text-map.dtx
Expand Up @@ -103,9 +103,9 @@
% }
% \begin{macro}[EXP]{\@@_map_hangul:Nnnw}
% \begin{macro}[EXP]{\@@_map_hangul:NnnN}
% \begin{macro}[EXP]{\@@_map_hangul:Nnnnn}
% \begin{macro}[EXP]{\@@_map_hangul:Nnnnw}
% \begin{macro}[EXP]{\@@_map_hangul:nNnnnn}
% \begin{macro}[EXP]{\@@_map_hangul:Nnnn}
% \begin{macro}[EXP]{\@@_map_hangul_aux:Nnnnw}
% \begin{macro}[EXP]{\@@_map_hangul:nNnnnw}
% \begin{macro}[EXP]{\@@_map_hangul_loop:Nnnnnw}
% \begin{macro}[EXP]{\@@_map_hangul_next:Nnnn}
% \begin{macro}[EXP]{\@@_map_hangul_end:nw}
Expand Down Expand Up @@ -322,13 +322,13 @@
{
\@@_map_output:Nn #1 {#2}
\@@_map_hangul:Nnnw
#1 {#3} { L V { LV } { LVT } }
#1 {#3} { L ; V ; LV ; LVT }
}
\cs_new:Npn \@@_map_LV:Nnn #1#2#3
{
\@@_map_output:Nn #1 {#2}
\@@_map_hangul:Nnnw
#1 {#3} { V T }
#1 {#3} { V ; T }
}
\cs_new:Npn \@@_map_LVT:Nnn #1#2#3
{
Expand Down Expand Up @@ -358,16 +358,24 @@
#1 {#2}
\@@_map_loop:Nnw #1 { }
}
{ \@@_codepoint_process:nN { \@@_map_hangul:Nnnnn #1 {#2} {#3} } #4 }
{
\@@_codepoint_process:nN
{ \@@_map_hangul:Nnnn #1 {#2} {#3} } #4
}
}
\cs_new:Npn \@@_map_hangul:Nnnn #1#2#3#4
{
\@@_map_hangul_aux:Nnnw #1 {#2} {#4}
#3 ; \q_recursion_tail ; \q_recursion_stop
}
\cs_new:Npn \@@_map_hangul:Nnnnn #1#2#3#4
{ \@@_map_hangul:Nnnnw #1 {#2} {#4} #3 ; }
\cs_new:Npn \@@_map_hangul:Nnnnw #1#2#3#4#5 ;
\cs_new:Npn \@@_map_hangul_aux:Nnnw #1#2#3#4 ;
{
\exp_args:Nv \@@_map_hangul:nNnnnn { c_@@_grapheme_ #4 _clist }
#1 {#2} {#3} {#4} {#5}
\quark_if_recursion_tail_stop_do:nn {#4}
{ \@@_map_loop:Nnw #1 {#2} #3 }
\exp_args:Nv \@@_map_hangul:nNnnnw { c_@@_grapheme_ #4 _clist }
#1 {#2} {#3} {#4}
}
\cs_new:Npn \@@_map_hangul:nNnnnn #1#2#3#4#5#6
\cs_new:Npn \@@_map_hangul:nNnnnw #1#2#3#4#5#6 \q_recursion_stop
{
\@@_map_hangul_loop:Nnnnnw #2 {#3} {#4} {#5} {#6}
#1 , \q_@@_recursion_tail .. , \q_@@_recursion_stop
Expand All @@ -391,11 +399,7 @@
}
}
\cs_new:Npn \@@_map_hangul_next:Nnnn #1#2#3#4
{
\tl_if_blank:nTF {#4}
{ \@@_map_loop:Nnw #1 {#2} #3 }
{ \@@_map_hangul:Nnnnw #1 {#2} {#3} #4 ; }
}
{ \@@_map_hangul_aux:Nnnw #1 {#2} {#3} #4 \q_recursion_stop }
\cs_new:Npn \@@_map_hangul_end:nw #1#2 \q_@@_recursion_stop {#1}
\cs_new:Npn \@@_map_hangul_L:Nnn #1#2#3
{
Expand All @@ -405,7 +409,7 @@
\cs_new:Npn \@@_map_hangul_LV:Nnn #1#2#3
{
\@@_map_hangul:Nnnw
#1 {#2#3} { V T }
#1 {#2#3} { VT }
}
\cs_new_eq:NN \@@_map_hangul_V:Nnn \@@_map_hangul_LV:Nnn
\cs_new:Npn \@@_map_hangul_LVT:Nnn #1#2#3
Expand Down
4 changes: 2 additions & 2 deletions l3kernel/testfiles/m3text006.luatex.tlg
Expand Up @@ -228,11 +228,11 @@ TRUE
TRUE
TRUE
TRUE
^^f7 [0.2] HANGUL CHOSEONG KIYEOK (L) ^^f7 [999.0] HANGUL JONGSEONG KIYEOK (T) ^^f7 [0.3]
TRUE
TRUE
TRUE
^^f7 [0.2] HANGUL CHOSEONG KIYEOK (L) ^^d7 [6.0] HANGUL SYLLABLE GAG (LVT) ^^f7 [0.3]
TRUE
TRUE
TRUE
TRUE
TRUE
Expand Down
2 changes: 1 addition & 1 deletion l3kernel/testfiles/m3text006.lvt
Expand Up @@ -75,7 +75,7 @@
{ \text_map_function:nN {#2} \test_auxvii:n }
{#3}
{ \TRUE }
{ \LONGTYPEOUT {#1} }
{ \LONGTYPEOUT {#1} }%\LONGTYPEOUT {#2:\text_map_function:nN {#2} \test_auxvii:n :#3} }
}
\cs_set:Npn \test_auxvii:n #1 { (#1) }
\bool_lazy_or:nnTF
Expand Down
4 changes: 2 additions & 2 deletions l3kernel/testfiles/m3text006.ptex.tlg
Expand Up @@ -228,11 +228,11 @@ TRUE
TRUE
TRUE
TRUE
^^f7 [0.2] HANGUL CHOSEONG KIYEOK (L) ^^f7 [999.0] HANGUL JONGSEONG KIYEOK (T) ^^f7 [0.3]
TRUE
TRUE
TRUE
^^f7 [0.2] HANGUL CHOSEONG KIYEOK (L) ^^d7 [6.0] HANGUL SYLLABLE GAG (LVT) ^^f7 [0.3]
TRUE
TRUE
TRUE
TRUE
TRUE
Expand Down
4 changes: 2 additions & 2 deletions l3kernel/testfiles/m3text006.tlg
Expand Up @@ -228,11 +228,11 @@ TRUE
TRUE
TRUE
TRUE
^^c3^^b7 [0.2] HANGUL CHOSEONG KIYEOK (L) ^^c3^^b7 [999.0] HANGUL JONGSEONG KIYEOK (T) ^^c3^^b7 [0.3]
TRUE
TRUE
TRUE
^^c3^^b7 [0.2] HANGUL CHOSEONG KIYEOK (L) ^^c3^^97 [6.0] HANGUL SYLLABLE GAG (LVT) ^^c3^^b7 [0.3]
TRUE
TRUE
TRUE
TRUE
TRUE
Expand Down
4 changes: 2 additions & 2 deletions l3kernel/testfiles/m3text006.xetex.tlg
Expand Up @@ -228,11 +228,11 @@ TRUE
TRUE
TRUE
TRUE
^^f7 [0.2] HANGUL CHOSEONG KIYEOK (L) ^^f7 [999.0] HANGUL JONGSEONG KIYEOK (T) ^^f7 [0.3]
TRUE
TRUE
TRUE
^^f7 [0.2] HANGUL CHOSEONG KIYEOK (L) ^^d7 [6.0] HANGUL SYLLABLE GAG (LVT) ^^f7 [0.3]
TRUE
TRUE
TRUE
TRUE
TRUE
Expand Down

0 comments on commit 9f6c061

Please sign in to comment.