[metapost] problem with drawoptions and fake Euro symbol

Hartmut Henkel hartmut_henkel at gmx.de
Wed Nov 14 01:58:55 CET 2007


On Tue, 13 Nov 2007, Stephan Hennig wrote:

> 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.
>
> The eurofont package provides access to three different fonts that
> actually provide (fake) Euro symbols, namely adobeeurofonts, marvosym
> and eurosym.  With package options adobeeurofonts and marvosym
> horizontal rules in fake Euro symbols depend on MetaPost's drawoptions
> settings and can come out too heavy or too light, depending on pen
> width.  This looks very bad (see attached file) and I wouldn't expect
> drawoptions and (virtual) fonts to interfere.
>
> 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.
>
> What do people think?

> verbatimtex
> \documentclass{article}
> \usepackage[T1]{fontenc}
> \usepackage{lmodern}
> \usepackage[adobeeurofonts]{eurofont}% fails
> % \usepackage[marvosym]{eurofont}% fails
> % \usepackage[eurosym,gen]{eurofont}% works
> \begin{document}
> etex
> prologues:=3;
> beginfig(1);
>   label(btex 1000\euro etex, origin);
>   drawoptions(withpen pencircle scaled 2);
>   label(btex 1000\euro etex, (50,0));
> endfig;
> end

What happens is that label() expands into a draw macro (see plain.mp)
which in turn triggers the inclusion of drawoptions _op_ at the end. And
these drawoptions are not applied to line drawing only, they are
effective for picture drawing also (!), e. g. in

beginfig(1)
picture a;
a=image(draw fullcircle scaled 10mm);
draw a dashed evenly.
endfig;
end

the fullcircle is drawn in dashed mode.

To get rid of this effect on label one could temporarly define label
with the lower level addto primitive like

def label = addto currentpicture also thelabel enddef;

in which case no _op_ stuff is used. Then the \euro is drawn correctly.

Maybe drawoptions/_op_ should be activated only for drawing paths, but
not for drawing pictures?

Regards, Hartmut


More information about the metapost mailing list