summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/fonts/manuals-explaining-cover.tex
blob: 8b4f3e891ba2c92d3a927eb568e9a5e8917f83b2 (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
% language=uk

% Please try to be original and don't just copy this cover page as I don't want
% confusion and be associated with (or responsibility for the look of) similar
% looking documents.

\startenvironment manuals-explaining-cover

\startsetups document:abstract
    \framed [
        foregroundstyle=bold,
        foregroundcolor=white,
        width=7.5cm,
        align={normal,tolerant},
        frame=off,
        strut=no,
    ] {
        \getbuffer[abstract]
    }
\stopsetups

\startMPinclusions

    def DrawCoverPage (expr what) =

        numeric variant ; variant := 1 ;

        StartCover ;

            save width, height, size, anchor, offset, colors ;

            numeric width, height, size ; pair anchor, offset ; string colors[] ;

            colors[1] := "\documentvariable{cover:color:1}" ;
            colors[2] := "\documentvariable{cover:color:2}" ;
            colors[3] := "\documentvariable{cover:color:3}" ;
            colors[4] := "\documentvariable{cover:color:4}" ;
            colors[5] := "\documentvariable{cover:color:5}" ;

            fill CoverPage enlarged PaperBleed withcolor colors[5] ;

            fill Spine bottomenlarged  -.5PaperHeight withcolor colors[3] ;
            fill Spine topenlarged     -.5PaperHeight withcolor colors[2] ;

            width  := FrontPageWidth ;
            height := FrontPageHeight ;
            size   := 4 * width / 3 ;
            offset := (-1cm,1cm) ;
            anchor := .5[lrcorner CoverPage,urcorner CoverPage] ;

            fill anchored.llft(lltriangle scaled size, urcorner FrontPage) withcolor colors[1] ;
            fill anchored.urt (urtriangle scaled size, llcorner FrontPage) withcolor colors[2] ;
            fill anchored.lrt (lrtriangle scaled size, ulcorner FrontPage) withcolor colors[3] ;
            fill anchored.ulft(ultriangle scaled size, lrcorner FrontPage) withcolor colors[4] ;

            fill anchored.lrt (lrtriangle scaled size, ulcorner BackPage) withcolor colors[1] ;
            fill anchored.llft(lltriangle scaled size, urcorner BackPage) withcolor colors[3] ;
            fill anchored.ulft(ultriangle scaled size, lrcorner BackPage) withcolor colors[2] ;
            fill anchored.urt (urtriangle scaled size, llcorner BackPage) withcolor colors[4] ;

            draw thetextext.llft(
                textext("\bf \documentvariable{title}\hskip-.1em")
                rotated 45 ysized .350height,
                anchor shifted (6*offset+offset)
            ) withcolor white ;
            draw thetextext.llft(
                textext("\bf \documentvariable{subtitle}")
                rotated 45 ysized .275height,
                anchor shifted (5*offset+offset)
            ) withcolor white ;
            draw thetextext.llft(
                textext("\bf \documentvariable{author}")
                rotated 45 ysized .200height,
                anchor shifted (2*offset+offset)
            ) withcolor white ;
            draw thetextext.llft(
                textext("\bf \documentvariable{affiliation}")
                rotated 45 ysized .200height,
                anchor shifted (1*offset+offset)
            ) withcolor white ;

            % for the moment

            if (what = "back") or (what = "cover") :

                draw
                    thetextext.top(
                        textext("\bf \documentvariable{comment}")
                        xsized 4cm,
                        lrcorner Page shifted (-3cm,1cm)
                    ) withcolor white ;

            fi ;

            % till here

            width := BackPageWidth ;

            if (what = "back") or (what = "cover") :

                draw thetextext(
                    textext("\bf\setups[document:abstract]")
                    xsized .65width rotated 45,
                    center BackPage
                ) withcolor white ;

            fi ;

            if what = "cover" :

                draw thetextext.bot(
                    textext("\bf \documentvariable{title}\hskip-.1em")
                    rotated 90 xsized .8SpineWidth,
                    .5[ulcorner Spine,urcorner Spine] shifted (0,-1cm)
                ) withcolor white ;

                draw thetextext.top(
                    textext("\bf \documentvariable{author}")
                    rotated 90 xsized .8SpineWidth,
                    .5[llcorner Spine,lrcorner Spine] shifted (0,1cm)
                ) withcolor white ;

            fi ;

        StopCover ;

        if what = "front" :
            clip currentpicture to FrontPage ;
        elseif what = "back" :
            clip currentpicture to BackPage ;
        else :
            drawboundary CoverPage ;
        fi ;

    enddef ;

\stopMPinclusions

\startsetups document:start

    % \startcovermatter[front]

    \setupbackgrounds[page][background=]

    \doifmodeelse {simple} {

        \startMPpage
            DrawCoverPage("front") ;
        \stopMPpage

    } {

        \startMPpage
            DrawCoverPage("cover") ;
        \stopMPpage

    }

    \page[dummy]

    \setupbackgrounds[page][background=page]

    \resetuserpagenumber

    % \stopcovermatter

\stopsetups

\startsetups document:stop

    \doifmodeelse {simple} {

        % \startcovermatter[back]

        \page

        \setuppagenumbering[page=]

        \setupbackgrounds[page][background=]

        \page[empty,left]

        \setupmakeup[doublesided=no,page=no]

        \startMPpage
            DrawCoverPage("back") ;
        \stopMPpage

        % \stopcovermatter

    } {

       % not needed as it's part of the cover page

    }

\stopsetups

\stopenvironment