summaryrefslogtreecommitdiff
path: root/language/korean/cjk-ko/cjkutf8-josa.sty
diff options
context:
space:
mode:
Diffstat (limited to 'language/korean/cjk-ko/cjkutf8-josa.sty')
-rw-r--r--language/korean/cjk-ko/cjkutf8-josa.sty30
1 files changed, 29 insertions, 1 deletions
diff --git a/language/korean/cjk-ko/cjkutf8-josa.sty b/language/korean/cjk-ko/cjkutf8-josa.sty
index 7623138b7f..4157b470c3 100644
--- a/language/korean/cjk-ko/cjkutf8-josa.sty
+++ b/language/korean/cjk-ko/cjkutf8-josa.sty
@@ -17,7 +17,7 @@
% Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
% MA 02110-1301 USA
-\ProvidesPackage{cjkutf8-josa}[2021/07/17 v2.0 Automatic Josa selection for cjk-ko]
+\ProvidesPackage{cjkutf8-josa}[2021/07/20 v2.1 Automatic Josa selection for cjk-ko]
\AtBeginDocument{
\ifx\use@josa\undefined\else
@@ -54,6 +54,27 @@
}}{}
}
+% support hangul syllables (0xAC00..0xD7A3)
+\def\cjkko@josa@ea{\cjkko@josa@hangul@syllableS{"EA}}
+\def\cjkko@josa@eb{\cjkko@josa@hangul@syllableS{"EB}}
+\def\cjkko@josa@ec{\cjkko@josa@hangul@syllableS{"EC}}
+\def\cjkko@josa@ed{\cjkko@josa@hangul@syllableS{"ED}}
+\def\cjkko@josa@hangul@syllableS#1#2#3{%
+ \expandafter\cjkko@josa@hangul@syllable\expandafter{%
+ \number\numexpr (#1 - 224) * 4096 + (`#2 - 128) * 64 + (`#3 - 128) - "AC00\relax }}
+\def\cjkko@josa@hangul@syllable#1{%
+ \ifnum#1<\z@ \else \ifnum#1>11171 \else
+ \expandafter\cjkko@josa@hangul@syllable@\expandafter{%
+ \number\numexpr #1 - (((#1 + 14) / 28 - 1) * 28)\relax }% we need floor, not round
+ \fi\fi
+}
+\def\cjkko@josa@hangul@syllable@#1{%
+ \ifnum#1=\z@
+ 2\else \ifnum#1=8 %
+ 1\else
+ 0\fi\fi
+}
+
%%% user commands: \jong \jung \rieul
\protected\def\jong {\let\josa@str\empty\chardef\@josa\z@ }
\protected\def\rieul{\let\josa@str\empty\chardef\@josa\@ne}
@@ -62,6 +83,13 @@
\def\makejosa#1#2{%
\bgroup
+ \begingroup
+ \let^^ea\cjkko@josa@ea
+ \let^^eb\cjkko@josa@eb
+ \let^^ec\cjkko@josa@ec
+ \let^^ed\cjkko@josa@ed
+ \let\protect\noexpand
+ \edef\x{\endgroup \def\noexpand\josa@str{\josa@str}}\x
\expandafter\make@josa\josa@str\@nil{#1}{#2}%
\egroup}