summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/context/sources/general/magazines/mag-0006-mkiv.tex
blob: 8baa5e003b7d383c3d0cf3d1690927d0af72e7fb (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
% language=uk

% author    : Hans Hagen
% copyright : PRAGMA ADE & ConTeXt Development Team
% license   : Creative Commons Attribution ShareAlike 4.0 International
% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
% origin    : the ConTeXt distribution
%
% comment   : Because this manual is distributed with TeX distributions it comes with a rather
%             liberal license. We try to adapt these documents to upgrades in the (sub)systems
%             that they describe. Using parts of the content otherwise can therefore conflict
%             with existing functionality and we cannot be held responsible for that. Many of
%             the manuals contain characteristic graphics and personal notes or examples that
%             make no sense when used out-of-context.
%
% comment   : Some chapters might have been published in TugBoat, the NTG Maps, the ConTeXt
%             Group journal or otherwise. Thanks to the editors for corrections. Also thanks
%             to users for testing, feedback and corrections.

\usemodule[mag-01,abr-02]

\setupcolors[rgb=no,cmyk=yes]

\definecolor[red]      [c=.25,m=.75,y=.75,k=.25]
\definecolor[green]    [c=.75,m=.25,y=.75,k=.25]
\definecolor[blue]     [c=.75,m=.75,y=.25,k=.25]

\definecolor[tred]     [c=.25,m=.75,y=.75,k=.25,t=.5,a=1]
\definecolor[tgreen]   [c=.75,m=.25,y=.75,k=.25,t=.5,a=1]
\definecolor[tblue]    [c=.75,m=.75,y=.25,k=.25,t=.5,a=1]
\definecolor[tblack]   [s=0,t=.75,a=1]

\definecolor[ocyan]    [c=.75]
\definecolor[omagenta] [m=.75]
\definecolor[oyellow]  [y=.75]
\definecolor[ogray]    [s=.5]

\startbuffer[abstract]
    Occasionally we experiment a bit with (\PDF) features that are useful but at
    the same time dangerous when applied uncontrolled. In the process of cleaning
    up some files in my source tree and triggered by a discussion about overprint
    I decided to move some of that code into the kernel. You are warned!
\stopbuffer


\startdocument
  [title={A Few Dangerous Features},
   author=Hans Hagen,
   affiliation=PRAGMA ADE,
   date=June 2004,
   number=6 \MKIV]

\subject{Remark}

The features discussed here have a so called global character, i.e. all settings
are global by nature. Future releases may introduce (and by default change to)
local behaviour. So, don't make your documents depending on local/global
behaviour. In most cases you will probably not notice the difference.

\subject{Being negative}

The \CONTEXT\ page imposition machinery provides negation because sometimes
raster image processors need that feature. In that case negation is applied to
the whole page. Within the document stream inverted colors are normally (and
best) realized with defining an appropriate color. For special purposes we also
provide negation

\startbuffer
\startcolor[red]\ignorespaces
    \input ward
    \startnegative\ignorespaces
        \input ward
        \startpositive\ignorespaces
            \input ward
        \removeunwantedspaces\stoppositive
        \input ward
    \removeunwantedspaces\stopnegative
    \input ward
\removeunwantedspaces\stopcolor
\stopbuffer

\typebuffer \getbuffer

We can also apply negation to graphic, but the result may not be what we expect.
While writing this document \in {figure} [fig:negated] negates well when view in
\GHOSTSCRIPT\ but \ACROBAT~6 shows a strange vertical line pattern.

\startbuffer
\startcombination
  {\startpositive
     \externalfigure[hacker.jpg][width=4cm]%
   \stoppositive}
  {normal}
  {\startnegative
     \externalfigure[hacker.jpg][width=4cm]%
   \stopnegative}
  {negative}
\stopcombination
\stopbuffer

\typebuffer

\placefigure
  [here] [fig:negated]
  {Negation of graphics.}
  {\getbuffer}

\subject{Font effects}

Another bag of tricks concerns font effects. As with negation and the to be
discussed overprint these are implemented using the \CONTEXT\ (still
experimental) feature handler, but this time we don't provide direct commands.
Instead we use arguments to control the effects.

\startbuffer
In this paragraph we have \starteffect[hidden]hidden a piece of
text\stopeffect. How useful this feature is depends on the kind
of documents you make. An alternative is to put the text in a
viewer layer (\starteffect[hidden]as provided by \PDF\stopeffect)
that is hidden, but since that feature is not widely available
the effects approach is safer.
\stopbuffer

\typebuffer \getbuffer

More interesting is changing the way a font is rendered. An outline version is
rendered with the \type {outer} effect.

\startbuffer
\bf \starteffect[outer]\input ward \stopeffect \par
\stopbuffer

\typebuffer \start \getbuffer \stop

The \type {inner} effect is the normal one so there is no reason to show it here.
The \type {both} option combines the two resulting in an extra bold version.

\startbuffer
\bf \starteffect[both]\input ward \stopeffect \par
\stopbuffer

\typebuffer \start \getbuffer \stop

You can influence the linewidth as is demonstrated in the following example:

\startbuffer
\setupeffect[outer][rulethickness=.8pt]
\bfd \starteffect[outer]Bigger is Beautiful\stopeffect
\stopbuffer

\typebuffer \start \getbuffer \stop

Speaking of 2004, in \CONTEXT\ (read: \TEX) intercharacter spacing can only be
achieved by macro processing. The next method works well, but you need to
manipulate the \type {\hsize} yourself, since the typesetting engine is unaware
of this backend manipulation.

\startbuffer
\setupeffect[both][stretch=2]
\setupalign[right]
\dontleavehmode \hsize=.6\hsize
\bf \starteffect[both]\input ward \stopeffect \par
\stopbuffer

\typebuffer \start \getbuffer \stop

The \type {normal} (or \type {inner}) alternative looks as follows:

\startbuffer
\setupeffect[normal][stretch=2]
\setupalign[right]
\dontleavehmode \hsize=.6\hsize
\bf \starteffect[normal]\input ward \stopeffect \par
\stopbuffer

\typebuffer \start \getbuffer \stop

\subject{Overprint and knockout}

Another feature that should be used with care is overprint. Normally a raster
image processor will knock out colored areas under colored text or areas on top.
This works well when the printing engine (or press) is able to precisely align
the color plates. If not, you will get artifacts that show up as follows (often
such effects occur in newspapers and cheap magazines):

\definelayer[fake][width=6cm,height=4cm]

\setlayerframed
  [fake]
  [preset=lefttop]
  [frame=off,width=8cm,height=4cm,
   background=color,backgroundcolor=blue,foregroundcolor=white]
  {\definedfont[SerifBold at 6\bodyfontsize]cheap}

\setlayerframed
  [fake]
  [preset=lefttop,offset=1pt]
  [frame=off,width=8cm,height=4cm,
   foregroundcolor=tblack]
  {\definedfont[SerifBold at 6\bodyfontsize]cheap}

\startbaselinecorrection
\tightlayer[fake]
\stopbaselinecorrection

On the one hand we get white spots and depending on how well the ink covers, we
can get darker spots as well. In such cases it's best to overprint the
background, which of course only works as expected when the top color is a well
covering black. Otherwise we probably may have to compensate the color, which in
turn depends on the kind of paper used.

At the document level, you can set the overprint with:

\starttyping
\setupcolors[overprint=yes]
\stoptyping

We show a few examples of local usage: a simple application first (\in {figure}
{a} [fig:overprint]):

\startbuffer[a]
\framed
  [background=color,backgroundcolor=ocyan,
   frame=off,offset=.25cm,strut=no]
  {\bfb\setstrut
   \startoverprint
   \framed
     [background=color,backgroundcolor=omagenta,
      foregroundcolor=oyellow,align={lohi,middle},
      frame=off,width=2.5cm,height=2cm]
     {overprint\\\startknockout knockout \stopknockout}%
   \stopoverprint
   \framed
     [background=color,backgroundcolor=omagenta,
      foregroundcolor=oyellow,align={lohi,middle},
      frame=off,width=2.5cm,height=2cm]
     {knockout\\\startoverprint overprint\stopoverprint}}%
\stopbuffer

\typebuffer[a]

We can nest overprint and turn it off as well (\in {figure} {b} [fig:overprint]):

\startbuffer[b]
\startoverprint
\framed
  [background=color,backgroundcolor=ocyan,
   frame=off,offset=.25cm,strut=no]
  {\bfb\setstrut
   \framed
     [background=color,backgroundcolor=omagenta,
      foregroundcolor=oyellow,align={lohi,middle},
      frame=off,width=2.5cm,height=2cm]
     {overprint\\\startknockout knockout\stopknockout}%
   \startknockout
   \framed
     [background=color,backgroundcolor=omagenta,
      foregroundcolor=oyellow,align={lohi,middle},
      frame=off,width=2.5cm,height=2cm]
     {knockout\\\startoverprint overprint\stopoverprint}%
   \stopknockout}%
\stopoverprint
\stopbuffer

\typebuffer[b]

Sometimes the overprint preview in \ACROBAT\ works better when we apply a gray
background (\in {figure} {c} [fig:overprint]). We use rather ugly pure \CMYK\
colors, otherwise the effect is not visible in overprint preview mode.

\startbuffer[c]
\framed
  [background=color,backgroundcolor=ogray,backgroundoffset=.25em,
   frame=off,offset=overlay]
  {\getbuffer[a]}
\stopbuffer

\typebuffer[c]

and (\in {figure} {d} [fig:overprint]):

\startbuffer[d]
\framed
  [background=color,backgroundcolor=ogray,backgroundoffset=.25em,
   frame=off,offset=overlay]
  {\getbuffer[b]}
\stopbuffer

\typebuffer[d]

\startbuffer
\startcombination[2*2]
  {\getbuffer[a]} {a}
  {\getbuffer[c]} {c}
  {\getbuffer[b]} {b}
  {\getbuffer[d]} {d}
\stopcombination
\stopbuffer

\placefigure
  [here] [fig:overprint]
  {Preview overprint and knockout.}
  {\getbuffer}

If we look at examples~b and~d of \in {figure} [fig:overprint]) in \ACROBAT\
overprint preview mode, we will see that the effect depends on where we apply the
overprint settings. As said, these are tricky features and should be used with
care and understanding.

\stopdocument