[metapost] MetaPost Sandbox -- MP test/display program using Qt

Shriramana Sharma samjnaa at gmail.com
Wed Aug 22 21:25:07 CEST 2012

Hello list.

So after my previous program ("firstlight") which was "dumb" and only
"show"-ed a QSvgWidget for hardcoded MetaPost commands, I have tried
to go to the next level and allow the user to enter MP commands after
which the GUI will (try to) display the resultant figures.

I have attached the sources for v1 of my MetaPost Sandbox. I
personally have linked it against the MP sharedlib which I built using
the instructions posted earlier, however the make will also link
against libmplib.a if that file is inserted into the source folder
(for which I have included the magic word "-L ." in the Makefile).

I have also been able to eschew the need for plain.mp to be present in
the CWD by including the MP commands contained therein into a macro
defined by a header file. I also automated the conversion from MP
format to C header so that it may be re-used. That is also attached.

I am intermittently working on a v2 with an improved SVG display
widget with zoom, rulers and grids.

However, even now I am facing some problems. I have some samples of
perfectly valid MP code (see attached .mp file) which are not
processed properly by MPLib for whatever reason. My installed MP 1.504
(it's from TexLive 2012 I think) and Troy Henderson's online tool both
convert quite such samples to SVG/PostScript (try the attachment).

I do not understand why this should be so. I am sure it is not due to
my mp-format-to-c-header hack because even if I remove the hack and
tell MPLib to mp_execute ( _mp_instance, "input plain;\n", 14 ), the
problem persists. I wonder if anyone can help me with that.


Shriramana Sharma
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpsandbox-v1.tar.gz
Type: application/x-gzip
Size: 9412 bytes
Desc: not available
URL: <http://tug.org/pipermail/metapost/attachments/20120823/10a164bb/attachment.gz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: curl-test-ctrlpts-alt.mp
Type: text/x-metapost
Size: 534 bytes
Desc: not available
URL: <http://tug.org/pipermail/metapost/attachments/20120823/10a164bb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mp-format-to-c-header.py
Type: text/x-python
Size: 721 bytes
Desc: not available
URL: <http://tug.org/pipermail/metapost/attachments/20120823/10a164bb/attachment.py>

More information about the metapost mailing list