7

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

https://github.com/jemmybutton/byrne-euclid

  • May I ask why you want to do this? The author of the linked document could have embedded the lettrine generator into the document as well, but chose not to. Why do you want to do that? – Henri Menke Jan 15 at 22:10
6

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 and it's possible to do in LuaLaTeX as well. 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.

| improve this answer | |
  • 3
    Why you are using ConTeXt, you can do 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 at 9:03
  • 2
    See also this answer tex.stackexchange.com/a/451951 and the mailing list thread that is linked there. – Henri Menke Jan 16 at 9:07
  • Thank you! It seems to work. Then it should be relatively straightfirward to embed lettrines.mp code, but it's still really slow. By the way, can this outlinetext thing work with standalone metapost? – Sergey Slyusarev Jan 16 at 10:04
  • 1
    No, outlinetext needs Lua support. – Henri Menke Jan 16 at 18:11
  • @HenriMenke: So outlinetext is now available to be used in lualatex documents to do glyph distortion using in a mp figure using luamplib? At some other point you had mentioned that outlinetext is a meta fun function that cannot be used in lualatex because it’s implemented using context macros. – reportaman Sep 1 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.