[NTG-context] Fonts, nice looking headers, MetaFun and CV module

Wolfgang Schuster schuster.wolfgang at googlemail.com
Mon Mar 19 19:08:55 CET 2007


On Mon, 19 Mar 2007 03:05:16 -0400
"Gudmundur J. Kristjansson" <gjk at vitum.net> wrote:

> Hi.
> 
> I'm been huffing and puffing the last few days trying to do my CV in 
> ConTeXt. My previous version used the LaTeX Curve package and I was 
> pretty happy with that.
> 
> I'm learning alot by doing this myself but some things have been pretty 
> hard. The hardest: trying to some kind of fancy section headers. I'm 
> pretty sure I should have been able to do this with the available 
> documentation but I've read and read and not been able to find a 
> solution.
> 
> Here's some of the things that my little brain can't comprehend:
> 
> 1. I'm thoroughly confused about how fonts work. From various 
> documents I found some that worked, for example:
> 
> \definetypeface [zapf] [cg] [calligraphy] [chancery]
> \switchtotypeface [zapf] [12pt,cg]
> 
> or 
> 
> \setupbodyfont[ber,pos]
> 
> But I can't seem to find any place that lists the fonts I can use or 
> how this actually works. Is there any standardized way, for example, 
> to change font in headers or definitions of commands to affect only 
> text in those definitions?
> 
> 2. Fancy header with half of the text in background color (see headers 
> in my former pdf at http://www.vitum.net/gjk/cv.pdf). 
> 

Hi Gudmundur,

below is a very simple solution to your problem.

\unprotect

\def\cvsection#1#2%
  {\bgroup
     \setbox\scratchbox\hbox{#2}%
     \!!dimena\dimexpr\ht\scratchbox+\dp\scratchbox\relax
     \lower\dp\scratchbox\hbox\!!to\zeropoint
       {\startcolor[darkgray]
        \vrule\c!height.5\!!dimena\c!width\hsize\hss
        \stopcolor}%
     \midaligned{\box\scratchbox}
   \egroup}

\protect

\setupcolors[state=start]

\setuphead
  [section]
  [command=\cvsection,
   textstyle=\ss\bf]

\starttext

\section{Work experience}

\stoptext

Wolfgang

> I tried various things here. Using \framed, MetaFun and \setupbackground. 
> For example:
> 
> \setupbackground
>     [leftoffset=0.3cm,
>      rightoffset=0.3cm
>      topoffset=-0.5cm,
>      bottomoffset=0.3cm,
>      background=color,
>      backgroundcolor=red]
> 
> I guess I'm misunderstanding the offset parameters.
> 
> 3. Framed texts with titles:
> 
> As explained in the MetaFun manual (Section 4.6, page 236) I tried 
> using the code in that section...
> 
> \FrameTitle{Zapf (1)}
> \StartFrame
> Coming back to the use of typefaces in electronic
> publishing: many of the new typographers receive their
> knowledge and information about the rules of typography from
> books, from computer magazines or the instruction manuals
> which they get with the purchase of a PC or software.
> \StopFrame
> 
> \startuseMPgraphic{FunnyFrame}
>   picture p ; numeric w, h, o ;
>   p := textext.rt(\MPstring{FunnyFrame}) ;
>   w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
>   p := p shifted (2o,h-ypart center p) ; draw p ;
>   drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
>   draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
>   draw boundingbox p ;
>   setbounds currentpicture to unitsquare xyscaled(w,h) ;
> \stopuseMPgraphic
> 
> defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
> defineframedtext[FunnyText][frame=off,background=FunnyFrame]
> \def\StartFrame{\startFunnyText}
> \def\StopFrame {\stopFunnyText }
> \def\FrameTitle#1%
>   {\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}}
> \setMPtext{FunnyFrame}{} % initialize the text variable
> 
> ...and I have the following problems:
> - The framing of the text is limited to a too narrow textwidth. I can't 
>   seem to find where I change that in the code.
> - Icelandic letters don't seem to work in titles or the text in the 
>   frames. They do work in other places in the document, though.
> 
> Phew, that's enough for now. If any of you guys/gals have other ideas on 
> how to do nice looking headers I'm open to everything.
> 
> Btw, I love using ConTeXt and really appreciate all your hard work.
> 
> P.S. Is there any CV package for ConTeXt out there? If not I could post 
> my work (if people like what I did) to the ConTeXt wiki for others to use.
> 
> -- 
> Best regards / Kær kveðja,
> Gudmundur J. Kristjansson / Guðmundur J. Kristjánsson
> gjk at vitum.net | gvendurjaki at gmail.com |
> USA Tel. +347-821-9855.
> Icelandic Tel. +354-893-4444.
> 
> 
> 
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context at ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context


More information about the ntg-context mailing list