summaryrefslogtreecommitdiff
path: root/tex/context/base/s-typesetting-kerning.mkiv
blob: 074861713c87bd05518c2f99449f753d75528bd5 (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
%D \module
%D   [      file=s-typesetting-kerning,
%D        version=2014.12.14,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Show Character Kerning,
%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.

\definecharacterkerning
  [typesetting-kerning-demo]
  [factor=.5]

\startbuffer[showcharacterkerning:boxes]
    \starttextrule{boxes}
        \showfontkerns
        \dontcomplain
        \startlines
            test \hbox{!} test
            test\hbox{!} test
            test \hbox{!}test
            test:$x$ test
            \setcharacterkerning[typesetting-kerning-demo]
            test \hbox{!} test
            test\hbox{!} test
            test \hbox{!}test
            test:$x$ test
        \stoplines
    \stoptextrule
\stopbuffer

\startbuffer[showcharacterkerning:ligatures]
    \starttextrule{ligatures}
        \dontcomplain
        \startlines
            effe flink effectief efficient fietsen
            \blank
            \setcharacterkerning[typesetting-kerning-demo]
            effe flink effectief efficient fietsen
            \blank \hsize\zeropoint
            effe
            flink
            effectief
            efficient
            fietsen
        \stoplines
    \stoptextrule
\stopbuffer

\startbuffer[showcharacterkerning:discretionaries]
    \starttextrule{discretionary}
        \dontcomplain
        \startlines
            \hbox{\samplediscretionary}
            \hbox{xxx\samplediscretionary}
            \hbox{\samplediscretionary xxx}
            \hbox{xxx\samplediscretionary xxx}
            \blank
            \setcharacterkerning[typesetting-kerning-demo]
            \hbox{\samplediscretionary}
            \hbox{xxx\samplediscretionary}
            \hbox{\samplediscretionary xxx}
            \hbox{xxx\samplediscretionary xxx}
            \blank \hsize\zeropoint
            \samplediscretionary
            xxx\samplediscretionary
            \samplediscretionary xxx
            xxx\samplediscretionary xxx
        \stoplines
    \stoptextrule
\stopbuffer

\startbuffer[showcharacterkerning:explicits]
    \starttextrule{explicits}
        \exhyphenchar    \hyphenasciicode
        \preexhyphenchar \lessthanasciicode
        \postexhyphenchar\morethanasciicode
        \def\TestDisc
          {\discretionary
             {\kern\emwidth<}%
             {>\kern\emwidth}%
             {\kern\emwidth=\kern\emwidth}%
          }
        \dontcomplain
        \startlines
            \hbox{super-charged}
            \hbox{super\-charged}
            \hbox{super\TestDisc charged}
            \hbox{super\discretionary{[}{]}{[]}charged}
            \blank
            \setcharacterkerning[typesetting-kerning-demo]
            \hbox{super-charged}
            \hbox{super\-charged}
            \hbox{super\TestDisc charged}
            \hbox{super\discretionary{[}{]}{[]}charged}
            \blank \hsize\zeropoint
            super-charged
            super\-charged
            super\TestDisc charged
            super\discretionary{[}{]}{[]}charged
        \stoplines
    \stoptextrule
\stopbuffer

\starttexdefinition unexpanded showcharacterkerning
    \getbuffer[showcharacterkerning:boxes]
    \getbuffer[showcharacterkerning:ligatures]
    \getbuffer[showcharacterkerning:discretionaries]
    \getbuffer[showcharacterkerning:explicits]
\stoptexdefinition

\continueifinputfile{s-typesetting-kerning.mkiv}

\starttext

    \showcharacterkerning

\stoptext


% {\hsize1mm efficient\discretionary{\kern1pt!\kern1pt}{\kern1pt!\kern1pt}{\kern1pt!\kern1pt}efficient\par}
% {\hsize1mm\definedfont[Regular]\setcharacterkerning[typesetting-kerning-demo]efficient\-efficient\par}