Thanks Max that works perfectly! But It would still be useful if I could change families inside a MPpage.
> I'm using the following macro to set the font size via h-height:
>
> \starttexdefinition setxheight [#1][#2]
> \switchtobodyfont[#1, 12pt]
> \scratchdimen=\dimexpr#2\relax
> \switchtobodyfont[#1, \cldcontext{tex.dimen.scratchdimen / tex.sp"1ex"
> * tex.sp"1em" .. "sp"}]
> \stoptexdefinition
>
> But I can't figure out how to use that in MPpage.
So it looks like the "\cldcontext" command doesn't work quite right
inside "textext", and it also looks like "\switchtobodyfont" doesn't
take effect until text is actually typeset when we're inside "textext".
This seems to work:
\starttexdefinition setxheight [#1]
\switchtobodyfont[\the\dimexpr #1 * \number\dimexpr1em\relax / \number\dimexpr1ex\relax \relax]
\stoptexdefinition
\starttext
\switchtobodyfont[adventor]
\startMPpage
draw textext.origin("\setxheight[1cm]Hello!");
draw (0, 1cm) -- (6cm, 1cm);
\stopMPpage
\switchtobodyfont[pagella]
\startMPpage
draw textext.origin("\setxheight[1cm]Hello!");
draw (0, 1cm) -- (6cm, 1cm);
\stopMPpage
\switchtobodyfont[heros]
\startMPpage
draw textext.origin("\setxheight[6pt]Hello!");
draw textext.origin("\setxheight[24pt]Hello!");
draw (0, 6pt) -- (6cm, 6pt);
draw (0, 24pt) -- (6cm, 24pt);
\stopMPpage
\stoptext
The catch here is that you need to set the font family *before* you
start the MPpage.
-- Max