[metapost] problem with drawoptions and fake Euro symbol

Dan Luecking luecking at uark.edu
Wed Nov 14 01:47:36 CET 2007


At 02:38 PM 11/13/2007, you wrote:
>Hi,
>
>I'm trying to use Euro symbols in MetaPost source code that is generated
>by gnuplot's mp terminal.  The code makes heavy use of the drawoptions
>macro and this seems to interfere with fonts.

I wrote a lot of the code for the gnuplot mp terminal. I quit
supporting it when they began:
  1. Changing the MP code in ways I didn't agree with (without
     consulting me) and
  2. Changing the terminal interface without adequate (IMO)
     specifications for terminal authors.

This is one of those things that was discussed and for which I
suggested a correction (to someone). The suggestion was to rewrite
the macro that adds text so that it uses "addto currentpicture also"
instead of "draw" (thereby not invoking drawoptions). The correction
somehow never made it into the code. This bug can cause fraction bars
in TeX math to become dotted!

>drawoptions and (virtual) fonts to interfere.

DVI commands that draw a line (which is presumably what the virtual
font produces) are translated by dvitomp into line drawing commands
in the mpx file. These are added to a (temporary) picture _p. Then a
draw command (used directly or through label()) will add the drawoptions.
Then paths in that picture are subject to those options. When I wrote
gnuplot's MP code I wasn't aware of this, implicitly assuming that
once a picture was defined drawoptions would not affect its path
components.


>I can think of two causes for the problem:
>
>(i)  The fonts have a bug in the fake symbols.  The strange thing about
>this is, that two different implementations suffer from the same bug,
>then.  Only package eurosym seems to use a more robust solution for fake
>Euro symbols.
>
>(ii)  There is a problem with MetaPost's font handling.

Not really either of these. Rules in the dvi become paths in a picture
and then draw <picture> applies drawoptions to paths in that picture.

>beginfig(1);
>   label(btex 1000\euro etex, origin);
>   drawoptions(withpen pencircle scaled 2);
>   label(btex 1000\euro etex, (50,0));

Note that "label" is defined to mean "draw thelabel". To avoid
that invokation of draw, try:
   def addlabel = addto currentpicture also thelabel enddef;
then
   addlabel (btex 1000\euro etex, (50,0));


Dan


Daniel H. Luecking
Department of Mathematical Sciences
University of Arkansas
"Dubito ergo cogito, cogito ergo sum" --Descarte



More information about the metapost mailing list