[XeTeX] Xetex equiv to luatex's \directlua{}

David Carlisle d.p.carlisle at gmail.com
Fri Mar 23 21:44:36 CET 2018


there are several ways to get the box output in classic tex (or xetex)
although perhaps the easiest (and safest in terms of not accidentally
affecting the typeset positions)  is to use \showoutput so all boxes
are (somewhat verbosely) logged in the log file, and then parse that
with perl or python or whatever to get whatever lengths you need,

David


On 23 March 2018 at 20:33, maxwell <maxwell at umiacs.umd.edu> wrote:
> I'm just finishing up a project that involved typesetting text in several
> languages, while outputting an XML file that defined in X/Y coordinates the
> position and size of the bounding box surrounding each line of text in the
> PDF.  I used Luatex, because that made it possible to call Lua from Luatex
> using the \directlua{} command) to pass information to Lua, and to return
> information from Lua to Luatex using tex.print().  I also used Lua to write
> the XML file.
>
> Too late, I discovered that LuaTeX botches the rendering of one of the
> languages, Tamil.  Tamil has a complex script, with some typical Indic
> script features; so presumably LuaTeX would also mess up on other languages
> with complex scripts.  XeTeX of course does just fine at rendering text in
> complex scripts.
>
> As I say, it's too late to change now, but is there any way I could have
> done something similar using xetex?  That is, called another programming
> language to output box positions and sizes.  I suppose it's possible to
> write to an XML file in xetex natively, but I'm not sure how I could get the
> positions and sizes of boxes.  My style sheet defines a command,
> \outputpara{}, that requires the user to specify the X-position of the
> paragraph, and hence of lines in the paragraph, where line breaks are of
> course decided on the fly.  The command optionally specifies the Y-position
> of the paragraph, but the Y-position of each line in the paragraph--except
> the first--is determined by the usual TeX algorithms.  Getting TeX to tell
> me those Y-positions, as well as the vertical size of the box, was the
> difficult part.  But maybe I was missing something obvious?
>
>    Mike Maxwell
>    University of Maryland
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
>  http://tug.org/mailman/listinfo/xetex


More information about the XeTeX mailing list