%D \module %D [ file=meta-tex, %D version=2006.06.07, %D title=\CONTEXT\ Support Macros, %D subtitle=\METAPOST\ fast text insertion, %D author=Hans Hagen, %D date=\currentdate, %D copyright=\PRAGMA] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. \unprotect % Ok, we support this in MkIV because Mojca kept the pressure on. It % looks a bit like a hack. \long\def\startTeXtexts#1\stopTeXtexts {#1} \long\def\TeXtext {\dosingleempty\doTeXtext} \long\def\doTeXtext[#1]#2#3% contrary to mkii we don't process yet but we do expand {\long\setxvalue{@@st@@::#2}{\noexpand\dodoTeXtext{#1}{#3}}} \long\def\dodoTeXtext#1#2% {\begingroup \setbox\nextbox\hbox{\executeifdefined{textext@@#1}\firstofoneargument{#2}}% \executeifdefined{textext::#1}{\getvalue{textext::depth}}% \box\nextbox \endgroup} \def\getTeXtext#1% {\getvalue{@@st@@::#1}} \setvalue{textext::d}{\setbox\nextbox\hbox{\lower\dp\nextbox\box\nextbox}} % unchecked \setvalue{textext::n}{} % unchecked \setvalue {textext::depth}{\getvalue{textext::d}} \setvalue{textext::nodepth}{\getvalue{textext::n}} % \definetextext[framed]{\framed} % % \startMPcode % draw \sometxt[framed]{black} rotated 45 ; % \stopMPcode \unexpanded\def\definetextext[#1]#2{\setvalue{@@st@@[#1]}{#2}\setvalue{@@st@@[#1] }{#2}} % we don't grab spaces after [#1] \long\def\sometxt#1#{\dosometxt{#1}} % grab optional [args] \long\def\dosometxt#1#2% {textext.drt("\ifcsname @@st@@#1\endcsname\csname @@st@@#1\endcsname{#2}\else#2\fi")} % Best use the mp macro instead since it provides positioning. % % \startuseMPgraphic{testgraphic} % draw \sometxt{\ruledhbox{\strut hans hagen}} scaled 3; % % draw textext.drt("\ruledhbox{\strut hans hagen}") scaled 3; % % draw textext.dlft("\ruledhbox{\strut hans hagen}") scaled 3; % % draw textext.lft("\ruledhbox{\strut hans hagen}") scaled 3; % draw llcorner currentpicture -- urcorner currentpicture withcolor yellow; % draw lrcorner currentpicture -- ulcorner currentpicture withcolor yellow; % draw boundingbox currentpicture withcolor blue ; % draw origin withcolor red withpen pencircle scaled 1pt; % \stopuseMPgraphic % % {\showstruts\useMPgraphic{testgraphic}} \protect \endinput