
\newdimen\Spinewidth
\newdimen\SpineOffset
\Spinewidth=6mm
\useexternalfigure[MAG][_pdf/magazine.pdf]
\def\ISSUE{34}
\def\TOPIC{Topic}
\def\LastPage{112} % don’t know how to compute that

\SpineOffset=\dimexpr(\Spinewidth - 9pt)/5\relax

\definepapersize[Cover]
  [width=\dimexpr 420mm + \Spinewidth\relax,
  height=297mm]
\setuppapersize[Cover]
\usetypescriptfile[myfont]
\setupbodyfont[myfont,9pt]
\setuplayout[
  marking=on,
]
\setuppagenumbering[state=stop]

\definelayer[whole]
  [width=\paperwidth,
  height=\paperheight]
\setupbackgrounds[page][background={whole},state=start]

\definecolor[cmykblack][c=0,m=0,y=0,k=1]
\setupcolors[
  pagecolormodel=auto,
  rgb=no,cmyk=yes,spot=no,
  state=start,
  overprint=yes,
  intent={Uncoated FOGRA29 (ISO 12647-2:2004)},
  textcolor=cmykblack
]
\starttext
\strut

\setlayer[whole]
  [hoffset=0mm,
  voffset=0mm]{%
  \externalfigure[MAG][page=\LastPage]}

\setlayer[whole]
  [hoffset=\dimexpr 210mm + \Spinewidth\relax,
  voffset=0mm]{%
  \externalfigure[MAG][page=1]}

\setlayerframed[whole]
    [x=210mm,
    y=20mm,
    frame=off,
    offset=overlay,
    width=\Spinewidth,
    align=center]{\ISSUE}

\setlayerframed[whole]
  [x=210mm,y=92mm,
  frame=off,
  offset=overlay,
  align=right,
  width=\Spinewidth,
  height=190mm,
  %height=\dimexpr\paperheight -15mm\relax,
  ]{%
  \rotate[rotation=90,
  align={right,middle},
  frame=off,
  height=\Spinewidth,
  width=190mm,
  ]{\vskip\SpineOffset\vbox{MAGAZINE\hfill\TOPIC}}}

\stoptext
