[luatex] LuaTeX as a Library

Mojca Miklavec mojca.miklavec.lists at gmail.com
Mon Nov 20 13:31:40 CET 2017


On 20 November 2017 at 10:31, Nicolas Holzschuch wrote:
> Hi,
>
> 100 % agree with everything you say.
>
> I'm not sure there is a strong demand for "luatex-as-a-library" (right now it seems it's at most 3 people worlwide...), but I agree with you.

There might be "3 people worldwide" interested in testing the library
right now, but there are definitely a lot more people who would enjoy
software that could be written on top of such a library. I mean: I can
easily imagine LibreOffice or any other rendering software at some
point deciding to use LuaTeX library for rendering OpenType math. Or
people who would gladly install a TeX app on their iPad. Or people who
would enjoy using some WYSIWYG GUI written on top of LuaTeX. LuaTeX
itself is not suitable to be used inside other software, but if it was
properly adapted, that would be a completely different story.

> To be clear, said memory leaks only happened because, if you run in a library, you have to explicitly release all memory after the compilation (as opposed to an app). They are not impacting luatex-as-an-app. So I would say they are low-priority.

The main question is: do they harm the performance of LuaTeX runs on
decrease the readability of LuaTeX sources?

If not, and if they make life of other developers easier, there's no
reason for not accepting such kind of patches.

>> - I assume that many cases where "#ifdef __IPHONE__" is used are not
>> really specific to IPHONE, but to the way a library works and would be
>> just as well needed on Android or any other device where the "start
>> once and flush everything" paradigm isn't the most suitable one. So
>> the patches *may* need a bit more tweaking. (But tweaking them would
>> be a lot easier if the first two points would be addressed.)
>
> Good points. Basically, there are two kind of changes:
> - not calling system(), fork() and exec() because these are unavailable in a sandboxed environment.
> - initializing all variables at the start, releasing all allocated memory at the end.
>
> The former is specific to iOS, the latter is generic. I should have separated them with different #defines, such as __IPHONE__ and LIBRARY.
>
> Then again, if you are using a luatex-as-a-library, it's probably because you don't have access to system() or fork()/exec(). So...

I see other uses as described above. There could be really neat
applications written on top of LuaTeX library. Not specific to iPhone,
but in many cases calling "system" might not be desirable either, even
if it was theoretically allowed.

> Maybe NO_SYSTEM and LIBRARY, then.

I leave that to Luigi if you manage to convince them to accept some of
your patches :)

Mojca


More information about the luatex mailing list