[metapost] Python mplib bindings and MPost GUI frontend

Shriramana Sharma samjnaa at gmail.com
Tue Jul 3 18:52:21 CEST 2012

Hello. I was just reading the MPost manual and found that the basic
binary is just a small wrapper on mplib. The C API is quite sparse (as
remarked in the documentation itself) and obviously (because of
LuaTeX) there are already bindings to Lua, but I am wondering about
bindings to other languages. Frankly I would have expected a Python
library to already exist (because most OSS libraries I've seen have Py
bindings) but I'm unable to find one on the web with the keywords I
searched for.

I'm asking this because I'm thinking of writing a simple PyQt
application which would help to draw simple 3rd order outlines (for
font glyphs, obviously) based on user input using the MetaPost
approach (as unlike Inkscape approach) -- especially with the user
specifying only nodes and the application itself calculating the
suitable curvatures (vide my query at
http://www.tug.org/pipermail/tex-live/2012-July/031842.html) except
for the user throwing in some dirs like {left} {up} here and there.

Obviously the application being a GUI would require to draw curves on
the window itself and Qt can do that
(http://qt-project.org/doc/qt-4.8/qpainterpath.html) but instead of
re-implementing the algorithm and possibly producing bugs, I would
like to sort of embed MPost itself into the app and real-time render
the MPost-calculated paths.

I realize this is somewhat ambitious, but could potentially help a lot
of people who would like to use MPost for such things. Of course if
anyone is interested and would like to join hands, most welcome. (I
myself am really thinking out loud here and have to see how much time
I will be able to put in.)

Or has someone already done this?

Shriramana Sharma

More information about the metapost mailing list