31

What are the things to know when moving from XeTeX to LuaTeX, particularly when it comes to TTF/OTF support and OpenType features?

Emre
  • 6,337
raphink
  • 31,894

5 Answers5

20

The only difference is for Linux: OpenType or TrueType fonts from the TeX directory structure, e.g. the texgyre fonts, have to be assigned by its filename for XeTeX, e.g. \fontspec{texgyre-pagella.otf}. LuaTeX itself also searches the TeX font directories, the reason why LuaTeX finds such font defined by its family name, e.g. \fontspec{TexGyre-Pagella}. For MiKTeX it should make no difference, fonts should be found.

The package mathspec works only for XeTeX. And polyglossia doesn't work with LuaLaTeX yet.

  • In XeTeX on Linux, I currently use the font name, not the font filename. For example, I do \fontspec{Linux Libertine O} and it works. Does fontspec work with LuaLaTeX? I get an error when I run lualatex on a tex file using fontspec (using TL2009)... – raphink Jul 20 '11 at 14:47
  • Are you sure that font names don't work on TeXLive? The font database is generated by lualatex/luaotfload/mkluatexfontsdb and if a font is found at all why shouldn't the font name be in the database too? There is certainly no problem on miktex, lualatex accepts even a lot of name variants like \setmainfont{TeXGyrePagella}. – Ulrike Fischer Jul 20 '11 at 15:03
  • @Ulrike: I wrote, that XeTeX needs the file name! –  Jul 20 '11 at 15:34
  • Ah. Sorry I read it the other way round. Doesn't this here solve the problem: http://tug.org/texlive/doc/texlive-en/texlive-en.html#x1-350003.4.4? (But it can also lead to trouble if too much folders are searched and used by xetex. XeTeX doesn't like it very much if a font exists in two variants.) – Ulrike Fischer Jul 20 '11 at 16:01
  • I know that, but I do not like such hacks –  Jul 20 '11 at 16:13
  • @Herbert: I'd not call it a hack, it is the standard way to configure fontconfig (which is used by XeTeX) to look for fonts in non-default directories (even the defaults are read from similar configuration file(s).) – خالد حسني Jul 21 '11 at 03:05
  • @Khaled: XeTeX is based on TeX, the reason why it should search by default the TeX directory for fonts. This should not be done by a user configuration. –  Jul 21 '11 at 07:42
  • @Herbert: The problem is that the barrier between the "TeX-fonts" used by TeX engines (and stored in TeX directories) and on the other side the system fonts used by other applications has fallen and that it is no longer really clear where such fonts should be stored at best and who should manage (eg update) them. It is a problem if e.g. a libertine otf is in the system folder, a ttf and another otf version in the texmf tree - and if on top of this a pfb exists too. I think in the long run miktex and texlive should install fonts in the system folders. – Ulrike Fischer Jul 21 '11 at 09:30
  • 1
    @Ulrike, sure that's the problem but LuaTeX solved it in user friendly way, XeTeX not ... and of course, all fonts should go into one system and one local folder. –  Jul 21 '11 at 09:47
  • It is not luatex which solves it, it is luaotfload which generates the database with the help of variables like OSFONTSDIR - and it is imho (apart from the blacklist) not really possible to configure the pathes. Xetex uses fontconfig which has configurations files, and miktex as default does configure fontconfig/xetex so that it searches the texmf. This is on windows easy as there is no system fontconfig so miktex uses its own variant. I don't no why TeXLive doesn't do it perhaps it can't be done on linux (and so linux should be blamed ;-)). – Ulrike Fischer Jul 21 '11 at 10:57
  • @Ulrike: if you are on unix and OSFONTSDIR is not set, luaotfload will attempt to read fontconfig's configuration files, so that is a way to have a bit more control on system search paths. – خالد حسني Aug 24 '11 at 18:03
5

If you want to move from XeLaTeX to LuaLaTeX, you should read lualatex-doc. If you want to use from ConTeX MkII to MkIV, many things will change.

  • I'm interested in moving to a modern cutting-edge system, and mostly benefiting from font expansion while still keep an easy way to manage TTF/OTF fonts with OpenType features. I do not plan on using ConTeXt though, but rather keep with LaTeX for now (I'm using specific LaTeX packages such as bibleref). – raphink Jul 20 '11 at 21:12
5

There are some caveats with multilingual typesetting with OpenType shaping features; I'm not really the one to ask about it, though. XeTeX uses the ICU to do its OpenType magic, which as I understand things is a lot more comprehensive than what's currently done by LuaTeX and its supporting machinery. For example, unless things have changed recently, I don't believe that LuaTeX will be able to typeset Indic languages correctly.

XeTeX isn't a silver bullet here either, but I think its coverage is more comprehensive.

5

As I actually ended up switching from XeTeX to LuaTeX, I've met a few other problems.

Most notably:

  • LetterSpace and WordSpace options in fontspec are not supported in LuaTeX, so you have to use textls from microtype like in PDFTeX in order to achieve tracking;
  • textls sometimes break with small caps (see textls breaks smallcaps with luatex).
raphink
  • 31,894
0

My main motivation for moving from XeTeX to LuaTeX was movies. As it is said in my posts (Can XeLaTeX | LuaTeX import movies ?, Why \movieref does not work under XeLaTeX) XeTeX has troubles with importing movies. The latter one is still unresolved.