s-fonts-cjk.mkiv /size: 2415 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [      file=s-fonts-cjk, % was: s-fnt-24
3%D        version=2009.02.06,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=CJK Glyph Combination Testing,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14\startmodule[fonts-cjk]
15
16\unprotect
17
18\unexpanded\def\ShowChineseCombiChar#1#2#3#4%
19  {\blank[small]
20   \dontleavehmode
21   \hbox\bgroup
22   \dontcomplain
23   \setstrut
24   \hbox to 7em{\ruledhbox{\char#1}\hskip.25em\type{+}\hskip.25em\ruledhbox{\char#2}\hskip.25em\type{=}\hskip.25em\ruledhbox{\char#1\char#2}\hss}\relax
25   \ruledvtop{\hsize1em\char#1\char#2}\relax
26   \hskip2em
27   \ruledvtop{\hsize.625em\char#1\char#2}\relax
28   \hskip2em
29   \ruledvtop{\hsize1.5em\char#1\char#2}\relax
30   \hskip2em
31   \type{#3 + #4}\relax
32   \egroup
33   \blank[small]}
34
35\startluacode
36local example = {
37    korean           = 0x0AC00,
38    chinese          = 0x04E55,
39    full_width_open  = 0x03008,
40    full_width_close = 0x03009,
41    half_width_open  = 0x02018,
42    half_width_close = 0x02019,
43    hyphen           = 0x02026,
44    non_starter      = 0x03005,
45    other            = 0x0004D, -- M
46}
47
48function fonts.analyzers.cjktest(first,second)
49    for k, v in next, example do
50        if (not first or first == "") or first == k then
51            for kk, vv in next, example do
52                if (not second or second == "") or second == kk then
53                    context.ShowChineseCombiChar(v,vv,k,kk)
54                end
55            end
56        end
57    end
58end
59\stopluacode
60
61\unexpanded\def\ShowCombinationsKorean
62  {\dodoubleempty\doShowCombinationsKorean}
63
64\def\doShowCombinationsKorean[#1][#2]%
65  {\startpacked
66   \setscript[hangul]
67   \setupcolors[\c!state=\v!start]
68   \enabletrackers[cjk.analyzing]
69   \ctxlua{fonts.analyzers.cjktest("#1","#2")}\par % !
70   \disabletrackers[cjk.analyzing]
71   \stoppacked}
72
73\unexpanded\def\ShowCombinationsChinese
74  {\dodoubleempty\doShowCombinationsChinese}
75
76\unexpanded\def\doShowCombinationsChinese[#1][#2]%
77  {\startpacked
78   \setscript[hanzi]
79   \setupcolors[\c!state=\v!start]
80   \enabletrackers[cjk.analyzing]
81   \ctxlua{fonts.analyzers.cjktest("#1","#2")}\par % !
82   \disabletrackers[cjk.analyzing]
83   \stoppacked}
84
85\stopmodule
86
87\protect \endinput
88