[metapost] Trying to figure out MPLib

Shriramana Sharma samjnaa at gmail.com
Fri Aug 3 13:16:08 CEST 2012

On Fri, Aug 3, 2012 at 1:17 PM, Taco Hoekwater <taco at elvenkind.com> wrote:
> es, if you want to use macros like beginfig(), you have to load
> plain.mp. You could just copy plain.mp to the same directory
> and change command to:
>   "input plain; beginfig ( 1 ) ; dra... "

Thanks that works now. Basically I am able to do multiple command= and
then EXECUTE commands. I have got the output "2 figures created" so
while I haven't investigated the actual contours yet (I'll be doing
that presently) I presume everything went on well.

A few comments/queries:

Isn't it possible to package mplib like any other library out there? I
mean I am thinking of Debian-style packages like: metapost (front-end
executable depends on libmplib), libmplib (which contains a shared
library and essential data files like plain.mp or such), libmplib-dev
(contains .h files).

Of course, if the library is small enough the split-up into multiple
packages would not be needed, but basically I expect a library to get
installed into /usr/lib and the header files for development into
/usr/include. The point of making mplib was to allow multiple
applications to link to it, no? So is it because of MPost's usage of
and relationship to TeX that it has to be installed as part of my TeX
install or something? (I still do not grok the TeX install tree yet.)

> You could write your own based on the paths in your project, or you
> could use kpathsea.

Actually is it possible for me to NOT link to kpathsea? Currently I
have to link to it otherwise I get the errors:

./libmplib.a(libmplib_a-mp.o): In function `mplib_close_file':
undefined reference to `kpse_fclose_trace'
./libmplib.a(libmplib_a-mp.o): In function `mp_open_file':
undefined reference to `kpse_fopen_trace'
./libmplib.a(libmplib_a-mp.o): In function `mplib_open_file':
undefined reference to `kpse_fopen_trace'
./libmplib.a(libmplib_a-mp.o): In function `mp_close_file':
undefined reference to `kpse_fclose_trace'
collect2: ld returned 1 exit status

Basically I want the program to be dissociated from TeX as I do not
require any label typesetting (which I hope is the only reason MPost
needs TeX or kpathsea) to be done by it. The important reason I am
using MetaPost/MPLib is to calculating the control points needed for
smooth strokes.

I can already generate strokes using Inkscape and import into my font
editor and take it from there. But those strokes are not very smooth
as I am not a professional font designer and hence do not have the
experience required to make the nodes and handles "just right". (I
have recently posted on this list about my experience with making a
Brahmi DDHA.)

So if it were possible to somehow "cut" the link to TeX, say using a
compile-time -DNO_TEX or something it would be useful for me (because
my program can then be used by others who may not like to download and
install a big TeX distro).

On a related note, I note that asymptote has a graphical counterpart
xasy which is basically exactly like what I am looking for or trying
to create for MetaPost -- to graphically click to add nodes and get
the curves displayed in real-time. Is there something like that for
mpost already? Or maybe would it be possible for me to just adapt xasy
for my purposes?

Shriramana Sharma

More information about the metapost mailing list