On Wed, Dec 3, 2008 at 5:00 PM, Hans Hagen wrote:
Mojca Miklavec wrote:
Is there any special reason why the old code doesn't work on mkiv? I have found one possible explanation, though I'm not sure about that:
This works:
picture a; a := \sometxt{rotated}; gp_put_text((1cm, 1cm), angle(30), a);
but this doesn't:
gp_put_text((1cm, 1cm), angle(30), \sometxt{rotated});
What does metapost see in mkiv when one puts \sometxt there? Maybe that explains the problem.
\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")}
so, it sees textext.drt("somestring")
Thanks a lot! I have found a workaround in that case. I can redefine textext to catch it, revert the weird changes done earlier and finally call the original function: vardef textext@#(expr txt) = let,=@; % this line is needed to annulate earlier hacks thetextext(rawtextext(txt),origin) enddef ; I don't clam that this is a nice thing to do, but it's still better than non-functional code. Another option would be (in the language of TeX, but probably possible to translate to metapost): \let\originaltextext=\textext \def\textext#1{\sometrickeryreversal\originaltextext{#1}} Thanks again, Mojca