diff options
author | Karl Berry <karl@freefriends.org> | 2022-09-03 19:48:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-09-03 19:48:40 +0000 |
commit | 71bf62517665fb54d3322f81d6a2e8ef45dea18b (patch) | |
tree | 80aa03b108947bfd9088eff7855269888f5b7296 /Master/texmf-dist/tex/latex | |
parent | 34ac3f6fb45a8d3899d35bc12d5315a8fc8cc914 (diff) |
pmhanguljamo (3sep22)
git-svn-id: svn://tug.org/texlive/trunk@64279 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/pmhanguljamo/pmhanguljamo-rrk.sty | 63 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pmhanguljamo/pmhanguljamo.sty | 79 |
2 files changed, 121 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/latex/pmhanguljamo/pmhanguljamo-rrk.sty b/Master/texmf-dist/tex/latex/pmhanguljamo/pmhanguljamo-rrk.sty index a86c54051c5..40df178d30f 100644 --- a/Master/texmf-dist/tex/latex/pmhanguljamo/pmhanguljamo-rrk.sty +++ b/Master/texmf-dist/tex/latex/pmhanguljamo/pmhanguljamo-rrk.sty @@ -1,31 +1,73 @@ % % subroutines of pmhanguljamo.sty -%. v0.3.2 (2020/02/05) -%. v0.3.3 (2020/03/09) -%. v0.3.4 (2020/03/15) -% v0.4 (2021/11/28) +% v0.3.2 (2020/02/05) +% v0.3.3 (2020/03/09) +% v0.3.4 (2020/03/15) +% v0.4 (2021/11/28) +% v0.5 (2022/09/02) % \seq_new:N \l_textjm_seq \NewDocumentEnvironment { jamotext } { +b } { \seq_set_split:Nnn \l_textjm_seq {\par} { #1 } - \seq_indexed_map_inline:Nn \l_textjm_seq + \seq_map_indexed_function:NN \l_textjm_seq \jamo_word_rrk:nn +% \seq_map_indexed_inline:Nn \l_textjm_seq +% { +% \jamoword { ##2 } +% \int_compare:nT { ##1 < \seq_count:N \l_textjm_seq } +% { +% \par +% } +% } +}{} + +\cs_new:Npn \jamo_word_rrk:nn #1 #2 +{ +% \jamoword { #2 } + \seq_set_split:Nnn \l_inparpar_seq { ~ } { #2 } + + \seq_map_indexed_inline:Nn \l_inparpar_seq { - \jamoword { ##2 } - \int_compare:nT { ##1 < \seq_count:N \l_textjm_seq } + \regex_match:nnTF { ^\!\{ } { ##2 } + { + \tl_set:Nn \l_tmpa_tl { ##2 } + \regex_match:nnTF { ^\!\{(.+?)\}$ } { ##2 } + { + \regex_replace_once:nnN { ^\!\{(.+?)\}$ } { \1 } \l_tmpa_tl + \l_tmpa_tl + } + { + \tl_set_eq:NN \l_tmpb_tl \l_tmpa_tl + \regex_replace_once:nnN { ^\!\{(.+?)\}(.*)$ } { \1 } \l_tmpa_tl + \l_tmpa_tl + \regex_replace_once:nnN { ^\!\{(.+?)\}(.*)$ } { \2 } \l_tmpb_tl + \exp_args:No \jamoword { \l_tmpb_tl } + } + } { - \par + \jamoword{ ##2 } } + + \int_compare:nT { ##1 < \seq_count:N \l_inparpar_seq } + { \space } } -}{} + + \int_compare:nT { #1 < \seq_count:N \l_textjm_seq } + { \par } +} + \tl_new:N \l_tmpz_tl \NewDocumentCommand \jamoword { m } { + \group_begin: + \bool_if:NT \opt_usepmfont_bool + { \pm_hangulfontspec[Script=Hangul,Renderer=OpenType] {\opt_pmfont_tl } } + \seq_set_split:Nnn \l_tmpa_seq { ~ } { #1 } - \seq_indexed_map_inline:Nn \l_tmpa_seq + \seq_map_indexed_inline:Nn \l_tmpa_seq { \tl_set:Nn \l_tmpz_tl { ##2 } \exp_args:No \str_if_in:nnT { \l_tmpz_tl } { - } @@ -70,6 +112,7 @@ \space } } + \group_end: } \cs_new:Npn \rrk_fn_outer:n #1 diff --git a/Master/texmf-dist/tex/latex/pmhanguljamo/pmhanguljamo.sty b/Master/texmf-dist/tex/latex/pmhanguljamo/pmhanguljamo.sty index 89cd8f44936..59853b9dd07 100644 --- a/Master/texmf-dist/tex/latex/pmhanguljamo/pmhanguljamo.sty +++ b/Master/texmf-dist/tex/latex/pmhanguljamo/pmhanguljamo.sty @@ -2,7 +2,7 @@ %% %% Poorman's Hangul Jamo Input Method. %% -%% (C) 2020-2021 Kangsoo Kim +%% (C) 2020-2022 Kangsoo Kim %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -16,22 +16,29 @@ %% %% The Current Maintainer of this work is Kangsoo Kim %% -%% This work consists of the file pmhanguljamo.sty, pmhanguljamo-rrk.sty +%% This work consists of the style files --- pmhanguljamo.sty, pmhanguljamo-rrk.sty, %% and the documentation files pmhanguljamo-doc.tex and pmhanguljamo-doc.pdf. %% \RequirePackage{xparse} \ProvidesExplPackage {pmhanguljamo} - {2021/11/28} - {v0.4} + {2022/09/02} + {v0.5} {Poorman's Hangul Jamo Input Method} \RequirePackage{l3keys2e} +\bool_new:N \opt_usepmfont_bool +\tl_new:N \opt_pmfont_tl + \keys_define:nn { pmhanguljamo } { rrk .bool_set:N = \opt_rrkopt_bool, - RRK .bool_set:N = \opt_rrkopt_bool + RRK .bool_set:N = \opt_rrkopt_bool, + pmfont .code:n = { + \bool_gset_true:N \opt_usepmfont_bool + \tl_gset:Nn \opt_pmfont_tl { #1 } + } } \ProcessKeysOptions { pmhanguljamo } @@ -157,6 +164,26 @@ \makebox[\l_tmpa_dim][c]{ \char"318D\kern-.6em\char"318D } } +%%%% usepmfont macro + +\cs_if_exist:NTF \hangulfontspec +{ + \cs_set_eq:NN \pm_hangulfontspec \hangulfontspec +} +{ + \cs_set_eq:NN \pm_hangulfontspec \fontspec +} + +\NewDocumentCommand \usepmfont { } +{ + \bool_gset_true:N \opt_usepmfont_bool +} + +\NewDocumentCommand \setpmhangulfont { m } +{ + \tl_gset:Nn \opt_pmfont_tl { #1 } +} + %%%% if RRK is given, then input pmhanguljamo-rrk.sty %%%% and stop. @@ -179,7 +206,7 @@ \exp_args:Nno \regex_split:nnN { / } { \l_tmpa_tl } \l_tmpa_seq - \seq_indexed_map_function:NN \l_tmpa_seq \build_syl:nn + \seq_map_indexed_function:NN \l_tmpa_seq \build_syl:nn } \tl_new:N \l_cho_tl @@ -192,9 +219,9 @@ \NewDocumentEnvironment { jamotext } { +b } { \seq_set_split:Nnn \l_inputpar_seq { \par } { #1 } - \seq_indexed_map_function:NN \l_inputpar_seq \jamo_word:nn + \seq_map_indexed_function:NN \l_inputpar_seq \jamo_word:nn % \seq_set_split:Nnn \l_inputword_seq { ~ } { #1 } -% \seq_indexed_map_inline:Nn \l_inputword_seq +% \seq_map_indexed_inline:Nn \l_inputword_seq % { % \jamotextcmd { ##2 } % \int_compare:nT { ##1 < \seq_count:N \l_inputword_seq } @@ -204,7 +231,35 @@ \cs_new:Npn \jamo_word:nn #1 #2 { - \jamoword { #2 } +% \jamoword { #2 } + \seq_set_split:Nnn \l_inparpar_seq { ~ } { #2 } + + \seq_map_indexed_inline:Nn \l_inparpar_seq + { + \regex_match:nnTF { ^\!\{ } { ##2 } + { + \tl_set:Nn \l_tmpa_tl { ##2 } + \regex_match:nnTF { ^\!\{(.+?)\}$ } { ##2 } + { + \regex_replace_once:nnN { ^\!\{(.+?)\}$ } { \1 } \l_tmpa_tl + \l_tmpa_tl + } + { + \tl_set_eq:NN \l_tmpb_tl \l_tmpa_tl + \regex_replace_once:nnN { ^\!\{(.+?)\}(.*)$ } { \1 } \l_tmpa_tl + \l_tmpa_tl + \regex_replace_once:nnN { ^\!\{(.+?)\}(.*)$ } { \2 } \l_tmpb_tl + \exp_args:No \jamoword { \l_tmpb_tl } + } + } + { + \jamoword{ ##2 } + } + + \int_compare:nT { ##1 < \seq_count:N \l_inparpar_seq } + { \space } + } + \int_compare:nT { #1 < \seq_count:N \l_inputpar_seq } { \par } } @@ -212,9 +267,11 @@ \NewDocumentCommand \jamoword { m } { \seq_set_split:Nnn \l_inputword_seq { ~ } { #1 } - \seq_indexed_map_inline:Nn \l_inputword_seq + \seq_map_indexed_inline:Nn \l_inputword_seq { - \jamotextcmd { ##2 } + \bool_if:NTF \opt_usepmfont_bool + { {\pm_hangulfontspec[Script=Hangul,Renderer=OpenType]{\opt_pmfont_tl} \jamotextcmd{ ##2 } } } + { \jamotextcmd { ##2 } } \int_compare:nT { ##1 < \seq_count:N \l_inputword_seq } { \space } } |