[Tex/LaTex] Are XeTeX and LuaTeX platform dependent

luatexxetex

One of the main goals that Don Knuth had when developing TeX (other than the obvious one of creating high-quality documents) was a 100% platform independence. A document produced on one system should always compile always exactly identical on any machine. It should never happen, that a linebreak or page break would be altered. Therefore the TeX program was very carefully written to ensure that there is absolutely no access to any internally used floating point value and that those parts that actually may use platform dependent code could not affect the typesetting.

Now from my understanding this goal is broken in XeTeX as it hands off "words" to the underlying platform-dependent font machinery and then takes back from there the font glyphs and relative horizontal and vertical positions. Those are then used to calculate line breaks and there it should be possible to generate examples where a document shows different line and/or page breaks if moved from one platform to the next.

I don't know how LuaTeX implements the Opentype support, perhaps the approach here is different. But for LuaTeX I believe that platform dependency may come into play through access to more or less general accessibility of TeX internals (even those that Don deliberately kept inaccessible because of their use of floating point arithmetic).

So my main question here is: is my understanding correct?

And the sub-questions then would be:

  • Has somebody experienced a platform dependency in XeTeX?
  • Has the LuaTeX font support the same "danger"?

Best Answer

LuaTeX OpenType support is fully implemented using Lua code (as Khaled wrote), which means that it is platform independent as long as identical font files are used.

But note that that is usually only the case for fonts that are part of a portable TeX distribution like TeXLive. LuaTeX also allows one to use system-installed fonts, and these will typically be a little different not only between competing operating systems, but also between different versions (or even updates) of one particular operating system.

LuaTeX uses no system font libraries, not for anything, not even fontconfig.

Anyway, LuaTeX documents should be platform independent if these conditions are met:

  • The underlying platform offers IEEE754 double precision floating point as well as 64-bit integer values (but without this, the luatex executable will probably not even compile. Neither will xetex, nor pdftex).
  • All used runtime (TeX, Lua, font, pattern, etc.) files are identical.
  • No Lua nor TeX code is used that explicitly does platform-dependent things.

The last point is what makes it hard to give a definitive answer. However, that condition exists for pdfTeX and even traditional TeX just the same. It is a bit more obvious in LuaTeX, but it is not at all hard to write platform-dependent documents in any of the other TeX- and TeX-like engines.