Can I use MetaPost lettrine-generator 0.1.0a created by Sergey Slyusarev in LuaLaTeX? If so, how?
https://github.com/jemmybutton/byrne-euclid/blob/master/lettrines/lettrines.mp
Can I use MetaPost lettrine-generator 0.1.0a created by Sergey Slyusarev in LuaLaTeX? If so, how?
https://github.com/jemmybutton/byrne-euclid/blob/master/lettrines/lettrines.mp
lettrines.mp takes a list from lettrineslist.txt file, like this and produces .mps (or you can change it to, say, svg or png) files which can then be linked to your document. To produce the images you have to run mpost lettrines.mp.
In case of my rendition of Byrne's book, there's a macro in ConTeXt, which produces lettrineslist.txt file and places the images. In LuaLaTeX you can do something similar or you can do it by hand.
There are two reasons i didn't embed lettrines.mp into the document itself for the images to be placed there directly. First, i found no way to use metapost's glyph function in rhe LuaTeX's mplib, i. e. i couldn't find a way to get glyph outlines from the font glyphs. Second, lettrines.mp algorithm is way too slow and you don't want to run it every time you produce your pdf.
UPD:
As Henri Menke points out below, the first reason not to embed lettrines.mp code does not hold, since in ConTeXt you can actually obtain glyph outlines easily, but it's probably not possible to do it in LuaLaTeX (as of 12.12.2023). So in the future i'll try to modify the code for it to be more portable and more easily embeddable, but with the version 0.1.0a, unfortunately, you'd have to use standalone metapost compiler.
outlinetext.d("text") to get text outlines. The returned value is a picture, so you will have to iterate over the paths using within.
– Henri Menke
Jan 16 '20 at 09:03
lettrines.mp code, but it's still really slow. By the way, can this outlinetext thing work with standalone metapost?
– Sergey Slyusarev
Jan 16 '20 at 10:04
outlinetext is not available in LuaLaTeX with luamplib, because it requires ConTeXt-specific Lua font support. You can of course attempt to port the Lua code from ConTeXt's fontloader to luaotfload.
– Henri Menke
Sep 01 '20 at 21:53