summaryrefslogtreecommitdiff
path: root/tex/context/base/enco-run.tex
blob: c278b6870c1b40a4d04057d986cd09633606beda (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
%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}}

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

\gdef\showaccents%
  {\bgroup
  %\savefont
   \setuptextrules[\c!korps=,\c!letter=]
   \starttextrule{\visualizecharacterslegend}
   \witruimte
  %\restorefont\stelinterliniein
   \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!korps=,\c!letter=]
   \starttextrule{\visualizecharacterslegend}
   \witruimte
   \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 ##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!afstand=2em]
  %\restorefont\stelinterliniein
   \def\definecharacter ##1 ##2 %
     {\hbox{\strut\localcolortrue\hbox to \encwidth{\getvalue{##1}\hss}##1}\par}
   \readsysfile{\f!encodingprefix def}{}{}
   \stopcolumns
   \stoptextrule
   \egroup}

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

\protect \endinput