summaryrefslogtreecommitdiff
path: root/macros/xetex/generic/xetexko/xetexko-space.sty
blob: c671d67495f178f8880089ca341b14698defc0f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
% 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 ʼn
%%    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