%D \module
%D   [      file=s-pre-64,
%D        version=2006.05.11,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment 64,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

% To be documented, used in 2007

\usemodule[s][pre-60]

\newcounter\shapesynctag
\newdimen\slantedshapedimen
\newdimen\slantedshapestep
\newdimen\slantedshapeleftskip
\newdimen\slantedshapeoffset
\newdimen\slantedshapeextra

\positioningtrue

\def\AdaptShape
  {\doglobal\increment\shapesynctag
   \getnoflines\textheight
   \slantedshapestep\dimexpr\slantedshapeleftskip/\noflines\relax
   \leftskip\slantedshapeleftskip
   \scratchdimen\dimexpr\MPy{text:\MPp\shapesynctag}+\MPh{text:\MPp\shapesynctag}-\topskip-\MPy\shapesynctag\relax
   \advance\scratchdimen\slantedshapeextra
   \getnoflines\scratchdimen
   \slantedshapedimen \noflines \slantedshapestep
   \scratchtoks\emptytoks
   \dorecurse{30}
     {\appendetoks
         \the\dimexpr-\slantedshapedimen+\slantedshapeoffset \relax\space
         \the\dimexpr \hsize-2\slantedshapeoffset\relax\space
      \to\scratchtoks
      \advance\slantedshapedimen \slantedshapestep}%
   \parshape 30 \the\scratchtoks
   \strut\xypos\shapesynctag}

\def\AdaptShapeX
  {\doglobal\increment\shapesynctag
   \getnoflines\textheight
   \slantedshapestep\dimexpr\slantedshapeleftskip/\noflines\relax
   \leftskip\slantedshapeleftskip
   \scratchdimen\dimexpr\MPy{text:\MPp\shapesynctag}+\MPh{text:\MPp\shapesynctag}-\topskip-\MPy\shapesynctag\relax
   \advance\scratchdimen\slantedshapeextra
   \getnoflines\scratchdimen
   \slantedshapedimen \noflines \slantedshapestep
   \scratchtoks\emptytoks
   \dorecurse{30}
     {\appendetoks
         \the\dimexpr-\slantedshapedimen+\slantedshapeoffset +5cm \relax\space
         \the\dimexpr \hsize-2\slantedshapeoffset\relax\space
      \to\scratchtoks
      \advance\slantedshapedimen \slantedshapestep}%
   \parshape 30 \the\scratchtoks
   \strut\xypos\shapesynctag}

\setuppapersize[S6][S6]

\setupinteraction
  [state=start,
   click=no]

\setupinteractionscreen
  [option=max]

\setuplayout
  [backspace=12pt,
   topspace=24pt,
   height=middle,
   width=middle,
   header=0pt,
   footer=0pt]

\definecolor[maincolor][b=.5]
\definecolor[somecolor][g=.5]
\definecolor[morecolor][r=.5]

\setupcolors
  [textcolor=maincolor,
   state=start]

\setupbackgrounds
  [text]% [text]
  [background={base,text,invoke}]

\definelayer
  [text]
  [width=\textwidth,
   height=\textheight]

\definelayer
  [base]
  [width=\textwidth,
   height=\textheight]

\definetype [epet] [style=,color=morecolor]
\setuptype         [style=,color=somecolor]

\slantedshapeleftskip150pt
\slantedshapeoffset12pt
\slantedshapeextra10pt

\startreusableMPgraphic{page}
    StartPage ;
        fill Page withcolor \MPcolor{maincolor} ;
        path p ; p := Field[Text][Text] enlarged 6pt ;
        p :=
            llcorner p shifted (0,-12pt) --
            lrcorner p shifted (-150pt,0) --
            urcorner p shifted (0,12pt) --
            ulcorner p shifted (150pt,0) --
            cycle ;
        fill p
            withcolor .9white ;
    StopPage ;
\stopreusableMPgraphic

\defineoverlay[page][\reuseMPgraphic{page}]
\setupbackgrounds[page][background=page]

\setupalign[flushleft]

\def\StartItem
  {\blank[line]
   \begingroup
   \EveryPar {\AdaptShape}} % beware: \ABBREV aan begin gaat fout

\def\StopItem
  {\endgraf
   \endgroup
   \blank[line]}

\def\StartType
  {\blank[halfline]
   \begingroup
   \EveryPar {\AdaptShape}
   \dontleavehmode \quad}

\def\StopType
  {\endgraf
   \endgroup
   \blank[halfline]}

\def\Title#1%
  {\page
   \setlayer
     [text]
     [preset=lefttop,
      rotation=90]
     {\color[white]{\scale[height=24pt]{\strut#1}}}}

\def\SetBanner#1%
  {\setuplayer[base][state=repeat]
   \setlayer[base][preset=rightbottom]{\color[white]{\scale[height=9pt]{\strut#1}}}}

\let\TitleFont\relax

\startmode[atpragma]
    \definefontfeature[default][method=node,script=latn,language=dflt,liga=yes,onum=yes,kern=yes]
    \definefont[TitleFont][palatinosanscom-bold*default at 48pt]
    \definefont[MainTextFont][palatinosanscom-regular*default at 12pt] \setupinterlinespace[line=15pt]
    \appendtoks
        \MainTextFont % hack, as we define a bodyfont at that point (better have a proper typeface)
    \to \everystarttext
\stopmode

\doifnotmode{demo}{\endinput}

\starttext

\usemodule[abr-01]

\SetBanner{tug 2007 san diego}

\Title {hans hagen}

\startstandardmakeup \TitleFont \setupinterlinespace[line=3ex] \vfill

\StartItem \dontleavehmode \quad {\morecolor zapfino, a}   \StopItem
\StartItem \dontleavehmode \quad {\morecolor torture test} \StopItem
\StartItem \dontleavehmode \quad {\morecolor for luatex}   \StopItem

\vfill \stopstandardmakeup

\Title{loading fonts}

\StartSteps

\StartItem the \OPENTYPE\ font reader is borrowed from \FONTFORGE\  \FlushStep \StopItem
\StartItem once it was ready, we could look into such a font  \FlushStep \StopItem
\StartItem it tooks while to figure out the format due to rather fuzzy specs  \FlushStep \StopItem
\StartItem it took us even more time to find out that the loader was flawed  \FlushStep \StopItem
\StartItem one reason was that fonts themselves may have bugs or be incomplete \FlushStep \StopItem
\StartItem then we changed to \FONTFORGE\ version 2 \FlushStep \StopItem
\StartItem this made the missing pieces surface in more complex feature handling \FlushStep \StopItem
\StartItem while implementing features the new table format was cleaned up \FlushStep \StopItem

\StopSteps

\stoptext
