% xetexko-space.sty
%
% Copyright (c) 2013-2019 Dohyun Kim  <nomos at ktug org>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%  http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2006/05/20 or later.

\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname ProvidesPackage\endcsname\relax\else
  \ProvidesPackage{xetexko-space}
    [2019/12/01 v2.22 Spacings and fonts for XeTeX-ko]
\fi

%%% we need XeTeX > 0.997
\ifx\XeTeXinterchartoks\XeTeXcharclass
  \errmessage{This package requires XeTeX 0.997 or higher.}
  \expandafter\endinput
\fi
\ifcsname newXeTeXintercharclass\endcsname\else
  \errmessage{This package requires TeXLive 2009 or higher.}
  \expandafter\endinput
\fi

\unless\ifcsname @sptoken\endcsname
  {\def\:{\global\let\@sptoken= } \: }% space token
\fi

%%%%%%%%%%%%%%%%%%%%%
% assign char classes

\def\XK@assign@char@class#1#2#3{%
  \count@=#1\relax
  \loop
    \ifx #3\XKhangulsyllable
      \catcode\count@ = 12 % revert recent change of unicode-letters.tex
    \fi
    \XeTeXcharclass\count@ = #3\relax
    \ifnum\count@<#2\relax \advance\count@\@ne
  \repeat
}

% xetex 0.99994 extended char class limit.
\ifdim\the\XeTeXversion\XeTeXrevision pt<0.99994pt
  \let\XeTeXcharclassIgnore\@cclvi
  \let\XKboundary\@cclv
\else
  \chardef\XeTeXcharclassIgnore=4096
  \chardef\XKboundary=4095
\fi
% from JW
\ifdefined\XeTeXcharclassID\else
  \ifdefined\xtxHanGlue
    \let\XeTeXcharclassID\@ne
    \let\XeTeXcharclassOP\tw@
    \let\XeTeXcharclassCL\thr@@
  \else
    \newXeTeXintercharclass\XeTeXcharclassID
    \newXeTeXintercharclass\XeTeXcharclassOP
    \newXeTeXintercharclass\XeTeXcharclassCL
    \global\let\XeTeXcharclassCJ\XeTeXcharclassID
    \global\let\XeTeXcharclassEX\XeTeXcharclassCL
    \global\let\XeTeXcharclassIS\XeTeXcharclassCL
    \global\let\XeTeXcharclassNS\XeTeXcharclassCL
    \global\let\XeTeXcharclassCM\XeTeXcharclassIgnore
    \input load-unicode-xetex-classes %
  \fi
\fi

\let     \XKhanja         \XeTeXcharclassID
\let     \XKcjkopening    \XeTeXcharclassOP
\let     \XKcjkclosing    \XeTeXcharclassCL
\let     \XKlatinchar     \z@

\XeTeXcharclass "2018 = \XKcjkopening    % ‘
\XeTeXcharclass "201C = \XKcjkopening    % “

\XeTeXcharclass "2019 = \XKcjkclosing    % ’
\XeTeXcharclass "201D = \XKcjkclosing    % ”

\XeTeXcharclass "25A1 = \XKhanja         % □

%%% small kana (something has changed)
\newXeTeXintercharclass \XKsmallkana
\XeTeXcharclass "3041 = \XKsmallkana
\XeTeXcharclass "3043 = \XKsmallkana
\XeTeXcharclass "3045 = \XKsmallkana
\XeTeXcharclass "3047 = \XKsmallkana
\XeTeXcharclass "3049 = \XKsmallkana
\XeTeXcharclass "3063 = \XKsmallkana
\XeTeXcharclass "3083 = \XKsmallkana
\XeTeXcharclass "3085 = \XKsmallkana
\XeTeXcharclass "3087 = \XKsmallkana
\XeTeXcharclass "308E = \XKsmallkana
\XeTeXcharclass "3095 = \XKsmallkana
\XeTeXcharclass "3096 = \XKsmallkana
\XeTeXcharclass "30A1 = \XKsmallkana
\XeTeXcharclass "30A3 = \XKsmallkana
\XeTeXcharclass "30A5 = \XKsmallkana
\XeTeXcharclass "30A7 = \XKsmallkana
\XeTeXcharclass "30A9 = \XKsmallkana
\XeTeXcharclass "30C3 = \XKsmallkana
\XeTeXcharclass "30E3 = \XKsmallkana
\XeTeXcharclass "30E5 = \XKsmallkana
\XeTeXcharclass "30E7 = \XKsmallkana
\XeTeXcharclass "30EE = \XKsmallkana
\XeTeXcharclass "30F5 = \XKsmallkana
\XeTeXcharclass "30F6 = \XKsmallkana
\XeTeXcharclass "30FC = \XKsmallkana
\XK@assign@char@class{"31F0}{"31FF}\XKsmallkana
\XK@assign@char@class{"FF67}{"FF70}\XKsmallkana

%%% cjk colons
\newXeTeXintercharclass \XKcjkcolon
\XeTeXcharclass "00B7 = \XKcjkcolon % ·
\XeTeXcharclass "30FB = \XKcjkcolon % ・
\XeTeXcharclass "FF1A = \XKcjkcolon % ：
\XeTeXcharclass "FE13 = \XKcjkcolon % ︓
\XeTeXcharclass "FF1B = \XKcjkcolon % ；
\XeTeXcharclass "FE14 = \XKcjkcolon % ︔

%%% cjk fullstops
\newXeTeXintercharclass \XKcjkfullstop
\XeTeXcharclass "3002 = \XKcjkfullstop % 。
\XeTeXcharclass "FE12 = \XKcjkfullstop % ︒
\XeTeXcharclass "FF0E = \XKcjkfullstop % ．

%%% cjk liaisons
\newXeTeXintercharclass \XKcjkliaison
\XeTeXcharclass "2015 = \XKcjkliaison % ―
\XeTeXcharclass "2026 = \XKcjkliaison % …
\XeTeXcharclass "FE19 = \XKcjkliaison % ︙
\XeTeXcharclass "2025 = \XKcjkliaison % ‥
\XeTeXcharclass "FE30 = \XKcjkliaison % ︰

%%% cjk question/exclamation marks
\newXeTeXintercharclass \XKcjkextrastop
\XeTeXcharclass "FF1F = \XKcjkextrastop % ？
\XeTeXcharclass "FF01 = \XKcjkextrastop % ！

%%% other cjk symbols
\newXeTeXintercharclass \XKcjksymbol
%%  still missing:
%%    00AD ­
%%    0138 ĸ
%%    0149 ŉ
%%    0166 Ŧ
%%    0167 ŧ
%%    0370.. greek letters
%%    0400.. cyrillic letters
\XeTeXcharclass "00B2 = \XKcjksymbol % ²
\XeTeXcharclass "00B3 = \XKcjksymbol % ³
\XeTeXcharclass "00B9 = \XKcjksymbol % ¹
\XeTeXcharclass "00BC = \XKcjksymbol % ¼
\XeTeXcharclass "00BD = \XKcjksymbol % ½
\XeTeXcharclass "00BE = \XKcjksymbol % ¾
\XeTeXcharclass "02D0 = \XKcjksymbol % ː
\XeTeXcharclass "2032 = \XKcjksymbol % ′
\XeTeXcharclass "2033 = \XKcjksymbol % ″
\XeTeXcharclass "203B = \XKcjksymbol % ※
\XeTeXcharclass "2074 = \XKcjksymbol % ⁴
\XeTeXcharclass "207F = \XKcjksymbol % ⁿ
\XeTeXcharclass "2081 = \XKcjksymbol % ₁
\XeTeXcharclass "2082 = \XKcjksymbol % ₂
\XeTeXcharclass "2083 = \XKcjksymbol % ₃
\XeTeXcharclass "2084 = \XKcjksymbol % ₄
\XeTeXcharclass "2103 = \XKcjksymbol % ℃  changed from smallkana
\XeTeXcharclass "2109 = \XKcjksymbol % ℉  changed from smallkana
\XeTeXcharclass "2113 = \XKcjksymbol % ℓ  changed from smallkana
\XeTeXcharclass "2121 = \XKcjksymbol % ℡
\XeTeXcharclass "2122 = \XKcjksymbol % ™
\XeTeXcharclass "212B = \XKcjksymbol % Å  changed from smallkana
\XeTeXcharclass "2153 = \XKcjksymbol % ⅓
\XeTeXcharclass "2154 = \XKcjksymbol % ⅔
\XeTeXcharclass "215B = \XKcjksymbol % ⅛
\XeTeXcharclass "215C = \XKcjksymbol % ⅜
\XeTeXcharclass "215D = \XKcjksymbol % ⅝
\XeTeXcharclass "215E = \XKcjksymbol % ⅞
\XK@assign@char@class{"2160}{"216B}\XKcjksymbol % Ⅰ .. Ⅻ
\XK@assign@char@class{"2170}{"217B}\XKcjksymbol % ⅰ .. ⅻ
%% math symbols (?)
\XK@assign@char@class{"2190}{"2199}\XKcjksymbol % ← .. ↙
\XeTeXcharclass "21D2 = \XKcjksymbol % ⇒
\XeTeXcharclass "21D4 = \XKcjksymbol % ⇔
\XeTeXcharclass "2200 = \XKcjksymbol % ∀
\XeTeXcharclass "2202 = \XKcjksymbol % ∂
\XeTeXcharclass "2203 = \XKcjksymbol % ∃
\XeTeXcharclass "2207 = \XKcjksymbol % ∇
\XeTeXcharclass "2208 = \XKcjksymbol % ∈
\XeTeXcharclass "220B = \XKcjksymbol % ∋
\XeTeXcharclass "220F = \XKcjksymbol % ∏
\XeTeXcharclass "2211 = \XKcjksymbol % ∑
\XeTeXcharclass "221A = \XKcjksymbol % √
\XeTeXcharclass "221D = \XKcjksymbol % ∝
\XeTeXcharclass "2220 = \XKcjksymbol % ∠
\XeTeXcharclass "2225 = \XKcjksymbol % ∥
\XeTeXcharclass "2227 = \XKcjksymbol % ∧
\XeTeXcharclass "2228 = \XKcjksymbol % ∨
\XeTeXcharclass "2229 = \XKcjksymbol % ∩
\XeTeXcharclass "222A = \XKcjksymbol % ∪
\XeTeXcharclass "222B = \XKcjksymbol % ∫
\XeTeXcharclass "222C = \XKcjksymbol % ∬
\XeTeXcharclass "222E = \XKcjksymbol % ∮
\XeTeXcharclass "2234 = \XKcjksymbol % ∴
\XeTeXcharclass "2235 = \XKcjksymbol % ∵
\XeTeXcharclass "223C = \XKcjksymbol % ∼
\XeTeXcharclass "223D = \XKcjksymbol % ∽
\XeTeXcharclass "2252 = \XKcjksymbol % ≒
\XeTeXcharclass "2260 = \XKcjksymbol % ≠
\XeTeXcharclass "2261 = \XKcjksymbol % ≡
\XeTeXcharclass "2264 = \XKcjksymbol % ≤
\XeTeXcharclass "2265 = \XKcjksymbol % ≥
\XeTeXcharclass "226A = \XKcjksymbol % ≪
\XeTeXcharclass "226B = \XKcjksymbol % ≫
\XeTeXcharclass "2282 = \XKcjksymbol % ⊂
\XeTeXcharclass "2283 = \XKcjksymbol % ⊃
\XeTeXcharclass "2286 = \XKcjksymbol % ⊆
\XeTeXcharclass "2287 = \XKcjksymbol % ⊇
\XeTeXcharclass "2299 = \XKcjksymbol % ⊙
\XeTeXcharclass "22A5 = \XKcjksymbol % ⊥
\XeTeXcharclass "2312 = \XKcjksymbol % ⌒
\XK@assign@char@class{"2460}{"24EA}\XKcjksymbol % ① .. ⓪
\XeTeXcharclass "2500 = \XKcjksymbol % ─
\XeTeXcharclass "2501 = \XKcjksymbol % ━
\XeTeXcharclass "2502 = \XKcjksymbol % │
\XeTeXcharclass "2503 = \XKcjksymbol % ┃
\XK@assign@char@class{"250C}{"254B}\XKcjksymbol % ─ .. ╋
\XeTeXcharclass "2592 = \XKcjksymbol % ▒
\XeTeXcharclass "25A0 = \XKcjksymbol % ■
%\XeTeXcharclass "25A1 = \XKcjksymbol % □
\XeTeXcharclass "25A3 = \XKcjksymbol % ▣
\XeTeXcharclass "25A4 = \XKcjksymbol % ▤
\XeTeXcharclass "25A5 = \XKcjksymbol % ▥
\XeTeXcharclass "25A6 = \XKcjksymbol % ▦
\XeTeXcharclass "25A7 = \XKcjksymbol % ▧
\XeTeXcharclass "25A8 = \XKcjksymbol % ▨
\XeTeXcharclass "25A9 = \XKcjksymbol % ▩
\XeTeXcharclass "25B2 = \XKcjksymbol % ▲
\XeTeXcharclass "25B3 = \XKcjksymbol % △
\XeTeXcharclass "25B6 = \XKcjksymbol % ▶
\XeTeXcharclass "25B7 = \XKcjksymbol % ▷
\XeTeXcharclass "25BC = \XKcjksymbol % ▼
\XeTeXcharclass "25BD = \XKcjksymbol % ▽
\XeTeXcharclass "25C0 = \XKcjksymbol % ◀
\XeTeXcharclass "25C1 = \XKcjksymbol % ◁
\XeTeXcharclass "25C6 = \XKcjksymbol % ◆
\XeTeXcharclass "25C7 = \XKcjksymbol % ◇
\XeTeXcharclass "25C8 = \XKcjksymbol % ◈
\XeTeXcharclass "25CB = \XKcjksymbol % ○
\XeTeXcharclass "25CE = \XKcjksymbol % ◎
\XeTeXcharclass "25CF = \XKcjksymbol % ●
\XeTeXcharclass "25D0 = \XKcjksymbol % ◐
\XeTeXcharclass "25D1 = \XKcjksymbol % ◑
\XeTeXcharclass "2605 = \XKcjksymbol % ★
\XeTeXcharclass "2606 = \XKcjksymbol % ☆
\XeTeXcharclass "260E = \XKcjksymbol % ☎
\XeTeXcharclass "260F = \XKcjksymbol % ☏
\XeTeXcharclass "261C = \XKcjksymbol % ☜
\XeTeXcharclass "261E = \XKcjksymbol % ☞
\XeTeXcharclass "2640 = \XKcjksymbol % ♀
\XeTeXcharclass "2642 = \XKcjksymbol % ♂
\XeTeXcharclass "2660 = \XKcjksymbol % ♠
\XeTeXcharclass "2661 = \XKcjksymbol % ♡
\XeTeXcharclass "2663 = \XKcjksymbol % ♣
\XeTeXcharclass "2664 = \XKcjksymbol % ♤
\XeTeXcharclass "2665 = \XKcjksymbol % ♥
\XeTeXcharclass "2667 = \XKcjksymbol % ♧
\XeTeXcharclass "2668 = \XKcjksymbol % ♨
\XeTeXcharclass "2669 = \XKcjksymbol % ♩
\XeTeXcharclass "266A = \XKcjksymbol % ♪
\XeTeXcharclass "266C = \XKcjksymbol % ♬
\XeTeXcharclass "266D = \XKcjksymbol % ♭
\XeTeXcharclass "3012 = \XKcjksymbol % 〒
\XeTeXcharclass "301C = \XKcjksymbol % 〜
\XeTeXcharclass "FF04 = \XKcjksymbol % ＄
\XeTeXcharclass "FF05 = \XKcjksymbol % ％
\XeTeXcharclass "FF5E = \XKcjksymbol % ～
\XeTeXcharclass "FFE0 = \XKcjksymbol % ￠
\XeTeXcharclass "FFE1 = \XKcjksymbol % ￡
\XeTeXcharclass "FFE5 = \XKcjksymbol % ￥
\XeTeXcharclass "FFE6 = \XKcjksymbol % ￦

%%% hangul syllables
\newXeTeXintercharclass \XKhangulsyllable
\XK@assign@char@class{"AC00}{"D7A3}\XKhangulsyllable
% treat compatibility jamo as hangul syllable
\XK@assign@char@class{"3131}{"318E}\XKhangulsyllable
% leading consonants jamo as well
\XK@assign@char@class{"1100}{"115F}\XKhangulsyllable
\XK@assign@char@class{"A960}{"A97C}\XKhangulsyllable

%%% jungseong/jongseong jamo including tone marks
\newXeTeXintercharclass \XKhanguljungjong
\XK@assign@char@class{"1160}{"11FF}\XKhanguljungjong
\XK@assign@char@class{"D7B0}{"D7FB}\XKhanguljungjong
\XeTeXcharclass "302E = \XKhanguljungjong
\XeTeXcharclass "302F = \XKhanguljungjong

%%% latin openings
\newXeTeXintercharclass \XKlatinopening
\XeTeXcharclass`\(    = \XKlatinopening
\XeTeXcharclass`\[    = \XKlatinopening
\XeTeXcharclass`\{    = \XKlatinopening
\XeTeXcharclass`\<    = \XKlatinopening

%%% latin closings
\newXeTeXintercharclass \XKlatinclosing
\XeTeXcharclass`\)    = \XKlatinclosing
\XeTeXcharclass`\]    = \XKlatinclosing
\XeTeXcharclass`\}    = \XKlatinclosing
\XeTeXcharclass`\>    = \XKlatinclosing

%%% latin quotes
\newXeTeXintercharclass\XKopeningquote
\XeTeXcharclass`\`   = \XKopeningquote
\newXeTeXintercharclass\XKclosingquote
\XeTeXcharclass`\'   = \XKclosingquote
\XeTeXcharclass`\"   = \XKclosingquote

%%% latin full stop
\newXeTeXintercharclass \XKlatinfullstop
\XeTeXcharclass `\. = \XKlatinfullstop

%%% latin questions/exclamations
\newXeTeXintercharclass \XKlatinquestion
\XeTeXcharclass `\? = \XKlatinquestion
\newXeTeXintercharclass \XKlatinexclamation
\XeTeXcharclass `\! = \XKlatinexclamation

%%% latin hyphen including /
\newXeTeXintercharclass \XKlatinhyphen
\XeTeXcharclass `\- = \XKlatinhyphen % this affects -- --- ligatures
\XeTeXcharclass `\/ = \XKlatinhyphen

%%% latin comma
\newXeTeXintercharclass \XKlatincomma
\XeTeXcharclass `\, = \XKlatincomma

%%% latin colons
\newXeTeXintercharclass \XKlatincolon
\XeTeXcharclass `\:   = \XKlatincolon
\XeTeXcharclass `\;   = \XKlatincolon
\XeTeXcharclass "2013 = \XKlatincolon % – ? liaison
\XeTeXcharclass "2014 = \XKlatincolon % — ? liaison

%%% latin numbers
\newXeTeXintercharclass \XKlatinnumber
\XK@assign@char@class{`0}{`9}\XKlatinnumber

%%% variation selectors
\newXeTeXintercharclass \XKhanjacombining
\XK@assign@char@class{"FE00}{"FE0F}\XKhanjacombining
\XK@assign@char@class{"E0100}{"E01EF}\XKhanjacombining

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% define inter char tokes
%%% ? latin numbers
\XeTeXinterchartoks \XKlatinchar        \XKlatinnumber = {\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKlatinnumber      \XKlatinnumber = {\XKlastchar}
\XeTeXinterchartoks \XKlatinopening     \XKlatinnumber = {\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKlatinclosing     \XKlatinnumber = {\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKopeningquote     \XKlatinnumber = {\XKopeningquotestop\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKclosingquote     \XKlatinnumber = {\XKclosingquotestop\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKhanja            \XKlatinnumber = {\XKcjkcharboxstop\XKcjklatinsmallbreak\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKhanjacombining   \XKlatinnumber = {\XKcjkcharboxstop\XKcjklatinsmallbreak\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKsmallkana        \XKlatinnumber = {\XKcjkcharboxstop\XKcjklatinsmallbreak\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKcjksymbol        \XKlatinnumber = {\XKcjkcharboxstop\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKcjkopening       \XKlatinnumber = {\postcjkopenparen\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKcjkclosing       \XKlatinnumber = {\postcjkcloseparen\XKhalfsmallbreak\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKcjkcolon         \XKlatinnumber = {\postcjkcolon\XKquatersmallbreak\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKcjkfullstop      \XKlatinnumber = {\postcjkfullstop\XKfixedhalfskip\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKcjkliaison       \XKlatinnumber = {\XKcjkcharboxstop\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKcjkextrastop     \XKlatinnumber = {\XKcjkcharboxstop\XKhalfsmallbreak\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKhangulsyllable   \XKlatinnumber = {\XKcjkcharboxstop\XKcjklatinsmallbreak\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKhanguljungjong   \XKlatinnumber = {\XKcjkcharboxstop\XKcjklatinsmallbreak\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKlatinfullstop    \XKlatinnumber = {\XKperiodboxstop\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKlatinquestion    \XKlatinnumber = {\XKquestionboxstop\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKlatinexclamation \XKlatinnumber = {\XKexclamationboxstop\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKlatincomma       \XKlatinnumber = {\XKcommaboxstop\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKlatincolon       \XKlatinnumber = {\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKlatinhyphen      \XKlatinnumber = {\XKlatinnumfont\XKlastchar}
\XeTeXinterchartoks \XKboundary         \XKlatinnumber = {\XKundoignorespaces\XKlatinnumfont\XKbeginboundary\XKlastchar}

%%% ? latin alphabets
\XeTeXinterchartoks \XKlatinchar        \XKlatinchar = {\XKlastchar}
\XeTeXinterchartoks \XKlatinnumber      \XKlatinchar = {\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKlatinopening     \XKlatinchar = {\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKlatinclosing     \XKlatinchar = {\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKopeningquote     \XKlatinchar = {\XKopeningquotestop\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKclosingquote     \XKlatinchar = {\XKclosingquotestop\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKhanja            \XKlatinchar = {\XKcjkcharboxstop\XKcjklatinsmallbreak\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKhanjacombining   \XKlatinchar = {\XKcjkcharboxstop\XKcjklatinsmallbreak\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKsmallkana        \XKlatinchar = {\XKcjkcharboxstop\XKcjklatinsmallbreak\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKcjksymbol        \XKlatinchar = {\XKcjkcharboxstop\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKcjkopening       \XKlatinchar = {\postcjkopenparen\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKcjkclosing       \XKlatinchar = {\postcjkcloseparen\XKhalfsmallbreak\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKcjkcolon         \XKlatinchar = {\postcjkcolon\XKquatersmallbreak\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKcjkfullstop      \XKlatinchar = {\postcjkfullstop\XKfixedhalfskip\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKcjkliaison       \XKlatinchar = {\XKcjkcharboxstop\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKcjkextrastop     \XKlatinchar = {\XKcjkcharboxstop\XKhalfsmallbreak\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKhangulsyllable   \XKlatinchar = {\XKcjkcharboxstop\XKcjklatinsmallbreak\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKhanguljungjong   \XKlatinchar = {\XKcjkcharboxstop\XKcjklatinsmallbreak\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKlatinfullstop    \XKlatinchar = {\XKperiodboxstop\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKlatinquestion    \XKlatinchar = {\XKquestionboxstop\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKlatinexclamation \XKlatinchar = {\XKexclamationboxstop\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKlatincomma       \XKlatinchar = {\XKcommaboxstop\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKlatincolon       \XKlatinchar = {\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKlatinhyphen      \XKlatinchar = {\XKmaybelatinfont\XKlastchar}
\XeTeXinterchartoks \XKboundary         \XKlatinchar = {\XKundoignorespaces\XKmaybelatinfont\XKbeginboundary\XKlastchar}

%%% ? hanja
\XeTeXinterchartoks \XKlatinchar        \XKhanja = {\XKhanjafont\XKcjklatinsmallbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinnumber      \XKhanja = {\XKhanjafont\XKcjklatinsmallbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinopening     \XKhanja = {\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinclosing     \XKhanja = {\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKopeningquote     \XKhanja = {\XKopeningquotestop\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKclosingquote     \XKhanja = {\XKclosingquotestop\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKhanja            \XKhanja = {\XKcjkcharboxstop\XKinterhanjabreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKhanjacombining   \XKhanja = {\XKcjkcharboxstop\XKinterhanjabreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKsmallkana        \XKhanja = {\XKcjkcharboxstop\XKinterhanjabreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjksymbol        \XKhanja = {\XKcjkcharboxstop\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkopening       \XKhanja = {\postcjkopenparen\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkclosing       \XKhanja = {\postcjkcloseparen\XKhalfsmallbreak\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkcolon         \XKhanja = {\postcjkcolon\XKquatersmallbreak\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkfullstop      \XKhanja = {\postcjkfullstop\XKfixedhalfskip\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkliaison       \XKhanja = {\XKcjkcharboxstop\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkextrastop     \XKhanja = {\XKcjkcharboxstop\XKhalfsmallbreak\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKhangulsyllable   \XKhanja = {\XKcjkcharboxstop\XKhanjafont\XKinterhanjabreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKhanguljungjong   \XKhanja = {\XKcjkcharboxstop\XKhanjafont\XKinterhanjabreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinfullstop    \XKhanja = {\XKperiodboxstop\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinquestion    \XKhanja = {\XKquestionboxstop\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinexclamation \XKhanja = {\XKexclamationboxstop\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatincomma       \XKhanja = {\XKcommaboxstop\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatincolon       \XKhanja = {\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinhyphen      \XKhanja = {\XKhanjafont\XKzeroskip\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKboundary         \XKhanja = {\XKhanjafont\XKafterboundaryskip\XKbeginboundary\XKcjkcharboxstart\XKhanjalastchar}

%%% ? small kana
\XeTeXinterchartoks \XKlatinchar        \XKsmallkana = {\XKhanjafont\XKcjklatinsmallbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinnumber      \XKsmallkana = {\XKhanjafont\XKcjklatinsmallbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinopening     \XKsmallkana = {\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinclosing     \XKsmallkana = {\XKhanjafont\XKcjklatinsmallbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKopeningquote     \XKsmallkana = {\XKopeningquotestop\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKclosingquote     \XKsmallkana = {\XKclosingquotestop\XKhanjafont\XKcjklatinsmallbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKhanja            \XKsmallkana = {\XKcjkcharboxstop\XKnobreak\XKzeroskip\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKhanjacombining   \XKsmallkana = {\XKcjkcharboxstop\XKnobreak\XKzeroskip\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKsmallkana        \XKsmallkana = {\XKcjkcharboxstop\XKnobreak\XKzeroskip\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjksymbol        \XKsmallkana = {\XKcjkcharboxstop\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkopening       \XKsmallkana = {\postcjkopenparen\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkclosing       \XKsmallkana = {\postcjkcloseparen\XKhalfsmallbreak\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkcolon         \XKsmallkana = {\postcjkcolon\XKquatersmallbreak\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkfullstop      \XKsmallkana = {\postcjkfullstop\XKfixedhalfskip\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkliaison       \XKsmallkana = {\XKcjkcharboxstop\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKcjkextrastop     \XKsmallkana = {\XKcjkcharboxstop\XKhalfsmallbreak\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKhangulsyllable   \XKsmallkana = {\XKcjkcharboxstop\XKhanjafont\XKinterhanjabreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKhanguljungjong   \XKsmallkana = {\XKcjkcharboxstop\XKhanjafont\XKinterhanjabreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinfullstop    \XKsmallkana = {\XKperiodboxstop\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinquestion    \XKsmallkana = {\XKquestionboxstop\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinexclamation \XKsmallkana = {\XKexclamationboxstop\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatincomma       \XKsmallkana = {\XKcommaboxstop\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatincolon       \XKsmallkana = {\XKhanjafont\XKcjklatinbreak\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKlatinhyphen      \XKsmallkana = {\XKhanjafont\XKcjkcharboxstart\XKhanjalastchar}
\XeTeXinterchartoks \XKboundary         \XKsmallkana = {\XKhanjafont\XKafterboundaryskip\XKbeginboundary\XKcjkcharboxstart\XKhanjalastchar}

%%% ? cjk symbols
\XeTeXinterchartoks \XKlatinchar        \XKcjksymbol = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinnumber      \XKcjksymbol = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinopening     \XKcjksymbol = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinclosing     \XKcjksymbol = {\XKmaybehanjafont\XKcjklatinsmallbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKopeningquote     \XKcjksymbol = {\XKopeningquotestop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKclosingquote     \XKcjksymbol = {\XKclosingquotestop\XKmaybehanjafont\XKcjklatinsmallbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKhanja            \XKcjksymbol = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKhanjacombining   \XKcjksymbol = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKsmallkana        \XKcjksymbol = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
%\XeTeXinterchartoks \XKcjksymbol        \XKcjksymbol = {}
\XeTeXinterchartoks \XKcjkopening       \XKcjksymbol = {\postcjkopenparen\XKcjkcharboxstart}
\XeTeXinterchartoks \XKcjkclosing       \XKcjksymbol = {\postcjkcloseparen\XKhalfsmallbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKcjkcolon         \XKcjksymbol = {\postcjkcolon\XKquatersmallbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKcjkfullstop      \XKcjksymbol = {\postcjkfullstop\XKfixedhalfskip\XKcjkcharboxstart}
%\XeTeXinterchartoks \XKcjkliaison       \XKcjksymbol = {}
\XeTeXinterchartoks \XKcjkextrastop     \XKcjksymbol = {\XKcjkcharboxstop\XKhalfsmallbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKhangulsyllable   \XKcjksymbol = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKhanguljungjong   \XKcjksymbol = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinfullstop    \XKcjksymbol = {\XKperiodboxstop\XKmaybehanjafont\XKcjklatinbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinquestion    \XKcjksymbol = {\XKquestionboxstop\XKmaybehanjafont\XKcjklatinbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinexclamation \XKcjksymbol = {\XKexclamationboxstop\XKmaybehanjafont\XKcjklatinbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatincomma       \XKcjksymbol = {\XKcommaboxstop\XKmaybehanjafont\XKcjklatinbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatincolon       \XKcjksymbol = {\XKmaybehanjafont\XKcjklatinbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinhyphen      \XKcjksymbol = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKboundary         \XKcjksymbol = {\XKmaybehanjafont\XKafterboundaryskip\XKbeginboundary\XKcjkcharboxstart}

%%% ? cjk openings
\XeTeXinterchartoks \XKlatinchar        \XKcjkopening = {\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKlatinnumber      \XKcjkopening = {\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKlatinopening     \XKcjkopening = {\XKmaybehanjafont\precjkopenparen}
\XeTeXinterchartoks \XKlatinclosing     \XKcjkopening = {\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKopeningquote     \XKcjkopening = {\XKopeningquotestop\XKmaybehanjafont\precjkopenparen}
\XeTeXinterchartoks \XKclosingquote     \XKcjkopening = {\XKclosingquotestop\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKhanja            \XKcjkopening = {\XKcjkcharboxstop\XKhalfsmallbreak\XKmaybehanjafont\precjkopenparen}
\XeTeXinterchartoks \XKhanjacombining   \XKcjkopening = {\XKcjkcharboxstop\XKhalfsmallbreak\XKmaybehanjafont\precjkopenparen}
\XeTeXinterchartoks \XKsmallkana        \XKcjkopening = {\XKcjkcharboxstop\XKhalfsmallbreak\XKmaybehanjafont\precjkopenparen}
\XeTeXinterchartoks \XKcjksymbol        \XKcjkopening = {\XKcjkcharboxstop\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKcjkopening       \XKcjkopening = {\postcjkopenparen\precjkopenparen}
\XeTeXinterchartoks \XKcjkclosing       \XKcjkopening = {\postcjkcloseparen\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKcjkcolon         \XKcjkopening = {\postcjkcolon\XKquatersmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKcjkfullstop      \XKcjkopening = {\postcjkfullstop\XKfixedhalfskip\precjkopenparen}
\XeTeXinterchartoks \XKcjkliaison       \XKcjkopening = {\XKcjkcharboxstop\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKcjkextrastop     \XKcjkopening = {\XKcjkcharboxstop\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKhangulsyllable   \XKcjkopening = {\XKcjkcharboxstop\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKhanguljungjong   \XKcjkopening = {\XKcjkcharboxstop\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKlatinfullstop    \XKcjkopening = {\XKperiodboxstop\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKlatinquestion    \XKcjkopening = {\XKquestionboxstop\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKlatinexclamation \XKcjkopening = {\XKexclamationboxstop\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKlatincomma       \XKcjkopening = {\XKcommaboxstop\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKlatincolon       \XKcjkopening = {\XKmaybehanjafont\XKhalfsmallbreak\precjkopenparen}
\XeTeXinterchartoks \XKlatinhyphen      \XKcjkopening = {\XKmaybehanjafont\XKzeroskip\precjkopenparen}
\XeTeXinterchartoks \XKboundary         \XKcjkopening = {\XKmaybehanjafont\XKafterboundaryskip\XKbeginboundary\precjkopenparen}

%%% ? cjk closings
\XeTeXinterchartoks \XKlatinchar        \XKcjkclosing = {\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKlatinnumber      \XKcjkclosing = {\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKlatinopening     \XKcjkclosing = {\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKlatinclosing     \XKcjkclosing = {\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKopeningquote     \XKcjkclosing = {\XKopeningquotestop\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKclosingquote     \XKcjkclosing = {\XKclosingquotestop\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKhanja            \XKcjkclosing = {\XKcjkcharboxstop\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKhanjacombining   \XKcjkclosing = {\XKcjkcharboxstop\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKsmallkana        \XKcjkclosing = {\XKcjkcharboxstop\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKcjksymbol        \XKcjkclosing = {\XKcjkcharboxstop\precjkcloseparen}
\XeTeXinterchartoks \XKcjkopening       \XKcjkclosing = {\postcjkopenparen\precjkcloseparen}
\XeTeXinterchartoks \XKcjkclosing       \XKcjkclosing = {\postcjkcloseparen\precjkcloseparen}
\XeTeXinterchartoks \XKcjkcolon         \XKcjkclosing = {\postcjkcolon\XKnobreak\XKquatersmallbreak\precjkcloseparen}
\XeTeXinterchartoks \XKcjkfullstop      \XKcjkclosing = {\postcjkfullstop\precjkcloseparen}
\XeTeXinterchartoks \XKcjkliaison       \XKcjkclosing = {\XKcjkcharboxstop\precjkcloseparen}
\XeTeXinterchartoks \XKcjkextrastop     \XKcjkclosing = {\XKcjkcharboxstop\precjkcloseparen}
\XeTeXinterchartoks \XKhangulsyllable   \XKcjkclosing = {\XKcjkcharboxstop\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKhanguljungjong   \XKcjkclosing = {\XKcjkcharboxstop\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKlatinfullstop    \XKcjkclosing = {\XKperiodboxstop\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKlatinquestion    \XKcjkclosing = {\XKquestionboxstop\XKmaybehanjafont\XKnobreak\XKcjklatinbreak\precjkcloseparen}
\XeTeXinterchartoks \XKlatinexclamation \XKcjkclosing = {\XKexclamationboxstop\XKmaybehanjafont\XKnobreak\XKcjklatinbreak\precjkcloseparen}
\XeTeXinterchartoks \XKlatincomma       \XKcjkclosing = {\XKcommaboxstop\XKmaybehanjafont\XKnobreak\XKcjklatinbreak\precjkcloseparen}
\XeTeXinterchartoks \XKlatincolon       \XKcjkclosing = {\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKlatinhyphen      \XKcjkclosing = {\XKmaybehanjafont\precjkcloseparen}
\XeTeXinterchartoks \XKboundary         \XKcjkclosing = {\XKmaybehanjafont\XKbeginboundary\precjkcloseparen}

%%% ? latin openings
\XeTeXinterchartoks \XKlatinchar        \XKlatinopening = {\XKwaslatinchar\XKlatinparenfont}
\XeTeXinterchartoks \XKlatinnumber      \XKlatinopening = {\XKwaslatinchar\XKlatinparenfont}
%\XeTeXinterchartoks \XKlatinopening     \XKlatinopening = {}
%\XeTeXinterchartoks \XKlatinclosing     \XKlatinopening = {}
\XeTeXinterchartoks \XKopeningquote     \XKlatinopening = {\XKopeningquotestop\XKlatinparenfont}
\XeTeXinterchartoks \XKclosingquote     \XKlatinopening = {\XKclosingquotestop\XKzeroskip\XKlatinparenfont}
\XeTeXinterchartoks \XKhanja            \XKlatinopening = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKhanjacombining   \XKlatinopening = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKsmallkana        \XKlatinopening = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjksymbol        \XKlatinopening = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkopening       \XKlatinopening = {\postcjkopenparen\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkclosing       \XKlatinopening = {\postcjkcloseparen\XKhalfsmallbreak\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkcolon         \XKlatinopening = {\postcjkcolon\XKquatersmallbreak\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkfullstop      \XKlatinopening = {\postcjkfullstop\XKfixedhalfskip\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkliaison       \XKlatinopening = {\XKcjkcharboxstop\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkextrastop     \XKlatinopening = {\XKcjkcharboxstop\XKhalfsmallbreak\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKhangulsyllable   \XKlatinopening = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKhanguljungjong   \XKlatinopening = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKlatinfullstop    \XKlatinopening = {\XKperiodboxstop\XKlatinparenfont}
\XeTeXinterchartoks \XKlatinquestion    \XKlatinopening = {\XKquestionboxstop\XKlatinparenfont}
\XeTeXinterchartoks \XKlatinexclamation \XKlatinopening = {\XKexclamationboxstop\XKlatinparenfont}
\XeTeXinterchartoks \XKlatincomma       \XKlatinopening = {\XKcommaboxstop\XKlatinparenfont}
\XeTeXinterchartoks \XKlatincolon       \XKlatinopening = {\XKlatinparenfont}
\XeTeXinterchartoks \XKlatinhyphen      \XKlatinopening = {\XKlatinparenfont}
\XeTeXinterchartoks \XKboundary         \XKlatinopening = {\XKundoignorespaces\XKlatinparenfont\XKbeginboundary}

%%% ? latin opening quote `
\XeTeXinterchartoks \XKlatinchar        \XKopeningquote = {\XKwaslatinchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKlatinnumber      \XKopeningquote = {\XKwaslatinchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKlatinopening     \XKopeningquote = {\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKlatinclosing     \XKopeningquote = {\XKlatinquotefont\XKopeningquotestart}
%\XeTeXinterchartoks \XKopeningquote     \XKopeningquote = {}
\XeTeXinterchartoks \XKclosingquote     \XKopeningquote = {\XKclosingquotestop\XKopeningquotestart}
\XeTeXinterchartoks \XKhanja            \XKopeningquote = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKhanjacombining   \XKopeningquote = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKsmallkana        \XKopeningquote = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKcjksymbol        \XKopeningquote = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKcjkopening       \XKopeningquote = {\postcjkopenparen\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKcjkclosing       \XKopeningquote = {\postcjkcloseparen\XKhalfsmallbreak\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKcjkcolon         \XKopeningquote = {\postcjkcolon\XKquatersmallbreak\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKcjkfullstop      \XKopeningquote = {\postcjkfullstop\XKfixedhalfskip\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKcjkliaison       \XKopeningquote = {\XKcjkcharboxstop\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKcjkextrastop     \XKopeningquote = {\XKcjkcharboxstop\XKhalfsmallbreak\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKhangulsyllable   \XKopeningquote = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKhanguljungjong   \XKopeningquote = {\XKcjkcharboxstop\XKcjklatinbreak\XKwascjkchar\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKlatinfullstop    \XKopeningquote = {\XKperiodboxstop\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKlatinquestion    \XKopeningquote = {\XKquestionboxstop\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKlatinexclamation \XKopeningquote = {\XKexclamationboxstop\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKlatincomma       \XKopeningquote = {\XKcommaboxstop\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKlatincolon       \XKopeningquote = {\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKlatinhyphen      \XKopeningquote = {\XKlatinquotefont\XKopeningquotestart}
\XeTeXinterchartoks \XKboundary         \XKopeningquote = {\XKundoignorespaces\XKlatinquotefont\XKbeginboundary\XKopeningquotestart}

%%% ? latin closings
\XeTeXinterchartoks \XKlatinchar        \XKlatinclosing = {\XKwaslatinchar\XKlatinparenfont}
\XeTeXinterchartoks \XKlatinnumber      \XKlatinclosing = {\XKwaslatinchar\XKlatinparenfont}
%\XeTeXinterchartoks \XKlatinopening     \XKlatinclosing = {}
%\XeTeXinterchartoks \XKlatinclosing     \XKlatinclosing = {}
\XeTeXinterchartoks \XKopeningquote     \XKlatinclosing = {\XKopeningquotestop\XKlatinparenfont}
\XeTeXinterchartoks \XKclosingquote     \XKlatinclosing = {\XKclosingquotestop\XKlatinparenfont}
\XeTeXinterchartoks \XKhanja            \XKlatinclosing = {\XKcjkcharboxstop\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKhanjacombining   \XKlatinclosing = {\XKcjkcharboxstop\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKsmallkana        \XKlatinclosing = {\XKcjkcharboxstop\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjksymbol        \XKlatinclosing = {\XKcjkcharboxstop\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkopening       \XKlatinclosing = {\postcjkopenparen\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkclosing       \XKlatinclosing = {\postcjkcloseparen\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkcolon         \XKlatinclosing = {\postcjkcolon\XKnobreak\XKquatersmallbreak\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkfullstop      \XKlatinclosing = {\postcjkfullstop\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkliaison       \XKlatinclosing = {\XKcjkcharboxstop\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKcjkextrastop     \XKlatinclosing = {\XKcjkcharboxstop\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKhangulsyllable   \XKlatinclosing = {\XKcjkcharboxstop\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKhanguljungjong   \XKlatinclosing = {\XKcjkcharboxstop\XKwascjkchar\XKlatinparenfont}
\XeTeXinterchartoks \XKlatinfullstop    \XKlatinclosing = {\XKperiodboxstop\XKlatinparenfont}
\XeTeXinterchartoks \XKlatinquestion    \XKlatinclosing = {\XKquestionboxstop\XKlatinparenfont}
\XeTeXinterchartoks \XKlatinexclamation \XKlatinclosing = {\XKexclamationboxstop\XKlatinparenfont}
\XeTeXinterchartoks \XKlatincomma       \XKlatinclosing = {\XKcommaboxstop\XKlatinparenfont}
\XeTeXinterchartoks \XKlatincolon       \XKlatinclosing = {\XKlatinparenfont}
\XeTeXinterchartoks \XKlatinhyphen      \XKlatinclosing = {\XKlatinparenfont}
\XeTeXinterchartoks \XKboundary         \XKlatinclosing = {\XKundoignorespaces\XKlatinparenfont\XKbeginboundary}

%%% ? latin closing quote '
\XeTeXinterchartoks \XKlatinchar        \XKclosingquote = {\XKwaslatinchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKlatinnumber      \XKclosingquote = {\XKwaslatinchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKlatinopening     \XKclosingquote = {\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKlatinclosing     \XKclosingquote = {\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKopeningquote     \XKclosingquote = {\XKopeningquotestop\XKclosingquotestart}
%\XeTeXinterchartoks \XKclosingquote     \XKclosingquote = {}
\XeTeXinterchartoks \XKhanja            \XKclosingquote = {\XKcjkcharboxstop\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKhanjacombining   \XKclosingquote = {\XKcjkcharboxstop\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKsmallkana        \XKclosingquote = {\XKcjkcharboxstop\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKcjksymbol        \XKclosingquote = {\XKcjkcharboxstop\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKcjkopening       \XKclosingquote = {\postcjkopenparen\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKcjkclosing       \XKclosingquote = {\postcjkcloseparen\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKcjkcolon         \XKclosingquote = {\postcjkcolon\XKnobreak\XKquatersmallbreak\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKcjkfullstop      \XKclosingquote = {\postcjkfullstop\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKcjkliaison       \XKclosingquote = {\XKcjkcharboxstop\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKcjkextrastop     \XKclosingquote = {\XKcjkcharboxstop\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKhangulsyllable   \XKclosingquote = {\XKcjkcharboxstop\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKhanguljungjong   \XKclosingquote = {\XKcjkcharboxstop\XKwascjkchar\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKlatinfullstop    \XKclosingquote = {\XKperiodboxstop\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKlatinquestion    \XKclosingquote = {\XKquestionboxstop\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKlatinexclamation \XKclosingquote = {\XKexclamationboxstop\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKlatincomma       \XKclosingquote = {\XKcommaboxstop\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKlatincolon       \XKclosingquote = {\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKlatinhyphen      \XKclosingquote = {\XKlatinquotefont\XKclosingquotestart}
\XeTeXinterchartoks \XKboundary         \XKclosingquote = {\XKundoignorespaces\XKlatinquotefont\XKbeginboundary\XKclosingquotestart}

%%% ? latin colon
\XeTeXinterchartoks \XKlatinchar        \XKlatincolon = {\XKwaslatinchar\XKcolonfont}
\XeTeXinterchartoks \XKlatinnumber      \XKlatincolon = {\XKwaslatinchar\XKcolonfont}
\XeTeXinterchartoks \XKlatinopening     \XKlatincolon = {\XKcolonfont}
\XeTeXinterchartoks \XKlatinclosing     \XKlatincolon = {\XKcolonfont}
\XeTeXinterchartoks \XKopeningquote     \XKlatincolon = {\XKopeningquotestop\XKcolonfont}
\XeTeXinterchartoks \XKclosingquote     \XKlatincolon = {\XKclosingquotestop\XKcolonfont}
\XeTeXinterchartoks \XKhanja            \XKlatincolon = {\XKcjkcharboxstop\XKnobreak\XKcjklatinbreak\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKhanjacombining   \XKlatincolon = {\XKcjkcharboxstop\XKnobreak\XKcjklatinbreak\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKsmallkana        \XKlatincolon = {\XKcjkcharboxstop\XKnobreak\XKcjklatinbreak\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKcjksymbol        \XKlatincolon = {\XKcjkcharboxstop\XKnobreak\XKcjklatinbreak\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKcjkopening       \XKlatincolon = {\postcjkopenparen\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKcjkclosing       \XKlatincolon = {\postcjkcloseparen\XKnobreak\XKhalfsmallbreak\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKcjkcolon         \XKlatincolon = {\postcjkcolon\XKnobreak\XKquatersmallbreak\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKcjkfullstop      \XKlatincolon = {\postcjkfullstop\XKnobreak\XKfixedhalfskip\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKcjkliaison       \XKlatincolon = {\XKcjkcharboxstop\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKcjkextrastop     \XKlatincolon = {\XKcjkcharboxstop\XKnobreak\XKhalfsmallbreak\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKhangulsyllable   \XKlatincolon = {\XKcjkcharboxstop\XKnobreak\XKcjklatinbreak\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKhanguljungjong   \XKlatincolon = {\XKcjkcharboxstop\XKnobreak\XKcjklatinbreak\XKwascjkchar\XKcolonfont}
\XeTeXinterchartoks \XKlatinfullstop    \XKlatincolon = {\XKperiodboxstop\XKcolonfont}
\XeTeXinterchartoks \XKlatinquestion    \XKlatincolon = {\XKquestionboxstop\XKcolonfont}
\XeTeXinterchartoks \XKlatinexclamation \XKlatincolon = {\XKexclamationboxstop\XKcolonfont}
\XeTeXinterchartoks \XKlatincomma       \XKlatincolon = {\XKcommaboxstop\XKcolonfont}
%\XeTeXinterchartoks \XKlatincolon       \XKlatincolon = {}
\XeTeXinterchartoks \XKlatinhyphen      \XKlatincolon = {\XKcolonfont}
\XeTeXinterchartoks \XKboundary         \XKlatincolon = {\XKundoignorespaces\XKcolonfont\XKbeginboundary}

%%% ? hangul syllables
\XeTeXinterchartoks \XKlatinchar        \XKhangulsyllable = {\XKhangulfont\XKcjklatinsmallbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKlatinnumber      \XKhangulsyllable = {\XKhangulfont\XKcjklatinsmallbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKlatinopening     \XKhangulsyllable = {\XKhangulfont\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKlatinclosing     \XKhangulsyllable = {\XKhangulfont\XKcjklatinbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKopeningquote     \XKhangulsyllable = {\XKopeningquotestop\XKhangulfont\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKclosingquote     \XKhangulsyllable = {\XKclosingquotestop\XKhangulfont\XKcjklatinbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKhanja            \XKhangulsyllable = {\XKcjkcharboxstop\XKhangulfont\XKinterhanjabreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKhanjacombining   \XKhangulsyllable = {\XKcjkcharboxstop\XKhangulfont\XKinterhanjabreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKsmallkana        \XKhangulsyllable = {\XKcjkcharboxstop\XKhangulfont\XKinterhanjabreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKcjksymbol        \XKhangulsyllable = {\XKcjkcharboxstop\XKhangulfont\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKcjkopening       \XKhangulsyllable = {\postcjkopenparen\XKhangulfont\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKcjkclosing       \XKhangulsyllable = {\postcjkcloseparen\XKhangulfont\XKhalfsmallbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKcjkcolon         \XKhangulsyllable = {\postcjkcolon\XKhangulfont\XKquatersmallbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKcjkfullstop      \XKhangulsyllable = {\postcjkfullstop\XKhangulfont\XKfixedhalfskip\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKcjkliaison       \XKhangulsyllable = {\XKcjkcharboxstop\XKhangulfont\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKcjkextrastop     \XKhangulsyllable = {\XKcjkcharboxstop\XKhangulfont\XKhalfsmallbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKhangulsyllable   \XKhangulsyllable = {\XKcjkcharboxstop\XKinterhangulbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKhanguljungjong   \XKhangulsyllable = {\XKcjkcharboxstop\XKinterhangulbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKlatinfullstop    \XKhangulsyllable = {\XKperiodboxstop\XKhangulfont\XKcjklatinbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKlatinquestion    \XKhangulsyllable = {\XKquestionboxstop\XKhangulfont\XKcjklatinbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKlatinexclamation \XKhangulsyllable = {\XKexclamationboxstop\XKhangulfont\XKcjklatinbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKlatincomma       \XKhangulsyllable = {\XKcommaboxstop\XKhangulfont\XKcjklatinbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKlatincolon       \XKhangulsyllable = {\XKhangulfont\XKcjklatinbreak\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKlatinhyphen      \XKhangulsyllable = {\XKhangulfont\XKzeroskip\XKcjkcharboxstart\XKcjklastchar}
\XeTeXinterchartoks \XKboundary         \XKhangulsyllable = {\XKhangulfont\XKafterboundaryskip\XKbeginboundary\XKcjkcharboxstart\XKcjklastchar}

%%% ? jungseong/jongseong jamo
\XeTeXinterchartoks \XKhangulsyllable   \XKhanguljungjong = {\XKlastchar}
\XeTeXinterchartoks \XKhanguljungjong   \XKhanguljungjong = {\XKlastchar}

%%% ? latin period [.]
\XeTeXinterchartoks \XKlatinchar        \XKlatinfullstop = {\XKwaslatinchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKlatinnumber      \XKlatinfullstop = {\XKwaslatinchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKlatinopening     \XKlatinfullstop = {\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKlatinclosing     \XKlatinfullstop = {\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKopeningquote     \XKlatinfullstop = {\XKopeningquotestop\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKclosingquote     \XKlatinfullstop = {\XKclosingquotestop\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKhanja            \XKlatinfullstop = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKhanjacombining   \XKlatinfullstop = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKsmallkana        \XKlatinfullstop = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKcjksymbol        \XKlatinfullstop = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKcjkopening       \XKlatinfullstop = {\postcjkopenparen \XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKcjkclosing       \XKlatinfullstop = {\postcjkcloseparen\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKcjkcolon         \XKlatinfullstop = {\postcjkcolon\XKnobreak\XKquatersmallbreak\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKcjkfullstop      \XKlatinfullstop = {\postcjkfullstop\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKcjkliaison       \XKlatinfullstop = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKcjkextrastop     \XKlatinfullstop = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKhangulsyllable   \XKlatinfullstop = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKhanguljungjong   \XKlatinfullstop = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKperiodboxstart}
%\XeTeXinterchartoks \XKlatinfullstop    \XKlatinfullstop = {}
%\XeTeXinterchartoks \XKlatinquestion    \XKlatinfullstop = {}
%\XeTeXinterchartoks \XKlatinexclamation \XKlatinfullstop = {}
%\XeTeXinterchartoks \XKlatincomma       \XKlatinfullstop = {}
\XeTeXinterchartoks \XKlatincolon       \XKlatinfullstop = {\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKlatinhyphen      \XKlatinfullstop = {\XKpunctsfont\XKperiodboxstart}
\XeTeXinterchartoks \XKboundary         \XKlatinfullstop = {\XKundoignorespaces\XKpunctsfont\XKbeginboundary\XKperiodboxstart}

%%% ? latin question
\XeTeXinterchartoks \XKlatinchar        \XKlatinquestion  = {\XKwaslatinchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKlatinnumber      \XKlatinquestion  = {\XKwaslatinchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKlatinopening     \XKlatinquestion  = {\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKlatinclosing     \XKlatinquestion  = {\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKopeningquote     \XKlatinquestion  = {\XKopeningquotestop\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKclosingquote     \XKlatinquestion  = {\XKclosingquotestop\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKhanja            \XKlatinquestion  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKhanjacombining   \XKlatinquestion  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKsmallkana        \XKlatinquestion  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKcjksymbol        \XKlatinquestion  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKcjkopening       \XKlatinquestion  = {\postcjkopenparen\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKcjkclosing       \XKlatinquestion  = {\postcjkcloseparen\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKcjkcolon         \XKlatinquestion  = {\postcjkcolon\XKnobreak\XKquatersmallbreak\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKcjkfullstop      \XKlatinquestion  = {\postcjkfullstop\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKcjkliaison       \XKlatinquestion  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKcjkextrastop     \XKlatinquestion  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKhangulsyllable   \XKlatinquestion  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKhanguljungjong   \XKlatinquestion  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKquestionboxstart}
%\XeTeXinterchartoks \XKlatinfullstop    \XKlatinquestion  = {}
%\XeTeXinterchartoks \XKlatinquestion    \XKlatinquestion  = {}
%\XeTeXinterchartoks \XKlatinexclamation \XKlatinquestion  = {}
%\XeTeXinterchartoks \XKlatincomma       \XKlatinquestion  = {}
\XeTeXinterchartoks \XKlatincolon       \XKlatinquestion  = {\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKlatinhyphen      \XKlatinquestion  = {\XKpunctsfont\XKquestionboxstart}
\XeTeXinterchartoks \XKboundary         \XKlatinquestion  = {\XKundoignorespaces\XKpunctsfont\XKbeginboundary\XKquestionboxstart}

%%% ? latin exclamation
\XeTeXinterchartoks \XKlatinchar        \XKlatinexclamation  = {\XKwaslatinchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKlatinnumber      \XKlatinexclamation  = {\XKwaslatinchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKlatinopening     \XKlatinexclamation  = {\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKlatinclosing     \XKlatinexclamation  = {\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKopeningquote     \XKlatinexclamation  = {\XKopeningquotestop\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKclosingquote     \XKlatinexclamation  = {\XKclosingquotestop\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKhanja            \XKlatinexclamation  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKhanjacombining   \XKlatinexclamation  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKsmallkana        \XKlatinexclamation  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKcjksymbol        \XKlatinexclamation  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKcjkopening       \XKlatinexclamation  = {\postcjkopenparen\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKcjkclosing       \XKlatinexclamation  = {\postcjkcloseparen\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKcjkcolon         \XKlatinexclamation  = {\postcjkcolon\XKnobreak\XKquatersmallbreak\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKcjkfullstop      \XKlatinexclamation  = {\postcjkfullstop\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKcjkliaison       \XKlatinexclamation  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKcjkextrastop     \XKlatinexclamation  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKhangulsyllable   \XKlatinexclamation  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKhanguljungjong   \XKlatinexclamation  = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKexclamationboxstart}
%\XeTeXinterchartoks \XKlatinfullstop    \XKlatinexclamation  = {}
%\XeTeXinterchartoks \XKlatinquestion    \XKlatinexclamation  = {}
%\XeTeXinterchartoks \XKlatinexclamation \XKlatinexclamation  = {}
%\XeTeXinterchartoks \XKlatincomma       \XKlatinexclamation  = {}
\XeTeXinterchartoks \XKlatincolon       \XKlatinexclamation  = {\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKlatinhyphen      \XKlatinexclamation  = {\XKpunctsfont\XKexclamationboxstart}
\XeTeXinterchartoks \XKboundary         \XKlatinexclamation  = {\XKundoignorespaces\XKpunctsfont\XKbeginboundary\XKexclamationboxstart}

% ? latin comma
\XeTeXinterchartoks \XKlatinchar        \XKlatincomma = {\XKwaslatinchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKlatinnumber      \XKlatincomma = {\XKwaslatinchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKlatinopening     \XKlatincomma = {\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKlatinclosing     \XKlatincomma = {\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKopeningquote     \XKlatincomma = {\XKopeningquotestop\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKclosingquote     \XKlatincomma = {\XKclosingquotestop\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKhanja            \XKlatincomma = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKhanjacombining   \XKlatincomma = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKsmallkana        \XKlatincomma = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKcjksymbol        \XKlatincomma = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKcjkopening       \XKlatincomma = {\postcjkopenparen\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKcjkclosing       \XKlatincomma = {\postcjkcloseparen\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKcjkcolon         \XKlatincomma = {\postcjkcolon\XKnobreak\XKquatersmallbreak\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKcjkfullstop      \XKlatincomma = {\postcjkfullstop\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKcjkliaison       \XKlatincomma = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKcjkextrastop     \XKlatincomma = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKhangulsyllable   \XKlatincomma = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKhanguljungjong   \XKlatincomma = {\XKcjkcharboxstop\XKwascjkchar\XKpunctsfont\XKcommaboxstart}
%\XeTeXinterchartoks \XKlatinfullstop    \XKlatincomma = {}
%\XeTeXinterchartoks \XKlatinquestion    \XKlatincomma = {}
%\XeTeXinterchartoks \XKlatinexclamation \XKlatincomma = {}
%\XeTeXinterchartoks \XKlatincomma       \XKlatincomma = {}
\XeTeXinterchartoks \XKlatincolon       \XKlatincomma = {\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKlatinhyphen      \XKlatincomma = {\XKpunctsfont\XKcommaboxstart}
\XeTeXinterchartoks \XKboundary         \XKlatincomma = {\XKundoignorespaces\XKpunctsfont\XKbeginboundary\XKcommaboxstart}

%%% ? latin hyphens [-/]
\XeTeXinterchartoks \XKlatinchar        \XKlatinhyphen = {\XKwaslatinchar\XKhyphenfont}
\XeTeXinterchartoks \XKlatinnumber      \XKlatinhyphen = {\XKwaslatinchar\XKhyphenfont}
\XeTeXinterchartoks \XKlatinopening     \XKlatinhyphen = {\XKhyphenfont}
\XeTeXinterchartoks \XKlatinclosing     \XKlatinhyphen = {\XKhyphenfont}
\XeTeXinterchartoks \XKopeningquote     \XKlatinhyphen = {\XKopeningquotestop\XKhyphenfont}
\XeTeXinterchartoks \XKclosingquote     \XKlatinhyphen = {\XKclosingquotestop\XKhyphenfont}
\XeTeXinterchartoks \XKhanja            \XKlatinhyphen = {\XKcjkcharboxstop\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKhanjacombining   \XKlatinhyphen = {\XKcjkcharboxstop\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKsmallkana        \XKlatinhyphen = {\XKcjkcharboxstop\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKcjksymbol        \XKlatinhyphen = {\XKcjkcharboxstop\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKcjkopening       \XKlatinhyphen = {\postcjkopenparen\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKcjkclosing       \XKlatinhyphen = {\postcjkcloseparen\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKcjkcolon         \XKlatinhyphen = {\postcjkcolon\XKnobreak\XKquatersmallbreak\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKcjkfullstop      \XKlatinhyphen = {\postcjkfullstop\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKcjkliaison       \XKlatinhyphen = {\XKcjkcharboxstop\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKcjkextrastop     \XKlatinhyphen = {\XKcjkcharboxstop\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKhangulsyllable   \XKlatinhyphen = {\XKcjkcharboxstop\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKhanguljungjong   \XKlatinhyphen = {\XKcjkcharboxstop\XKwascjkchar\XKhyphenfont}
\XeTeXinterchartoks \XKlatinfullstop    \XKlatinhyphen = {\XKperiodboxstop\XKhyphenfont}
\XeTeXinterchartoks \XKlatinquestion    \XKlatinhyphen = {\XKquestionboxstop\XKhyphenfont}
\XeTeXinterchartoks \XKlatinexclamation \XKlatinhyphen = {\XKexclamationboxstop\XKhyphenfont}
\XeTeXinterchartoks \XKlatincomma       \XKlatinhyphen = {\XKcommaboxstop\XKhyphenfont}
\XeTeXinterchartoks \XKlatincolon       \XKlatinhyphen = {\XKhyphenfont}
%\XeTeXinterchartoks \XKlatinhyphen      \XKlatinhyphen = {}
\XeTeXinterchartoks \XKboundary         \XKlatinhyphen = {\XKundoignorespaces\XKhyphenfont\XKbeginboundary}

%%% ? boundary
\XeTeXinterchartoks \XKlatinchar        \XKboundary = {\XKendboundary\XKwaslatinchar\XKstoreprevfont}
\XeTeXinterchartoks \XKlatinnumber      \XKboundary = {\XKendboundary\XKwaslatinchar\XKstoreprevfont}
\XeTeXinterchartoks \XKlatinopening     \XKboundary = {\XKendboundary\XKstoreprevfont}
\XeTeXinterchartoks \XKlatinclosing     \XKboundary = {\XKendboundary\XKstoreprevfont}
\XeTeXinterchartoks \XKopeningquote     \XKboundary = {\XKopeningquotestop\XKendboundary\XKstoreprevfont}
\XeTeXinterchartoks \XKclosingquote     \XKboundary = {\XKclosingquotestop\XKendboundary\XKstoreprevfont}
\XeTeXinterchartoks \XKhanja            \XKboundary = {\XKcjkcharboxstop\XKendboundary\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKhanjacombining   \XKboundary = {\XKcjkcharboxstop\XKendboundary\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKsmallkana        \XKboundary = {\XKcjkcharboxstop\XKendboundary\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKcjksymbol        \XKboundary = {\XKcjkcharboxstop\XKendboundary\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKcjkopening       \XKboundary = {\postcjkopenparen\XKendboundary\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKcjkclosing       \XKboundary = {\postcjkcloseparen\XKendboundary\ifcjtypeset\XKhalfskip\fi\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKcjkcolon         \XKboundary = {\postcjkcolon\XKendboundary\XKnobreak\XKquatersmallbreak\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKcjkfullstop      \XKboundary = {\postcjkfullstop\XKendboundary\ifcjtypeset\XKfixedhalfskip\fi\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKcjkliaison       \XKboundary = {\XKcjkcharboxstop\XKendboundary\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKcjkextrastop     \XKboundary = {\XKcjkcharboxstop\XKendboundary\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKhangulsyllable   \XKboundary = {\XKcjkcharboxstop\XKendboundary\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKhanguljungjong   \XKboundary = {\XKcjkcharboxstop\XKendboundary\XKwascjkchar\XKignorespaces\XKstoreprevfont}
\XeTeXinterchartoks \XKlatinfullstop    \XKboundary = {\XKperiodboxstop\XKendboundary\XKstoreprevfont}
\XeTeXinterchartoks \XKlatinquestion    \XKboundary = {\XKquestionboxstop\XKendboundary\XKstoreprevfont}
\XeTeXinterchartoks \XKlatinexclamation \XKboundary = {\XKexclamationboxstop\XKendboundary\XKstoreprevfont}
\XeTeXinterchartoks \XKlatincomma       \XKboundary = {\XKcommaboxstop\XKendboundary\XKstoreprevfont}
\XeTeXinterchartoks \XKlatincolon       \XKboundary = {\XKendboundary\XKstoreprevfont}
\XeTeXinterchartoks \XKlatinhyphen      \XKboundary = {\XKendboundary\XKstoreprevfont}
%\XeTeXinterchartoks \XKboundary         \XKboundary = {}

%%% ? cjk colons
\XeTeXinterchartoks \XKlatinchar        \XKcjkcolon = {\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKlatinnumber      \XKcjkcolon = {\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKlatinopening     \XKcjkcolon = {\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKlatinclosing     \XKcjkcolon = {\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKopeningquote     \XKcjkcolon = {\XKopeningquotestop\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKclosingquote     \XKcjkcolon = {\XKclosingquotestop\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKhanja            \XKcjkcolon = {\XKcjkcharboxstop\XKnobreak\XKquatersmallbreak\XKmaybehanjafont\precjkcolon}
\XeTeXinterchartoks \XKhanjacombining   \XKcjkcolon = {\XKcjkcharboxstop\XKnobreak\XKquatersmallbreak\XKmaybehanjafont\precjkcolon}
\XeTeXinterchartoks \XKsmallkana        \XKcjkcolon = {\XKcjkcharboxstop\XKnobreak\XKquatersmallbreak\XKmaybehanjafont\precjkcolon}
\XeTeXinterchartoks \XKcjksymbol        \XKcjkcolon = {\XKcjkcharboxstop\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKcjkopening       \XKcjkcolon = {\postcjkopenparen\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKcjkclosing       \XKcjkcolon = {\postcjkcloseparen\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKcjkcolon         \XKcjkcolon = {\postcjkcolon\XKnobreak\ifcjtypeset\XKhalfminusquaterskip\else\XKsmallskip\fi\precjkcolon}
\XeTeXinterchartoks \XKcjkfullstop      \XKcjkcolon = {\postcjkfullstop\XKnobreak\ifcjtypeset\XKthreequaterskip\else\XKsmallskip\fi\precjkcolon}
\XeTeXinterchartoks \XKcjkliaison       \XKcjkcolon = {\XKcjkcharboxstop\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKcjkextrastop     \XKcjkcolon = {\XKcjkcharboxstop\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKhangulsyllable   \XKcjkcolon = {\XKcjkcharboxstop\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKhanguljungjong   \XKcjkcolon = {\XKcjkcharboxstop\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKlatinfullstop    \XKcjkcolon = {\XKperiodboxstop\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKlatinquestion    \XKcjkcolon = {\XKquestionboxstop\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKlatinexclamation \XKcjkcolon = {\XKexclamationboxstop\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKlatincomma       \XKcjkcolon = {\XKcommaboxstop\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKlatincolon       \XKcjkcolon = {\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKlatinhyphen      \XKcjkcolon = {\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\precjkcolon}
\XeTeXinterchartoks \XKboundary         \XKcjkcolon = {\XKmaybehanjafont\XKnobreak\XKquatersmallbreak\XKbeginboundary\precjkcolon}

%%% ? cjk fullstop
\XeTeXinterchartoks \XKlatinchar        \XKcjkfullstop = {\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKlatinnumber      \XKcjkfullstop = {\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKlatinopening     \XKcjkfullstop = {\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKlatinclosing     \XKcjkfullstop = {\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKopeningquote     \XKcjkfullstop = {\XKopeningquotestop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKclosingquote     \XKcjkfullstop = {\XKclosingquotestop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKhanja            \XKcjkfullstop = {\XKcjkcharboxstop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKhanjacombining   \XKcjkfullstop = {\XKcjkcharboxstop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKsmallkana        \XKcjkfullstop = {\XKcjkcharboxstop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKcjksymbol        \XKcjkfullstop = {\XKcjkcharboxstop\precjkfullstop}
\XeTeXinterchartoks \XKcjkopening       \XKcjkfullstop = {\postcjkopenparen\precjkfullstop}
\XeTeXinterchartoks \XKcjkclosing       \XKcjkfullstop = {\postcjkcloseparen\precjkfullstop}
\XeTeXinterchartoks \XKcjkcolon         \XKcjkfullstop = {\postcjkcolon\XKnobreak\XKquatersmallbreak\precjkfullstop}
\XeTeXinterchartoks \XKcjkfullstop      \XKcjkfullstop = {\postcjkfullstop\precjkfullstop}
\XeTeXinterchartoks \XKcjkliaison       \XKcjkfullstop = {\XKcjkcharboxstop\precjkfullstop}
\XeTeXinterchartoks \XKcjkextrastop     \XKcjkfullstop = {\XKcjkcharboxstop\precjkfullstop}
\XeTeXinterchartoks \XKhangulsyllable   \XKcjkfullstop = {\XKcjkcharboxstop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKhanguljungjong   \XKcjkfullstop = {\XKcjkcharboxstop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKlatinfullstop    \XKcjkfullstop = {\XKperiodboxstop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKlatinquestion    \XKcjkfullstop = {\XKquestionboxstop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKlatinexclamation \XKcjkfullstop = {\XKexclamationboxstop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKlatincomma       \XKcjkfullstop = {\XKcommaboxstop\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKlatincolon       \XKcjkfullstop = {\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKlatinhyphen      \XKcjkfullstop = {\XKmaybehanjafont\precjkfullstop}
\XeTeXinterchartoks \XKboundary         \XKcjkfullstop = {\XKmaybehanjafont\XKbeginboundary\precjkfullstop}

%%% ? cjk liaison
\XeTeXinterchartoks \XKlatinchar        \XKcjkliaison = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinnumber      \XKcjkliaison = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinopening     \XKcjkliaison = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinclosing     \XKcjkliaison = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKopeningquote     \XKcjkliaison = {\XKopeningquotestop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKclosingquote     \XKcjkliaison = {\XKclosingquotestop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKhanja            \XKcjkliaison = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKhanjacombining   \XKcjkliaison = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKsmallkana        \XKcjkliaison = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
%\XeTeXinterchartoks \XKcjksymbol        \XKcjkliaison = {}
\XeTeXinterchartoks \XKcjkopening       \XKcjkliaison = {\postcjkopenparen\XKcjkcharboxstart}
\XeTeXinterchartoks \XKcjkclosing       \XKcjkliaison = {\postcjkcloseparen\XKnobreak\XKhalfsmallbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKcjkcolon         \XKcjkliaison = {\postcjkcolon\XKnobreak\XKquatersmallbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKcjkfullstop      \XKcjkliaison = {\postcjkfullstop\XKnobreak\XKfixedhalfskip\XKcjkcharboxstart}
%\XeTeXinterchartoks \XKcjkliaison       \XKcjkliaison = {}
%\XeTeXinterchartoks \XKcjkextrastop     \XKcjkliaison = {}
\XeTeXinterchartoks \XKhangulsyllable   \XKcjkliaison = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKhanguljungjong   \XKcjkliaison = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinfullstop    \XKcjkliaison = {\XKperiodboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinquestion    \XKcjkliaison = {\XKquestionboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinexclamation \XKcjkliaison = {\XKexclamationboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatincomma       \XKcjkliaison = {\XKcommaboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatincolon       \XKcjkliaison = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinhyphen      \XKcjkliaison = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKboundary         \XKcjkliaison = {\XKmaybehanjafont\XKbeginboundary\XKcjkcharboxstart}

%%% ? cjk quesiton/exclamation
\XeTeXinterchartoks \XKlatinchar        \XKcjkextrastop = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinnumber      \XKcjkextrastop = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinopening     \XKcjkextrastop = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinclosing     \XKcjkextrastop = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKopeningquote     \XKcjkextrastop = {\XKopeningquotestop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKclosingquote     \XKcjkextrastop = {\XKclosingquotestop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKhanja            \XKcjkextrastop = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKhanjacombining   \XKcjkextrastop = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKsmallkana        \XKcjkextrastop = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
%\XeTeXinterchartoks \XKcjksymbol        \XKcjkextrastop = {}
\XeTeXinterchartoks \XKcjkopening       \XKcjkextrastop = {\postcjkopenparen\XKcjkcharboxstart}
\XeTeXinterchartoks \XKcjkclosing       \XKcjkextrastop = {\postcjkcloseparen\XKnobreak\XKhalfsmallbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKcjkcolon         \XKcjkextrastop = {\postcjkcolon\XKnobreak\XKquatersmallbreak\XKcjkcharboxstart}
\XeTeXinterchartoks \XKcjkfullstop      \XKcjkextrastop = {\postcjkfullstop\XKnobreak\XKfixedhalfskip\XKcjkcharboxstart}
%\XeTeXinterchartoks \XKcjkliaison       \XKcjkextrastop = {}
%\XeTeXinterchartoks \XKcjkextrastop     \XKcjkextrastop = {}
\XeTeXinterchartoks \XKhangulsyllable   \XKcjkextrastop = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKhanguljungjong   \XKcjkextrastop = {\XKcjkcharboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinfullstop    \XKcjkextrastop = {\XKperiodboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinquestion    \XKcjkextrastop = {\XKquestionboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinexclamation \XKcjkextrastop = {\XKexclamationboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatincomma       \XKcjkextrastop = {\XKcommaboxstop\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatincolon       \XKcjkextrastop = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKlatinhyphen      \XKcjkextrastop = {\XKmaybehanjafont\XKcjkcharboxstart}
\XeTeXinterchartoks \XKboundary         \XKcjkextrastop = {\XKmaybehanjafont\XKbeginboundary\XKcjkcharboxstart}


\let\XKnobreak\nobreak
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% font setting
\def\XKlatinfont{\ifcase\XKcurrentfont\else\XK@latinfont\fi}
\def\XKhangulfont
  {\ifcase\XKcurrentfont\XK@storeprevfont\XK@hangulfont\or\or\XK@hangulfont\fi}
\def\XKhanjafont
  {\ifcase\XKcurrentfont\XK@storeprevfont\XK@hanjafont\or\XK@hanjafont\fi}
\def\XK@latinfont {\chardef\XKcurrentfont\z@\XKprevfont}
\def\XK@hangulfont{\chardef\XKcurrentfont\@ne\hangfnt}
\def\XK@hanjafont {\chardef\XKcurrentfont\tw@\hanifnt}
\def\XK@storeprevfont{\edef\XKprevfont{\the\font}}
\let\XKstoreprevfont\XKlatinfont
\chardef\XKcurrentfont\z@ \XK@storeprevfont
% bug #2 : http://www.ktug.org/xe/index.php?document_srl=203582
\let\hangfnt\relax \def\hanifnt{\hangfnt}

\protected\def\latincjksymbols   {\def\XKmaybehanjafont{\XKlatinfont}}
\protected\def\hangulcjksymbols  {\def\XKmaybehanjafont{\XKhangulfont}}
\protected\def\hanjacjksymbols   {\def\XKmaybehanjafont{\XKhanjafont}}
\protected\def\prevfontcjksymbols{\def\XKmaybehanjafont{\empty}}

\protected\def\latinalphs   {\def\XKmaybelatinfont{\XKlatinfont}}
\protected\def\hangulalphs  {\def\XKmaybelatinfont{\XKhangulfont}}
\protected\def\hanjaalphs   {\def\XKmaybelatinfont{\XKhanjafont}}
\protected\def\prevfontalphs{\def\XKmaybelatinfont{\empty}}

\protected\def\latinnums   {\def\XKlatinnumfont{\XKlatinfont}}
\protected\def\hangulnums  {\def\XKlatinnumfont{\XKhangulfont}}
\protected\def\hanjanums   {\def\XKlatinnumfont{\XKhanjafont}}
\protected\def\prevfontnums{\def\XKlatinnumfont{\empty}}

\protected\def\latinparens   {\def\XKlatinparenfont{\XKlatinfont}}
\protected\def\hangulparens  {\def\XKlatinparenfont{\XKhangulfont}}
\protected\def\hanjaparens   {\def\XKlatinparenfont{\XKhanjafont}}
\protected\def\prevfontparens{\def\XKlatinparenfont{\empty}}

\protected\def\latinquotes   {\def\XKlatinquotefont{\XKlatinfont}}
\protected\def\hangulquotes  {\def\XKlatinquotefont{\XKhangulfont}}
\protected\def\hanjaquotes   {\def\XKlatinquotefont{\XKhanjafont}}
\protected\def\prevfontquotes{\def\XKlatinquotefont{\empty}}

\protected\def\latinhyphens   {\def\XKhyphenfont{\XKlatinfont}}
\protected\def\hangulhyphens  {\def\XKhyphenfont{\XKhangulfont}}
\protected\def\hanjahyphens   {\def\XKhyphenfont{\XKhanjafont}}
\protected\def\prevfonthyphens{\def\XKhyphenfont{\empty}}

\protected\def\latincolons   {\def\XKcolonfont{\XKlatinfont}}
\protected\def\hangulcolons  {\def\XKcolonfont{\XKhangulfont}}
\protected\def\hanjacolons   {\def\XKcolonfont{\XKhanjafont}}
\protected\def\prevfontcolons{\def\XKcolonfont{\empty}}

\protected\def\latinpuncts   {\def\XKpunctsfont{\XKlatinfont}}
\protected\def\hangulpuncts  {\def\XKpunctsfont{\XKhangulfont}}
\protected\def\hanjapuncts   {\def\XKpunctsfont{\XKhanjafont}}
\protected\def\prevfontpuncts{\def\XKpunctsfont{\empty}}

\protected\def\latinmarks
  {\latinalphs \latinnums \latinpuncts \latinquotes
  \latinparens \latinhyphens \latincolons \latincjksymbols}
\protected\def\hangulmarks
  {\hangulalphs\hangulnums\hangulpuncts\hangulquotes
  \hangulparens\hangulhyphens\hangulcolons \hangulcjksymbols}
\protected\def\hanjamarks
  {\hanjaalphs \hanjanums \hanjapuncts \hanjaquotes
  \hanjaparens \hanjahyphens \hanjacolons \hanjacjksymbols}
\protected\def\prevfontmarks
  {\prevfontalphs\prevfontnums\prevfontparens\prevfontquotes
  \prevfonthyphens\prevfontcolons\prevfontpuncts\prevfontcjksymbols}

\latinmarks
\prevfontpuncts   % empty default font in case of latin . , ? !
\prevfontcolons   % empty default font in case of latin ; :
\hangulcjksymbols % cjk symbols in hangul font

% simple command to typeset hanja by hangul font
\protected\def\hanjabyhangulfont{\let\XKhanjafont\XKhangulfont}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% options regarding micro-spacing
\def\xetexkohu                  {0.05em }
\def\xetexkointerhchar          {}
\def\xetexkolowerperiod         {}
\def\xetexkolowerquestion       {}
\def\xetexkolowerexclamation    {}
\def\xetexkolowercomma          {}
\def\xetexkopreperiodkern       {}
\def\xetexkopostperiodkern      {}
\def\xetexkoprequestionkern     {}
\def\xetexkopostquestionkern    {}
\def\xetexkopreexclamationkern  {}
\def\xetexkopostexclamationkern {}
\def\xetexkoprecommakern        {}
\def\xetexkopostcommakern       {}
\def\xetexkoquotewidth          {}
\def\xetexkoquoteraise          {}
\def\xetexkocharraise           {}
\def\xetexkopostmathskip        {\dimexpr (\xetexkohu + \z@) * \tw@\relax}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% `` '' or ` '
\def\XKopeningquotestart{%
  \chardef\XK@make@quotebox\z@
  \ifx\empty\xetexkoquotewidth
    \ifx\empty\xetexkoquoteraise \else
      \chardef\XK@make@quotebox\tw@
    \fi
  \else
    \chardef\XK@make@quotebox\@ne
  \fi
  \ifnum\XK@make@quotebox>\z@
    \leavevmode
    \ifnum\XK@make@quotebox=\tw@ \raise\xetexkoquoteraise \fi
    \hbox
    \ifnum\XK@make@quotebox=\@ne to\xetexkoquotewidth \fi
    \bgroup\hss
  \fi
}
\def\XKopeningquotestop{%
  \ifnum\XK@make@quotebox>\z@
    \egroup\nobreak\hskip\z@
  \fi
}
\def\XKclosingquotestart{%
  \chardef\XK@make@quotebox\z@
  \ifx\empty\xetexkoquotewidth
    \ifx\empty\xetexkoquoteraise \else
      \chardef\XK@make@quotebox\tw@
    \fi
  \else
    \chardef\XK@make@quotebox\@ne
  \fi
  \ifnum\XK@make@quotebox>\z@
    \leavevmode\nobreak\hskip\z@
    \ifnum\XK@make@quotebox=\tw@ \raise\xetexkoquoteraise \fi
    \hbox
    \ifnum\XK@make@quotebox=\@ne to\xetexkoquotewidth \fi
    \bgroup
  \fi
}
\def\XKclosingquotestop{%
  \ifnum\XK@make@quotebox>\z@
    \hss\egroup
  \fi
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% . , ? !
\def\XKwaslatinchar{\chardef\XK@after@cjk@punct\z@}
\def\XKwascjkchar  {\chardef\XK@after@cjk@punct\@ne}
\XKwaslatinchar
\chardef\XK@inpunctuationbox\z@

\def\XKperiodboxstart{% .
  \ifnum\XK@after@cjk@punct>\z@
    \ifx\empty\xetexkolowerperiod
    \else
      \leavevmode\lower\xetexkolowerperiod\hbox\bgroup
      \chardef\XK@inpunctuationbox\@ne
    \fi
  \fi
  \ifnum\XKcurrentfont>\z@
    \ifx\empty\xetexkopreperiodkern
    \else
      \kern\xetexkopreperiodkern\relax
    \fi
  \fi
}
\def\XKperiodboxstop{%
  \ifnum\XKcurrentfont>\z@
    \ifx\empty\xetexkopostperiodkern
    \else
      \vrule width\xetexkopostperiodkern height\z@ depth\z@
    \fi
  \fi
  \ifnum\XK@inpunctuationbox=\@ne
    \global\count@\spacefactor\egroup\spacefactor\count@
  \fi
}

\def\XKquestionboxstart{% ?
  \ifnum\XK@after@cjk@punct>\z@
    \ifx\empty\xetexkolowerquestion
    \else
      \leavevmode\lower\xetexkolowerquestion\hbox\bgroup
      \chardef\XK@inpunctuationbox\@ne
    \fi
  \fi
  \ifnum\XKcurrentfont>\z@
    \ifx\empty\xetexkoprequestionkern
    \else
      \kern\xetexkoprequestionkern\relax
    \fi
  \fi
}
\def\XKquestionboxstop{%
  \ifnum\XKcurrentfont>\z@
    \ifx\empty\xetexkopostquestionkern
    \else
      \vrule width\xetexkopostquestionkern height\z@ depth\z@
    \fi
  \fi
  \ifnum\XK@inpunctuationbox=\@ne
    \global\count@\spacefactor\egroup\spacefactor\count@
  \fi
}

\def\XKexclamationboxstart{% !
  \ifnum\XK@after@cjk@punct>\z@
    \ifx\empty\xetexkolowerexclamation
    \else
      \leavevmode\lower\xetexkolowerexclamation\hbox\bgroup
      \chardef\XK@inpunctuationbox\@ne
    \fi
  \fi
  \ifnum\XKcurrentfont>\z@
    \ifx\empty\xetexkopreexclamationkern
    \else
      \kern\xetexkopreexclamationkern\relax
    \fi
  \fi
}
\def\XKexclamationboxstop{%
  \ifnum\XKcurrentfont>\z@
    \ifx\empty\xetexkopostexclamationkern
    \else
      \vrule width\xetexkopostexclamationkern height\z@ depth\z@
    \fi
  \fi
  \ifnum\XK@inpunctuationbox=\@ne
    \global\count@\spacefactor\egroup\spacefactor\count@
  \fi
}

\def\XKcommaboxstart{% ,
  \ifnum\XK@after@cjk@punct>\z@
    \ifx\empty\xetexkolowercomma
    \else
      \leavevmode\lower\xetexkolowercomma\hbox\bgroup
      \chardef\XK@inpunctuationbox\@ne
    \fi
  \fi
  \ifnum\XKcurrentfont>\z@
    \ifx\empty\xetexkoprecommakern
    \else
      \kern\xetexkoprecommakern\relax
    \fi
  \fi
}
\def\XKcommaboxstop{%
  \ifnum\XKcurrentfont>\z@
    \ifx\empty\xetexkopostcommakern
    \else
      \vrule width\xetexkopostcommakern height\z@ depth\z@
    \fi
  \fi
  \ifnum\XK@inpunctuationbox=\@ne
    \global\count@\spacefactor\egroup\spacefactor\count@
  \fi
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% cjk openings and closings
%%% considering bounding box
\def\XK@side@bearing#1#2{% 1: char index; 2: left=1 or right=3 -> dimen@
  \ifdim\XeTeXglyphbounds#2\XeTeXcharglyph#1>.5em
    \dimen@.5em
  \else
    \dimen@\fontcharwd\font\count@
  \fi
}
\def\precjkopenparen{\futurelet\@let@token\precjkopenparen@}
\def\precjkopenparen@{%
  \@josa@char@to@number\@let@token\count@
  \XK@side@bearing\count@\@ne
  \leavevmode
  \ifx\empty\xetexkocharraise\else\raise\xetexkocharraise\fi
  \hbox
  \ifx\XKdisablecjksymbolspacing\empty
    \bgroup
  \else % default: half
    to\dimen@ \bgroup\hss
  \fi
  \XeTeXinterchartoks\XKboundary\XKcjkopening = {\empty}}
\def\postcjkopenparen{\egroup}

\def\precjkcloseparen{\futurelet\@let@token\precjkcloseparen@}
\def\precjkcloseparen@{%
  \@josa@char@to@number\@let@token\count@
  \XK@side@bearing\count@\thr@@
  \leavevmode
  \ifx\empty\xetexkocharraise\else\raise\xetexkocharraise\fi
  \hbox
  \ifx\XKdisablecjksymbolspacing\empty\else % default: half
    to\dimen@
  \fi
  \bgroup
  \XeTeXinterchartoks\XKboundary\XKcjkclosing = {\empty}}
\def\postcjkcloseparen{%
  \ifx\XKdisablecjksymbolspacing\empty\else % default: half
    \hss
  \fi
  \egroup}

\def\precjkfullstop{\futurelet\@let@token\precjkfullstop@}
\def\precjkfullstop@{%
  \@josa@char@to@number\@let@token\count@
  \XK@side@bearing\count@\thr@@
  \leavevmode
  \ifx\empty\xetexkocharraise\else\raise\xetexkocharraise\fi
  \hbox
  \ifx\XKdisablecjksymbolspacing\empty\else % default: half
    to\dimen@
  \fi
  \bgroup
  \XeTeXinterchartoks\XKboundary\XKcjkfullstop = {\empty}}
\def\postcjkfullstop{%
  \ifx\XKdisablecjksymbolspacing\empty\else % default: half
    \hss
  \fi
  \egroup}

\def\precjkcolon {\leavevmode
  \ifx\empty\xetexkocharraise\else\raise\xetexkocharraise\fi
  \hbox
  \ifx\XKdisablecjksymbolspacing\empty
    \bgroup
  \else % default: half
    to 0.5em\bgroup\hss
  \fi
}
\def\postcjkcolon{%
  \ifx\XKdisablecjksymbolspacing\empty\else % default: half
    \hss
  \fi
  \egroup}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% various spaces
\def\XKskipstretchshrink    {plus .04em minus .02em}
\def\XKzeroskip             {\hskip\z@\XKskipstretchshrink}
\def\XKsmallskip
  {\hskip\dimexpr (\xetexkohu + \z@) * \tw@ \relax \XKskipstretchshrink}
\def\XKsmallsmallskip
  {\hskip\dimexpr \xetexkohu + \z@ \relax \XKskipstretchshrink}
\def\XKxkanjiskip           {\hskip0.25em plus0.15em minus0.06em }
\def\XKhalfskip             {\hskip0.5em minus 0.5em }
\def\XKfixedhalfskip        {\hskip0.5em\relax}
\def\XKquaterskip           {\hskip0.25em minus 0.25em }
\def\XKhalfminusquaterskip  {\hskip0.5em minus 0.25em }
\def\XKthreequaterskip      {\hskip0.75em minus 0.25em }
\def\XKinterhangulpenalty   {\penalty50 }

\def\XKinterhangulbreak
  {\ifcjtypeset\else\XKinterhangulpenalty\fi
  \hskip\dimexpr\xetexkointerhchar + \z@\relax \XKskipstretchshrink}
\def\XKinterhanjabreak    {\ifcjtypeset\else\XKinterhangulpenalty\fi \XKzeroskip}
\def\XKcjklatinbreak      {\ifcjtypeset\XKxkanjiskip\else\XKsmallskip\fi}
\def\XKcjklatinsmallbreak {\ifcjtypeset\XKxkanjiskip\else\XKsmallsmallskip\fi}
\def\XKhalfsmallbreak     {\ifcjtypeset\XKhalfskip\else\XKsmallsmallskip\fi}
\def\XKquatersmallbreak   {\ifcjtypeset\XKquaterskip\else\XKsmallskip\fi}

\def\XKafterboundaryskip{%
  \ifcase\lastnodetype
    \or  \XKzeroskip      %  1. hbox: especially after indent box
    \or  \XKzeroskip      %  2. vbox
    \or\or\or\or\or\or
    \or                   %  9. whatsit. see issue #3
    \or  \XKcjkmathbreak  % 10. math
    \or
    \or  \XKzeroskip      % 12. kern
    \fi}
%% users can redefine XKcjkmathbreak
\def\XKcjkmathbreak{%
  \ifcjtypeset\XKxkanjiskip
  \else\hskip\xetexkopostmathskip\XKskipstretchshrink\fi}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% everyhangul/everyhanja
%%%  request from karnes at 2013.11.18
\def\everyhanja#1{%
  \def\XK@every@hanja##1{#1}%
  \let\XKcjkcharboxstart\empty
  \let\XKcjkcharboxstop\empty % conflict w. everyhanja
}
\def\XK@every@hanja#1{#1}
\def\everyhangul#1{%
  \def\XK@every@hangul##1{#1}%
  \let\XKcjkcharboxstart\empty
  \let\XKcjkcharboxstop\empty % conflict w. everyhangul
}
\def\XK@every@hangul#1{#1}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% for autojosa, get last chars
\let\XK@last@char=0
\let\XK@lastlast@char\XK@last@char
\let\XK@lastlastlast@char\XK@lastlast@char

\def\XKlastchar{\futurelet\@let@token\XK@save@last@char}
\def\XK@save@last@char{%
  \global\let\XK@lastlastlast@char\XK@lastlast@char
  \global\let\XK@lastlast@char    \XK@last@char
  \global\let\XK@last@char        \@let@token
}

\def\XK@fallback@hanja@font@family#1{%
  \chardef\XK@use@fallback@font\z@
  \iffontchar\font`#1\else
    \ifdefined\fallbackhanjafont
      \chardef\XK@use@fallback@font\@ne
      \expandafter\let\expandafter\XK@fallback@plain@font@temp\the\font
      \let\XK@fallback@latex@family@temp\f@family % redundant for plain
      \fallbackhanjafont
    \fi
  \fi
}

\def\XKhanjalastchar#1{%
  \let\@let@token#1\XK@save@last@char
  % fallbackhanjafont for, say, HanaMinB
  \XK@fallback@hanja@font@family{#1}%
  \XK@every@hanja{#1}% everyhanja
  \ifcase\XK@use@fallback@font\else
    \XK@fallback@plain@font@temp
    \let\f@family\XK@fallback@latex@family@temp
  \fi
}

\newtoks\XK@toks@

\def\XKcjklastchar#1{%
  \let\@let@token#1\XK@save@last@char
  % and supress char orphan
  \XK@toks@{\XK@every@hangul{#1}}% everyhangul 가
  \ifnum\lastpenalty=\z@ % bypass 가\\나 case
    \expandafter\XK@futurelet@let@token
  \else
    \expandafter\XK@normal@the@toks@
  \fi
}
\def\XK@check@next@char{%
  \ifx\par\@let@token
    \let\next\XK@nobreak@the@toks@
  \else\ifx\@sptoken\@let@token
    \XK@toks@\expandafter{\the\XK@toks@\@sptoken}%
    \let\next\XK@afterassign@let@token
  \else\ifx.\@let@token
    \XK@toks@\expandafter{\the\XK@toks@ .}%
    \let\next\XK@afterassign@let@token
  \else\ifx^^^^3002\@let@token
    \XK@toks@\expandafter{\the\XK@toks@^^^^3002}%
    \let\next\XK@afterassign@let@token
  \else\ifx^^^^ff0e\@let@token
    \XK@toks@\expandafter{\the\XK@toks@^^^^ff0e}%
    \let\next\XK@afterassign@let@token
  \else
    \let\next\XK@normal@the@toks@
  \fi\fi\fi\fi\fi
  \next
}
\def\XK@afterassign@let@token{\afterassignment\XK@futurelet@let@token\let\@let@token= }
\def\XK@futurelet@let@token{\futurelet\@let@token\XK@check@next@char}
\def\XK@normal@the@toks@{\the\XK@toks@}
\def\XK@nobreak@the@toks@{\XK@nobreak\the\XK@toks@}
\def\XK@nobreak{\skip@\lastskip\unskip\unpenalty\nobreak\hskip\skip@}

\def\XKbeginboundary{% empty interchartoks crashes xetex!!!
  \global\XeTeXinterchartoks\XKboundary\XKlatinnumber    = {\empty}%
  \global\XeTeXinterchartoks\XKboundary\XKlatinchar      = {\empty}%
  \global\XeTeXinterchartoks\XKboundary\XKhanja          = {\empty}%
  \global\XeTeXinterchartoks\XKboundary\XKsmallkana      = {\empty}%
  \global\XeTeXinterchartoks\XKboundary\XKhangulsyllable = {\empty}%
}
\def\XKendboundary{%
  \global\XeTeXinterchartoks\XKboundary\XKlatinnumber    = {\XKundoignorespaces\XKlatinnumfont  \XKbeginboundary\XKlastchar}%
  \global\XeTeXinterchartoks\XKboundary\XKlatinchar      = {\XKundoignorespaces\XKmaybelatinfont\XKbeginboundary\XKlastchar}%
  \global\XeTeXinterchartoks\XKboundary\XKhanja          = {\XKhanjafont \XKafterboundaryskip\XKbeginboundary\XKcjkcharboxstart\XKhanjalastchar}%
  \global\XeTeXinterchartoks\XKboundary\XKsmallkana      = {\XKhanjafont \XKafterboundaryskip\XKbeginboundary\XKcjkcharboxstart\XKhanjalastchar}%
  \global\XeTeXinterchartoks\XKboundary\XKhangulsyllable = {\XKhangulfont\XKafterboundaryskip\XKbeginboundary\XKcjkcharboxstart\XKcjklastchar}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% raise hangul/hanja box
\def\XKcjkcharboxstart{%
  \ifx\empty\xetexkocharraise\else
    \leavevmode\raise\xetexkocharraise\hbox\bgroup
  \fi
}
\def\XKcjkcharboxstop{%
  \ifx\empty\xetexkocharraise\else
    \egroup
  \fi
}

%%%%%%%%%%%%%%
% etc commands
\let\enablejamoautojosa\relax % enabled already

\protected\def\disablejamoautojosa{% newly added by v2.1
  \XeTeXinterchartoks\XKhangulsyllable\XKhanguljungjong = {}%
  \XeTeXinterchartoks\XKhanguljungjong\XKhanguljungjong = {}%
}

\protected\def\disableautojosa{%
  \disablejamoautojosa
  \let\XKlastchar\relax
  \let\XK@save@last@char\relax
}

\protected\def\disablekoreanfonts{%
  \let\XKlatinfont      \relax
  \let\XKhangulfont     \relax
  \let\XKhanjafont      \relax
  \let\XKmaybelatinfont \relax
  \let\XKmaybehanjafont \relax
  \let\XKpunctsfont     \relax
  \let\XKlatinnumfont   \relax
  \let\XKlatinparenfont \relax
  \let\XKlatinquotefont \relax
  \let\XKhyphenfont     \relax
  \let\XKcolonfont      \relax
  \let\XKstoreprevfont  \relax
}

\protected\def\disablecjksymbolspacing{% for natural width of 。「」 etc
  \let\XKdisablecjksymbolspacing\empty
}

\protected\def\disablehangulspacing{% all micro-spacing is 0pt
  \let\XKskipstretchshrink\relax
  \let\precjkopenparen \relax  \let\postcjkopenparen \relax
  \let\precjkcloseparen\relax  \let\postcjkcloseparen\relax
  \let\precjkfullstop  \relax  \let\postcjkfullstop  \relax
  \let\precjkcolon     \relax  \let\postcjkcolon     \relax
  \let\XKopeningquotestart    \relax    \let\XKopeningquotestop   \relax
  \let\XKclosingquotestart    \relax    \let\XKclosingquotestop   \relax
  \let\XKperiodboxstart       \relax    \let\XKperiodboxstop      \relax
  \let\XKquestionboxstart     \relax    \let\XKquestionboxstop    \relax
  \let\XKexclamationboxstart  \relax    \let\XKexclamationboxstop \relax
  \let\XKcommaboxstart        \relax    \let\XKcommaboxstop       \relax
  \let\XKwaslatinchar         \relax    \let\XKwascjkchar         \relax
  \let\XKcjkcharboxstart      \relax    \let\XKcjkcharboxstop     \relax
  \let\XKinterhangulbreak     \XKzeroskip
  \let\XKinterhanjabreak      \XKzeroskip
  \let\XKcjklatinbreak        \XKzeroskip
  \let\XKcjklatinsmallbreak   \XKzeroskip
  \let\XKhalfsmallbreak       \XKzeroskip
  \let\XKfixedhalfskip        \XKzeroskip
  \let\XKquatersmallbreak     \XKzeroskip
  \let\XKhalfminusquaterskip  \XKzeroskip
  \let\XKhalfskip             \XKzeroskip
  \let\XKsmallskip            \XKzeroskip
  \let\XKthreequaterskip      \XKzeroskip
  \let\XKcjkmathbreak         \XKzeroskip
}

\protected\def\disablehangulspacingandlinebreak{% all micro-spacing is \relax
  \let\XKzeroskip         \relax
  \let\XKnobreak          \relax
  \let\XKafterboundaryskip\relax
  \def\XKcjklastchar##1{\let\@let@token##1\XK@save@last@char\XK@every@hangul{##1}}%
  \disablehangulspacing
}

% still remaining: XKhanjalastchar XKbeginboundary XKendboundary XKignorespaces XKundoignorespaces

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% for old and C/J documents
\newif\ifcjtypeset

% try to remove space skip
\def\XKignorespaces{}
\def\XKundoignorespaces{}

\def\XK@japanese{\cjtypesettrue
  %% killing spaces after cjk chars
  \def\XKignorespaces{\futurelet\XK@let@token\XK@ignorespaces}%
  \def\XK@ignorespaces{\ifx\XK@let@token\@sptoken\kern-1sp\kern1sp\ignorespaces\fi}%
  \def\XKundoignorespaces{\ifnum\lastkern=\@ne\@sptoken\fi}%
  %% a little bigger stretch/shrink
  \def\XKskipstretchshrink{plus .1em minus .1ex}%
  %% cjksymbols
  \hanjacjksymbols
  %% spaceskip is equal to xkanjiskip
  \spaceskip.25em plus.15em minus.06em
}
\protected\def\japanese{\XK@japanese\parindent1em }
\protected\def\Tchinese{\XK@japanese\parindent2em }
\protected\def\Schinese{\XK@japanese\parindent2em
  % these glyphs in simplified chinese fonts are left-aligned.
  \XeTeXcharclass "FF1F = \XKcjkfullstop % ？
  \XeTeXcharclass "FF01 = \XKcjkfullstop % ！
  \XeTeXcharclass "FF1A = \XKcjkfullstop % ：
  \XeTeXcharclass "FF1B = \XKcjkfullstop % ；
  }
\let\chinese\Schinese

%% inhibitglue
\let\inhibitglue\relax

%%%%%%%%%%%%%%%%%%%%%%
%% hangul in math mode -- general
\def\setmathhangulblock#1#2{%
  \count@ "#1
  \loop
    \Umathcode\count@ = 7 \symmathhangul \count@
    \ifnum\count@<"#2
      \advance\count@\@ne \repeat}

%%%%%%%%%%%
%% for ulem
\def\xetexkoulemsupport{%
  \UL@hook\expandafter{\the\UL@hook
    \let\XK@nobreak\relax
    \ifdefined\XK@UL@@@hangulfont\else
      \let\XK@UL@@@hangulfont\XKhangulfont
      \let\XK@UL@@@hanjafont \XKhanjafont
      \def\XKhangulfont{\XK@UL@@@hangulfont
        \aftergroup\aftergroup\aftergroup\XK@UL@@@hangulfont
      }%
      \def\XKhanjafont{\XK@UL@@@hanjafont
        \aftergroup\aftergroup\aftergroup\XK@UL@@@hanjafont
      }%
    \fi
  }%
}

%%%%%%%%%%
%% dotemph
\def\dotemphraise{0.4em }
\ifcsname bfseries\endcsname
  \def\dotemphchar{\bfseries ^^^^02d9}
\else
  \def\dotemphchar{\bf \char95 }
\fi
\newbox\XKdotemphbox

\protected\def\dotemph#1{%
  \leavevmode
  \begingroup
  \def\XKcjklastchar{\futurelet\@let@token\XK@dotemph@last@char}%
  \let\XKhanjalastchar\XKcjklastchar
  \let\XKcjkcharboxstart\relax
  \let\XKcjkcharboxstop\relax
  \setbox\XKdotemphbox\hbox{\dotemphchar}%
  #1\relax
  \endgroup
}

\def\XK@dotemph@last@char{\XK@save@last@char\dot@@@emph}

\def\dot@@@emph#1{%
  \setbox\z@\hbox{\XK@fallback@hanja@font@family{#1}#1}%
  \setbox\tw@\hbox to\wd\z@{\hss\copy\XKdotemphbox\hss}\ht\tw@\z@\dp\tw@\z@
  \rlap{\raise\dotemphraise\box\tw@}\box\z@
}

%%% declare to use interchartoken
\XeTeXinterchartokenstate\@ne

\def\hellipsis{^^^^2026^^^^2026}

\endinput
