Wojciech A. Koszek | 3 Dec 10:17 2014

With prologues=3 and SVG output, METAPOST dies with SIGSEGV


I wanted to document my solution to a problem from the ``Cracking the coding
interview'' on measuring angles between clock's pointers. I have 1 figure
for this for now, and METAPOST crashes when I try to compile my image.

I figured it works fine with prologues=1 or 2 for both MPS and SVG output.

For prologues=3 it works fine with MPS, but gets a SIGSEGV with SVG as an


Will finish OK:

	wget -O bug_2.mp http://pastebin.com/5irnjVHB
	mpost bug_2.mp

No go and make g_use_svg = 1. It will fails with ``Segmentation fault''.


	wkoszek|1:08:06|0|/home/wkoszek/o/mp$ mpost --version

	MetaPost 1.208
	Copyright 2009 AT&T Bell Laboratories.
	There is NO warranty.  Redistribution of this software is
	covered by the terms of both the MetaPost copyright and
	the Lesser GNU Lesser General Public License.
	For more information about these matters, see the files
(Continue reading)

Wojciech A. Koszek | 3 Dec 10:16 2014

Command "show" on a non-empty "path" makes mpost(1) return with error code 1


This is what I expected: ``show'' called with any valid argument should be
fine to put and shouldn't be modifying mpost(1) exit behavior. In
particular: return code should always be 0.

What I see: ``show'', when placed in a figure's script, is changing a
return code of the ``mpost'', if the thing I try to show is a path, and it's
not empty. This destroys my Makefile-based flow.


	wget -O sample.mp http://pastebin.com/YNkg4E05

	path	circle;
	%circle = (0,0);
	%circle = fullcircle;
	show circle;

If you call as is:

	$ mpost sample.mp > /dev/null
	$ echo $?

(Continue reading)

William Adams | 21 Nov 20:29 2014

Use metaflow.mp in lualatex using mplib?

Metflow is a package which allows one to do flow charts in metapost:


When I try to use it, I get the error:

! Incomplete string token has been flushed.

How do I fix this?



William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.


Graham Douglas | 5 Nov 13:27 2014

Re: MPlib: some observations on the mp_gr_copy_object(MP mp, mp_graphic_object*p) function

On 05/11/2014 11:00, metapost-request <at> tug.org wrote:
> Send metapost mailing list submissions to
> 	metapost <at> tug.org
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://tug.org/mailman/listinfo/metapost
> or, via email, send a message with subject or body 'help' to
> 	metapost-request <at> tug.org
> You can reach the person managing the list at
> 	metapost-owner <at> tug.org
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of metapost digest..."
> Today's Topics:
>    1. MPlib: some observations on the mp_gr_copy_object(MP mp,
>       mp_graphic_object*p) function (Graham Douglas)
>    2. Re: MPlib: some observations on the mp_gr_copy_object(MP mp,
>       mp_graphic_object*p) function (luigi scarso)
> ----------------------------------------------------------------------
> Message: 1
> Date: Mon, 3 Nov 2014 22:33:20 +0000
> From: Graham Douglas <graham.douglas <at> readytext.co.uk>
> To: <metapost <at> tug.org>
(Continue reading)

Graham Douglas | 3 Nov 23:33 2014

MPlib: some observations on the mp_gr_copy_object(MP mp, mp_graphic_object*p) function

Hi All

I'm working with MPlib (version 1.801, compiled under Windows 7, 64 bit
) and using mp_gr_copy_object(MP mp,mp_graphic_object*p) to create a way
to cache graphics produced by MPlib (which is now working well, after
the "fixes" below.).  I noticed that the mp_gr_copy_object(MP
mp,mp_graphic_object*p) function (in psout.c) was not copying a number
of key values into the new object --- such as ljoin, lcap colour
information etc. My apologies if this has been fixed or, of course,
there are good reasons that these values are not copied (or it is some
other error on my part). Anyway, I thought I'd make a note of this just
in case. I have highlighted the changes I made within psout.c

Warm wishes

mp_graphic_object* mp_gr_copy_object(MP mp,mp_graphic_object*p)


case mp_fill_code:
tf= (mp_fill_object*)mp_new_graphic_object(mp,mp_fill_code);
gr_pre_script(tf)= mp_xstrdup(mp,gr_pre_script((mp_fill_object*)p));
gr_post_script(tf)= mp_xstrdup(mp,gr_post_script((mp_fill_object*)p));
gr_path_p(tf)= mp_gr_copy_path(mp,gr_path_p((mp_fill_object*)p));
gr_htap_p(tf)= mp_gr_copy_path(mp,gr_htap_p(p));
gr_pen_p(tf)= mp_gr_copy_path(mp,gr_pen_p((mp_fill_object*)p));

(Continue reading)

Tobias Columbus | 16 Oct 23:44 2014

Filling complex paths

Hi all,

I am currently writing a piece of software that should spit out some MetaPost
code. My input are the closed curves of a glyph and I want to produce MetaPost
code that fills them according to Postscript rules. However, as MetaPost cannot
handle non-contiguous closed paths, this task seems difficult at least. 

Note that the glyphs come from non-Postscript fonts, so that the MetaPost
"glyph" primitive does not work for me. I also tried "graphictext" as described
in the Metafun manual but that turned out to be too inaccurate. I traced the
inaccuracy back to "pstoedit", which is called for "graphictext".

My attempt was to fiddle around with specials and
withprescript/withpostscript.  This attempt turned out to be nonsense as
addto always writes "stroke" or "fill" and my specials were ignored. I
could, of course, write the whole glyph with specials, but I would
prefer a cleaner solution.

Has anybody some experience with this kind of problem? How difficult
would it be to add filling of non-contiguous paths to MetaPost?

Thank you in advance,

Vafa Khalighi | 9 Sep 07:09 2014

"Improper transformation argument" Error

I have a metafont source file that has the following code:

  my_T := currenttransform;
  currenttransform := identity slanted my_slant;
  currentpicture := nullpicture;
  picture joined_fit_plus_pic;
  pickup pensquare;
  x1=x2=-2mag;  x3=x4=2mag+kashida_width;
  y1=y4=0;  y2=y3=horiz_width;
 fill (z1--z2--z3--z4--cycle) withweight 1;
  joined_fit_plus_pic := currentpicture;
  currenttransform := my_T;

when I run metafont on this, it runs smoothly without any problems.
but when I use mfplain format of metapost, I get the following error:

>> currenttransform.withweight1
! Improper transformation argument.
<to be read again>
l.61  fill (z1--z2--z3--z4--cycle) withweight 1;


What is wrong? and how do I fix this? If required, I can provide the
full source.
(Continue reading)

Akira Kakuto | 8 Sep 01:32 2014

Processing metafont sources with metapost

s/a final error/final errors/



Vafa Khalighi | 7 Sep 11:20 2014

Processing metafont sources with metapost


I am designing a new font from scratch and I write metafont sources
and then compile them with metapost to generate the svg of each glyph.
To explain my issue, I will use cmr12.mf as an example here.

I have a file test.mp that contains:

outputtemplate := "%j-%c.svg";
outputformat := "svg";
input cmr12.mf;

and I process test.mp with mpost&mfplain test.mp

As expected for each glyph a svg will be generated; however I get a
warning about bad RGBcolor. Furthermore the glyph will be in gray
color instead black. There is also a grid and some dots, and labels
(numbers) which I do not want. How this can be fixed?

I have attached letter G and the view I got from inkscape.

Toby Thurston | 1 Sep 16:25 2014

Bug with "odd" primitive?

The "odd" primitive appears to return "false" for all negative numbers.  This behaviour is significantly
different from Metafont. 
Can we get it corrected?  Or at least documented?  Thanks Toby

Test program:

    show(odd -3); end

result with Metafont:

    This is METAFONT, Version 2.7182818 (TeX Live 2014) (preloaded base=mf)
    >> true )  
    Transcript written on test.log.

result with Metapost

    This is MetaPost, version 1.902 (TeX Live 2014) (kpathsea version 6.2.0)
    Preloading the plain mem file, version 1.005) ) (./test.mf
    >> false )
    Transcript written on test.log.

Thanks T.

France Dacar | 20 Aug 17:15 2014

Troubles rendeting text in PNG output

Hello there.

I am using MetaPost version 1.803 (mpost in MiKTeX 2.9).
I searched the Web, and in particular the MetaPost site, but could not find
the answer to my problem. The following test file


outputformat := "png";
outputtemplate := "%j-%c.%o";

label(btex $(hs,f(s)t)$ etex, (0,0));
label(btex abracadabra etex, (0,-20));


produces the expected result, though it spews out 20 warnings like

     Warning: invalid entry for `pkol0': unknown name `store' ignored

(Continue reading)