On 1/30/07, Aditya Mahajan wrote:
I thought a bit about your feature request, and it is not too difficult to implement it. Here is a patch that allows you to use \sometext[font][iwona,20pt]{...}. Careful of spurious linebreaks.
%=======================================================
\long\def\redofiltersometxt[#1]% {\doifnextcharelse[{\reredofiltersometxt[#1]}{\redodofiltersometxt[#1]}}
\long\def\redodofiltersometxt[#1]#2% {\increment\txtcounter \TeXtext[#1]\txtcounter{#2}% \filtersometxt}
\long\def\reredofiltersometxt[#1][#2]#3% {\increment\txtcounter \TeXtext[#1]\txtcounter{\switchtobodyfont[#2]\strut#3}% \filtersometxt}
\definetextext[font]{\donothing}
\usetypescript[iwona][texnansi]
\starttext \startMPcode draw fullcircle xyscaled (3cm,2cm); label(\sometxt{Hello world!}, origin); \stopMPcode
% Does not cause any harm. \startMPcode draw fullcircle xyscaled (3cm,2cm); label(\sometxt[font]{Hello world!}, origin); \stopMPcode
\startMPcode draw fullcircle xyscaled (3cm,2cm); label(\sometxt[font][iwona,20pt]{Hello world!}, origin); \stopMPcode
\stoptext
%===============================================================
I haven't tested it, but I do not think that this should cause any problems with existing code.
If gnuplot doesn't fail with it, it probably means that it works OK ;) "Helvetica" seems to work OK here: http://dl.contextgarden.net/misc/gnuplot-context.zip (Usually I get dozens of error messages when applying something new, at least "memory limit exceeded" if everything else happens to work by accident ;) The most funny part was when practiacally all the labels were missing on one plot before I figured out that \setupbodyfont[somefont,14pt] \switchtobodyfont[some other font] doesn't work at all without defining bodyfontenvironment. Thank you very much again! The .tex file is still in its "pre-alpha" state, but at least I was able to "finalize" the terminal with a clean syntax ;)
Would that extra overhead be useful of gnuplot?
yes ... once I manage to convince the developers that the difference between these two plots might be relevant enough to justify an additional driver: http://gnuplot.sourceforge.net/demo_4.1/enhancedtext.html http://dl.contextgarden.net/misc/enhancedtext.pdf (I hope that Patrick will not be reading this before I manage to remove the files again ;) Mojca