summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/node-ext.mkxl
blob: 697bb7d29774c9809b2d2d6d9b9af345b49539c0 (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
%D \module
%D   [       file=back-ext,
%D        version=2019.02.08, % and later, merged file
%D          title=\CONTEXT\ Backend Macros,
%D       subtitle=Output,
%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.

\registerctxluafile{node-ext}{autosuffix}

\unprotect

% \let\normalopenout \openout
% \let\normalwrite   \write
% \let\normalcloseout\closeout
% \let\normallatelua \latelua
% \let\normalspecial \special

% rotation

% \permanent\protected\def\dostartrotation#1{\forcecolorhack\clf_startrotation#1\relax}
% \permanent\protected\def\dostoprotation   {\clf_stoprotation\forcecolorhack}

\permanent\protected\def\dostartrotation#1{\clf_startrotation#1\relax}
\permanent\protected\def\dostoprotation   {\clf_stoprotation}

% scaling

% \permanent\protected\def\dostartscaling#1#2{\forcecolorhack\clf_startscaling rx #1 ry #2\relax}
% \permanent\protected\def\dostopscaling     {\clf_stopscaling\forcecolorhack}

\permanent\protected\def\dostartscaling#1#2{\clf_startscaling rx #1 ry #2\relax}
\permanent\protected\def\dostopscaling     {\clf_stopscaling}

% mirroring

\permanent\protected\def\dostartmirroring{\clf_startmirroring}
\permanent\protected\def\dostopmirroring {\clf_stopmirroring}

% transform

\permanent\protected\def\dotransformnextbox#1#2#3#4#5#6%
  {\dowithnextbox{\dodotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}}}

\permanent\protected\def\dodotransformnextbox#1#2#3#4#5#6%
  {\hpack
     {\kern #5\onebasepoint
      \raise#6\onebasepoint
      \hpack
        {\clf_startmatrix rx #1 sx #2 sy #3 ry #4\relax
         \box\nextbox
         \clf_stopmatrix}}}

%D \macros
%D   {dostartclipping,dostopclipping}
%D
%D Clipping is implemented in such a way that an arbitrary code can be fed.
%D
%D \starttyping
%D \dostartclipping {pathname} {width} {height}
%D \dostopclipping
%D \stoptyping

\mutable\let\MPclippath\empty

% \permanent\protected\def\dostartclipping#1#2#3% we can move this to lua and only set a box here
%   {\forcecolorhack
%    \meta_grab_clip_path{#1}{#2}{#3}%
%    \clf_startclipping{\MPclippath}%
%    \glet\MPclippath\empty}

\permanent\protected\def\dostartclipping#1#2#3% we can move this to lua and only set a box here
  {\meta_grab_clip_path{#1}{#2}{#3}%
   \clf_startclipping{\MPclippath}%
   \glet\MPclippath\empty}

\permanent\protected\def\dostopclipping
  {\clf_stopclipping}

%D This wrapper is needed when you use code that messes with e.g. local color
%D directives, invisible for the rest of the machinery. It's only needed in very
%D special cases, like around the above scaler directives:

\permanent\protected\edef\hcontainer{\hpack \s!direction\directionlefttoright \s!container\space}
\permanent\protected\edef\vcontainer{\vpack \s!direction\directionlefttoright \s!container\space}
\permanent\protected\edef\tcontainer{\tpack \s!direction\directionlefttoright \s!container\space}

\protect \endinput