summaryrefslogtreecommitdiff
path: root/tex/context/base/s-fnt-24.mkiv
blob: 2e6b9a591875d229d5f232d24b6806c044c4b760 (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
%D \module
%D   [      file=s-fnt-24,
%D        version=2009.02.06,
%D          title=\CONTEXT\ Style File,
%D       subtitle=CJK Glyph Combination Testing,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\unprotect

\def\ShowChineseCombiChar#1#2#3#4%
  {\blank[small]
   \dontleavehmode
   \hbox\bgroup
   \dontcomplain
   \setstrut
   \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
   \ruledvtop{\hsize1em\char#1\char#2}\relax
   \hskip2em
   \ruledvtop{\hsize.625em\char#1\char#2}\relax
   \hskip2em
   \ruledvtop{\hsize1.5em\char#1\char#2}\relax
   \hskip2em
   \type{#3 + #4}\relax
   \egroup
   \blank[small]}

\startluacode
local example = {
    korean           = 0x0AC00,
    chinese          = 0x04E55,
    full_width_open  = 0x03008,
    full_width_close = 0x03009,
    half_width_open  = 0x02018,
    half_width_close = 0x02019,
    hyphen           = 0x02026,
    non_starter      = 0x03005,
    other            = 0x0004D, -- M
}

function fonts.analyzers.cjktest(first,second)
    for k, v in next, example do
        if (not first or first == "") or first == k then
            for kk, vv in next, example do
                if (not second or second == "") or second == kk then
                    context.ShowChineseCombiChar(v,vv,k,kk)
                end
            end
        end
    end
end
\stopluacode

\unexpanded\def\ShowCombinationsKorean
  {\dodoubleempty\doShowCombinationsKorean}

\def\doShowCombinationsKorean[#1][#2]%
  {\startpacked
   \setscript[hangul]
   \setupcolors[\c!state=\v!start]
   \enabletrackers[cjk.analyzing]
   \ctxlua{fonts.analyzers.cjktest("#1","#2")}\par % !
   \disabletrackers[cjk.analyzing]
   \stoppacked}

\unexpanded\def\ShowCombinationsChinese
  {\dodoubleempty\doShowCombinationsChinese}

\def\doShowCombinationsChinese[#1][#2]%
  {\startpacked
   \setscript[hanzi]
   \setupcolors[\c!state=\v!start]
   \enabletrackers[cjk.analyzing]
   \ctxlua{fonts.analyzers.cjktest("#1","#2")}\par % !
   \disabletrackers[cjk.analyzing]
   \stoppacked}

\protect \endinput