summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/prop-mis.mkii
blob: 47fb9ea0661ea8b59ac0b66587d147ccd29fdd7d (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
%D \module
%D   [       file=prop-mis,
%D        version=2004.05.29, % some code moved from private modules
%D          title=\CONTEXT\ Property Macros,
%D       subtitle=Miscelaneous,
%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.

\writestatus{loading}{ConTeXt Property Macros / Miscelaneous}

%D This module contains some code that has been in use in some
%D private modules (p-*). These features depend on the fact
%D that pdftex writes the page content as one stream.

%D EXPERIMENTAL

\unprotect

%D Stream based overprint and knockout:

\defineproperty[\v!overprint][\s!overprint] [\c!method=\v!command]
\defineproperty[\v!knockout] [\s!overprint] [\c!method=\v!command]

%D Negation.

\defineproperty [\v!negative] [\s!negative] [\c!method=\v!command]
\defineproperty [\v!positive] [\s!negative] [\c!method=\v!command]

%D Special font effects.

\setupproperty
  [\s!effect]
  [\c!rulethickness=\zeropoint,
   \c!stretch=0]

\defineproperty [\v!inner]   [\s!effect] [\c!rulethickness=.25pt]
\defineproperty [\v!outer]   [\s!effect] [\c!rulethickness=.25pt]
\defineproperty [\v!both]    [\s!effect] [\c!rulethickness=.25pt]
\defineproperty [\v!normal]  [\s!effect]
\defineproperty [\v!hidden]  [\s!effect]

\defineproperty [\v!stretch] [\s!effect] [\c!stretch=1]

%D Overprint cum suis.

\definepropertyhandler \v!overprint {\dostartoverprint}
\definepropertyhandler \v!knockout  {\dostopoverprint }

\def\startoverprintproperty
  {\ifincolor
     \propertyhandler\currentproperty
     \dooverprintmark\currentproperty
   \fi}

\def\stopoverprintproperty
  {\ifincolor
     \ifcase\currentpropertylevel\or
       \dostopoverprint
       \dooverprintmark\empty
     \else
       \propertyhandler\previousproperty
       \dooverprintmark\previousproperty
     \fi
   \fi}

\rawnewmark\overprintmark

\def\dooverprintmark#1%
  {\ifinpagebody \else \ifinframed \else
     \expanded{\rawsetmark\noexpand\overprintmark{#1}}%
   \fi \fi}

\def\pushoverprintproperty
  {\doifsomething{\rawgetbotmark\overprintmark}\dostopoverprint}

\def\popoverprintproperty
  {\doifsomething{\rawgetbotmark\overprintmark}%
     {\propertyhandler{\rawgetbotmark\overprintmark}}}

\def\popsplitoverprintproperty
  {\getsplitmarks\overprintmark  % hier wel
   \doifsomething{\rawgetsplitbotmark\overprintmark}%
     {\propertyhandler{\rawgetsplitbotmark\overprintmark}}}

\appendtoks \pushoverprintproperty     \to \everypushproperties
\appendtoks \popoverprintproperty      \to \everypopproperties
\appendtoks \popsplitoverprintproperty \to \everypopsplitproperties

%D Negative cum suis.

\definepropertyhandler \v!negative {\dostartnegative}
\definepropertyhandler \v!positive {\dostopnegative }

\def\startnegativeproperty
  {\ifincolor
     \propertyhandler\currentproperty
     \donegativemark\currentproperty
   \fi}

\def\stopnegativeproperty
  {\ifincolor
     \ifcase\currentpropertylevel\or
       \dostopnegative
       \donegativemark\empty
     \else
       \propertyhandler\previousproperty
       \donegativemark\previousproperty
     \fi
   \fi}

\rawnewmark\negativemark

\def\donegativemark#1%
  {\ifinpagebody \else \ifinframed \else
     \expanded{\rawsetmark\noexpand\negativemark{#1}}%
   \fi \fi}

\def\pushnegativeproperty
  {\doifsomething{\rawgetbotmark\negativemark}\dostopnegative}

\def\popnegativeproperty
  {\doifsomething{\rawgetbotmark\overprintmark}%
     {\propertyhandler{\rawgetbotmark\negativemark}}}

\def\popsplitnegativeproperty
  {\getsplitmarks\negativemark  % hier wel
   \doifsomething{\rawgetsplitbotmark\negativemark}%
     {\propertyhandler{\rawgetsplitbotmark\negativemark}}}

\appendtoks \pushnegativeproperty     \to \everypushproperties
\appendtoks \popnegativeproperty      \to \everypopproperties
\appendtoks \popsplitnegativeproperty \to \everypopsplitproperties

%D Effects.

\definepropertyhandler \v!normal {0}
\definepropertyhandler \v!inner  {0}
\definepropertyhandler \v!outer  {1}
\definepropertyhandler \v!both   {2}
\definepropertyhandler \v!hidden {3}
\definepropertyhandler \v!stretch{0}

\def\effectpropertydata#1%
  {{\propertyhandler{#1}}%
   {\propertyparameter{#1}\c!rulethickness}%
   {\propertyparameter{#1}\c!stretch}}

\def\starteffectproperty
  {\expanded{\dostartfonteffect\effectpropertydata\currentproperty}%
   \doeffectmark{\effectpropertydata\currentproperty}}

\def\stopeffectproperty
  {\dostopfonteffect
   \ifcase\currentpropertylevel\or
     \doeffectmark\empty
   \else
     \expanded{\dostartfonteffect\effectpropertydata\previousproperty}%
     \doeffectmark{\effectpropertydata\previousproperty}%
   \fi}

\rawnewmark\effectmark

\def\doeffectmark#1%
  {\ifinpagebody \else \ifinframed \else
     \expanded{\rawsetmark\noexpand\effectmark{#1}}% could be number
   \fi \fi}

\def\pusheffectproperty
  {\doifsomething{\rawgetbotmark\effectmark}\dostopfonteffect}

\def\popeffectproperty
  {\doifsomething{\rawgetbotmark\effectmark}%
     {\expanded{\dostartfonteffect\rawgetbotmark\effectmark}}}

\def\popspliteffectproperty
  {\getsplitmarks\effectmark
   \doifsomething{\rawgetsplitbotmark\effectmark}%
     {\expanded{\dostartfonteffect\rawgetsplitbotmark\effectmark}}}

\appendtoks \pusheffectproperty     \to \everypushproperties
\appendtoks \popeffectproperty      \to \everypopproperties
\appendtoks \popspliteffectproperty \to \everypopsplitproperties

\protect \endinput