Example MetaFun Cover Page

From Wiki
Jump to navigation Jump to search

from tex.stackexchange.com

\setupbodyfont [palatino]

\definecolor [Top] [h=a5b291]
\definecolor [Bottom] [h=b7c1a7]
\definecolor [TitleColor] [h=96433a]

\define[1]\titlefont{%
  \setcharacterkerning[extrakerning]%
  \cap
  \definedfont[#1]%
  \ignorespaces
}

\starttext

\startMPpage

    StartPage ;

    numeric w ; w := bbwidth(Page) ;
    numeric h ; h := bbheight(Page) ;

    fill (unitsquare xyscaled (w,.8h)) withcolor \MPcolor{Bottom} ;
    fill (unitsquare xyscaled (w,.2h) yshifted .8h) withcolor \MPcolor{Top} ;
    draw (0,.8h) -- (w,.8h) withpen pensquare scaled 2pt withcolor white ;

    draw textext.rt("\definedfont[Serif at 10pt]Author") shifted (.1w,.95h) ;
    draw textext.rt("\titlefont{Serif at 24pt} Cover Page Title") shifted (.1w,.85h) withcolor \MPcolor{TitleColor} ;
    draw textext.rt("\titlefont{SerifBold at 10pt} Subhead Title") shifted (.1w,.75h) withcolor \MPcolor{TitleColor} ;
    draw textext.rt("\titlefont{SerifBold at 10pt} Another subhead") shifted (.1w,.70h) ;


%    picture p; p := externalfigure "matterhorn.png" ;
%    draw p scaled (w/bbwidth p) ;

    StopPage ;

\stopMPpage

\stoptext