summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/enco-run.mkii
blob: 50fb52e158b986f367670776df120f1739c506ad (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
%D \module
%D   [     file=enco-run,
%D      version=2000.27.12, % moved to runtime module
%D        title=\CONTEXT\ Encoding Macros,
%D     subtitle=Runtime Macros,
%D       author=Hans Hagen,
%D         date=\currentdate,
%D    copyright=Hans Hagen \& Ton Otten]
%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

\gdef\visualizecharacters% {}'s needed
  {\def\uchar##1##2{\hbox to 2.5em
     {\ifcase##1\relax\red\or\blue\else\green\fi##1\hss##2}}%
   \let\normalbuildtextaccent\buildtextaccent
   \let\normalbottomaccent   \bottomaccent
  %\def\char{\green\normalchar}%
   \def\char % can be used in \oalign
     {\bgroup\def\char{\green\normalchar\scratchcounter\egroup}%
      \afterassignment\char\scratchcounter}%
   \def\buildtextaccent{\let\green\empty\blue\normalbuildtextaccent}%
   \def\bottomaccent{\let\green\empty\red\normalbottomaccent}}

\unexpanded\gdef\visualizecharacterslegend
  {\hbox
     {\edef\banner{\currentencoding\space\fontname\font}%
      \tttf\banner:\space
      {\blue composed}\space{\red bottom}\space{\green char}\space raw}}

\gdef\showaccents
  {\bgroup
   \savefont
   \setuptextrules[\c!bodyfont=,\c!style=]
   \starttextrule{\visualizecharacterslegend}
   \whitespace
   \restorefont\setupinterlinespace
   \visualizecharacters
   \def\do##1%
     {{\def\dodo####1%
         {\hss\hbox to 1em{\hss\expanded{##1####1\recurselevel}\hss}}%
       \hbox to \hsize
         {\strut
          \localcolortrue
          \hbox to 2em{\tttf\string##1\hss}%
          \dorecurse{26}{\dodo\character}}%
       \hbox to \hsize
         {\strut
          \localcolortrue
          \hskip2em
          \dorecurse{26}{\dodo\Character}}}%
       \par}
   \do\'\do\`\do\^\do\~\do\"
   \do\H\do\r\do\v\do\u\do\=
   \do\.\do\b\do\d\do\k\do\c
   \stoptextrule
   \egroup}

\gdef\showcharacters
  {\bgroup
   \savefont
   \setuptextrules[\c!bodyfont=,\c!style=]
   \starttextrule{\visualizecharacterslegend}
   \whitespace
   \dontcomplain
   \forgetall
   \def\startencoding[##1]{}
   \def\stopencoding{\endinput}
   \dimen0=\zeropoint
   \dimen2=\zeropoint
   \def\definecharacter ##1 ##2 %
     {\setbox0=\hbox spread 1em{\getvalue{##1}}%
      \ifdim\wd0>\dimen0 \dimen0=\wd0 \fi
      \setbox2=\hbox spread 1em{\box0 \tttf##1}
      \ifdim\wd2>\dimen2 \dimen2=\wd2 \fi}%
   \readsysfile{\f!encodingprefix def}{}{}
   \edef\encwidth{\the\dimen0}
   \dimen0=\hsize
   \advance\dimen0 2em
   \advance\dimen2 2em
   \divide \dimen0 by \dimen2 \advance\dimen0 1sp
   \edef\enccols{\number\dimen0}
   \visualizecharacters
   \startcolumns[\c!n=\enccols,\c!distance=2em]
   \restorefont\setupinterlinespace
   \def\definecharacter ##1 ##2 %
     {\setbox0=\hbox to \hsize{\localcolortrue\hbox to \encwidth{\getvalue{##1}\hss}\tttf##1}%
      \ht0\strutheight \dp0\strutdepth \box0 \allowbreak}
   \readsysfile{\f!encodingprefix def}{}{}
   \stopcolumns
   \stoptextrule
   \egroup}

% \hbox
%   {\font\test=uplr8t \test \ruledhbox{t}
%    \font\test=uplr8r \test \ruledhbox{t}}

\ifnum\texengine=\pdftexengine

    \gdef\showhyphenations#1%
      {\starttabulate[|le|l|]
       \NC language \NC \currentlanguage\ (internal code:\the\normallanguage)    \NC \NR
       \NC font     \NC \fontname\font                                           \NC \NR
       \NC encoding \NC \ifx\@@fontencoding\empty not set\else\@@fontencoding\fi \NC \NR
       \NC mapping  \NC \ifx\@@fontmapping \empty not set\else\@@fontmapping \fi \NC \NR
       \NC handling \NC \ifx\@@fonthandling\empty not set\else\@@fonthandling\fi \NC \NR
       \NC sample   \NC \hyphenatedword{#1}                                      \NC \NR
       \stoptabulate}

    \gdef\showmapping
      {\dostepwiserecurse{128}{255}{1}
          {\hbox\bgroup
             \hbox to 2em{\hss\recurselevel}%
             \hbox to 2em{\hss\char\recurselevel\hss}%
             \hbox to 3em{\hss\ifcase\lccode\recurselevel\else\the \lccode\recurselevel\fi}%
             \hbox to 2em{\hss\ifcase\lccode\recurselevel\else\char\lccode\recurselevel\fi\hss}%
             \hbox to 3em{\hss\ifcase\lccode\recurselevel\else\the \uccode\recurselevel\fi}%
             \hbox to 2em{\hss\ifcase\uccode\recurselevel\else\char\uccode\recurselevel\fi\hss}%
           \egroup
           \endgraf}}

    \gdef\showcharacterbounds
      {\bgroup
       \localcolortrue
       \dorecurse{255}
         {\ifdim\fontcharwd\font\recurselevel>\zeropoint
            \noindent\ruledhbox{\darkgray\char\recurselevel}\space
          \fi}\unskip
       \egroup}

\else

    \gdef\showhyphenations#1%
      {\starttabulate[|le|l|]
       \NC language \NC \currentlanguage\ (internal code:\the\normallanguage) \NC \NR
       \NC font     \NC \fontname\font                                        \NC \NR
       \NC sample   \NC \hyphenatedword{#1}                                   \NC \NR
       \stoptabulate}

    \globallet\showmapping\relax

    \globallet\showcharacterbounds\relax

\fi

\protect \endinput