mag-0006-mkiv.tex /size: 9755 b    last modification: 2023-12-21 09:43
1% language=us
2
3% author    : Hans Hagen
4% copyright : ConTeXt Development Team
5% license   : Creative Commons Attribution ShareAlike 4.0 International
6% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
7% origin    : the ConTeXt distribution
8%
9% comment   : Because this manual is distributed with TeX distributions it comes with a rather
10%             liberal license. We try to adapt these documents to upgrades in the (sub)systems
11%             that they describe. Using parts of the content otherwise can therefore conflict
12%             with existing functionality and we cannot be held responsible for that. Many of
13%             the manuals contain characteristic graphics and personal notes or examples that
14%             make no sense when used out-of-context.
15%
16% comment   : Some chapters might have been published in TugBoat, the NTG Maps, the ConTeXt
17%             Group journal or otherwise. Thanks to the editors for corrections. Also thanks
18%             to users for testing, feedback and corrections.
19
20\usemodule[mag-01,abr-02]
21
22\setupcolors[rgb=no,cmyk=yes]
23
24\definecolor[red]      [c=.25,m=.75,y=.75,k=.25]
25\definecolor[green]    [c=.75,m=.25,y=.75,k=.25]
26\definecolor[blue]     [c=.75,m=.75,y=.25,k=.25]
27
28\definecolor[tred]     [c=.25,m=.75,y=.75,k=.25,t=.5,a=1]
29\definecolor[tgreen]   [c=.75,m=.25,y=.75,k=.25,t=.5,a=1]
30\definecolor[tblue]    [c=.75,m=.75,y=.25,k=.25,t=.5,a=1]
31\definecolor[tblack]   [s=0,t=.75,a=1]
32
33\definecolor[ocyan]    [c=.75]
34\definecolor[omagenta] [m=.75]
35\definecolor[oyellow]  [y=.75]
36\definecolor[ogray]    [s=.5]
37
38\startbuffer[abstract]
39    Occasionally we experiment a bit with (\PDF) features that are useful but at
40    the same time dangerous when applied uncontrolled. In the process of cleaning
41    up some files in my source tree and triggered by a discussion about overprint
42    I decided to move some of that code into the kernel. You are warned!
43\stopbuffer
44
45
46\startdocument
47  [title={A Few Dangerous Features},
48   author=Hans Hagen,
49   affiliation=PRAGMA ADE,
50   date=June 2004,
51   number=6 \MKIV]
52
53\subject{Remark}
54
55The features discussed here have a so called global character, i.e. all settings
56are global by nature. Future releases may introduce (and by default change to)
57local behaviour. So, don't make your documents depending on local/global
58behaviour. In most cases you will probably not notice the difference.
59
60\subject{Being negative}
61
62The \CONTEXT\ page imposition machinery provides negation because sometimes
63raster image processors need that feature. In that case negation is applied to
64the whole page. Within the document stream inverted colors are normally (and
65best) realized with defining an appropriate color. For special purposes we also
66provide negation
67
68\startbuffer
69\startcolor[red]\ignorespaces
70    \input ward
71    \startnegative\ignorespaces
72        \input ward
73        \startpositive\ignorespaces
74            \input ward
75        \removeunwantedspaces\stoppositive
76        \input ward
77    \removeunwantedspaces\stopnegative
78    \input ward
79\removeunwantedspaces\stopcolor
80\stopbuffer
81
82\typebuffer \getbuffer
83
84We can also apply negation to graphic, but the result may not be what we expect.
85While writing this document \in {figure} [fig:negated] negates well when view in
86\GHOSTSCRIPT\ but \ACROBAT~6 shows a strange vertical line pattern.
87
88\startbuffer
89\startcombination
90  {\startpositive
91     \externalfigure[hacker.jpg][width=4cm]%
92   \stoppositive}
93  {normal}
94  {\startnegative
95     \externalfigure[hacker.jpg][width=4cm]%
96   \stopnegative}
97  {negative}
98\stopcombination
99\stopbuffer
100
101\typebuffer
102
103\placefigure
104  [here] [fig:negated]
105  {Negation of graphics.}
106  {\getbuffer}
107
108\subject{Font effects}
109
110Another bag of tricks concerns font effects. As with negation and the to be
111discussed overprint these are implemented using the \CONTEXT\ (still
112experimental) feature handler, but this time we don't provide direct commands.
113Instead we use arguments to control the effects.
114
115\startbuffer
116In this paragraph we have \starteffect[hidden]hidden a piece of
117text\stopeffect. How useful this feature is depends on the kind
118of documents you make. An alternative is to put the text in a
119viewer layer (\starteffect[hidden]as provided by \PDF\stopeffect)
120that is hidden, but since that feature is not widely available
121the effects approach is safer.
122\stopbuffer
123
124\typebuffer \getbuffer
125
126More interesting is changing the way a font is rendered. An outline version is
127rendered with the \type {outer} effect.
128
129\startbuffer
130\bf \starteffect[outer]\input ward \stopeffect \par
131\stopbuffer
132
133\typebuffer \start \getbuffer \stop
134
135The \type {inner} effect is the normal one so there is no reason to show it here.
136The \type {both} option combines the two resulting in an extra bold version.
137
138\startbuffer
139\bf \starteffect[both]\input ward \stopeffect \par
140\stopbuffer
141
142\typebuffer \start \getbuffer \stop
143
144You can influence the linewidth as is demonstrated in the following example:
145
146\startbuffer
147\setupeffect[outer][rulethickness=.8pt]
148\bfd \starteffect[outer]Bigger is Beautiful\stopeffect
149\stopbuffer
150
151\typebuffer \start \getbuffer \stop
152
153Speaking of 2004, in \CONTEXT\ (read: \TEX) intercharacter spacing can only be
154achieved by macro processing. The next method works well, but you need to
155manipulate the \type {\hsize} yourself, since the typesetting engine is unaware
156of this backend manipulation.
157
158\startbuffer
159\setupeffect[both][stretch=2]
160\setupalign[right]
161\dontleavehmode \hsize=.6\hsize
162\bf \starteffect[both]\input ward \stopeffect \par
163\stopbuffer
164
165\typebuffer \start \getbuffer \stop
166
167The \type {normal} (or \type {inner}) alternative looks as follows:
168
169\startbuffer
170\setupeffect[normal][stretch=2]
171\setupalign[right]
172\dontleavehmode \hsize=.6\hsize
173\bf \starteffect[normal]\input ward \stopeffect \par
174\stopbuffer
175
176\typebuffer \start \getbuffer \stop
177
178\subject{Overprint and knockout}
179
180Another feature that should be used with care is overprint. Normally a raster
181image processor will knock out colored areas under colored text or areas on top.
182This works well when the printing engine (or press) is able to precisely align
183the color plates. If not, you will get artifacts that show up as follows (often
184such effects occur in newspapers and cheap magazines):
185
186\definelayer[fake][width=6cm,height=4cm]
187
188\setlayerframed
189  [fake]
190  [preset=lefttop]
191  [frame=off,width=8cm,height=4cm,
192   background=color,backgroundcolor=blue,foregroundcolor=white]
193  {\definedfont[SerifBold at 6\bodyfontsize]cheap}
194
195\setlayerframed
196  [fake]
197  [preset=lefttop,offset=1pt]
198  [frame=off,width=8cm,height=4cm,
199   foregroundcolor=tblack]
200  {\definedfont[SerifBold at 6\bodyfontsize]cheap}
201
202\startbaselinecorrection
203\tightlayer[fake]
204\stopbaselinecorrection
205
206On the one hand we get white spots and depending on how well the ink covers, we
207can get darker spots as well. In such cases it's best to overprint the
208background, which of course only works as expected when the top color is a well
209covering black. Otherwise we probably may have to compensate the color, which in
210turn depends on the kind of paper used.
211
212At the document level, you can set the overprint with:
213
214\starttyping
215\setupcolors[overprint=yes]
216\stoptyping
217
218We show a few examples of local usage: a simple application first (\in {figure}
219{a} [fig:overprint]):
220
221\startbuffer[a]
222\framed
223  [background=color,backgroundcolor=ocyan,
224   frame=off,offset=.25cm,strut=no]
225  {\bfb\setstrut
226   \startoverprint
227   \framed
228     [background=color,backgroundcolor=omagenta,
229      foregroundcolor=oyellow,align={lohi,middle},
230      frame=off,width=2.5cm,height=2cm]
231     {overprint\\\startknockout knockout \stopknockout}%
232   \stopoverprint
233   \framed
234     [background=color,backgroundcolor=omagenta,
235      foregroundcolor=oyellow,align={lohi,middle},
236      frame=off,width=2.5cm,height=2cm]
237     {knockout\\\startoverprint overprint\stopoverprint}}%
238\stopbuffer
239
240\typebuffer[a]
241
242We can nest overprint and turn it off as well (\in {figure} {b} [fig:overprint]):
243
244\startbuffer[b]
245\startoverprint
246\framed
247  [background=color,backgroundcolor=ocyan,
248   frame=off,offset=.25cm,strut=no]
249  {\bfb\setstrut
250   \framed
251     [background=color,backgroundcolor=omagenta,
252      foregroundcolor=oyellow,align={lohi,middle},
253      frame=off,width=2.5cm,height=2cm]
254     {overprint\\\startknockout knockout\stopknockout}%
255   \startknockout
256   \framed
257     [background=color,backgroundcolor=omagenta,
258      foregroundcolor=oyellow,align={lohi,middle},
259      frame=off,width=2.5cm,height=2cm]
260     {knockout\\\startoverprint overprint\stopoverprint}%
261   \stopknockout}%
262\stopoverprint
263\stopbuffer
264
265\typebuffer[b]
266
267Sometimes the overprint preview in \ACROBAT\ works better when we apply a gray
268background (\in {figure} {c} [fig:overprint]). We use rather ugly pure \CMYK\
269colors, otherwise the effect is not visible in overprint preview mode.
270
271\startbuffer[c]
272\framed
273  [background=color,backgroundcolor=ogray,backgroundoffset=.25em,
274   frame=off,offset=overlay]
275  {\getbuffer[a]}
276\stopbuffer
277
278\typebuffer[c]
279
280and (\in {figure} {d} [fig:overprint]):
281
282\startbuffer[d]
283\framed
284  [background=color,backgroundcolor=ogray,backgroundoffset=.25em,
285   frame=off,offset=overlay]
286  {\getbuffer[b]}
287\stopbuffer
288
289\typebuffer[d]
290
291\startbuffer
292\startcombination[2*2]
293  {\getbuffer[a]} {a}
294  {\getbuffer[c]} {c}
295  {\getbuffer[b]} {b}
296  {\getbuffer[d]} {d}
297\stopcombination
298\stopbuffer
299
300\placefigure
301  [here] [fig:overprint]
302  {Preview overprint and knockout.}
303  {\getbuffer}
304
305If we look at examples~b and~d of \in {figure} [fig:overprint]) in \ACROBAT\
306overprint preview mode, we will see that the effect depends on where we apply the
307overprint settings. As said, these are tricky features and should be used with
308care and understanding.
309
310\stopdocument
311