# LuaLaTeX: use or don't use classical font packages?

In the lualatex-doc I am reading under "switching from LaTeX to LuaLaTeX":

1. Don’t load inputenc, just encode your source in UTF-8.
2. Don’t load fontenc, but load fontspec.
3. Don’t use any package that changes the fonts, but use fontspec’s commands instead.

Consider the following example:

% !Mode:: "TeX:UTF-8"
\documentclass[paper=a4]{scrartcl}
\usepackage{fontspec}
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
Hellöö! ßßäü
\end{document}


It compiles perfectly fine and looks as desired with lualatex from TeXLive 2012. It is in agreement with points (1) and (2) from the list above. However, I am wondering:

• Doesn't \usepackage{lmodern} violate point (3) from above?

If yes:

• What would be the LuaLaTeX way of using lmodern?
• Why does it work then? In which cases is this expected to break?

I just took lmodern as an example, the question applies to all such kinds of font packages.

-
fontspec uses Latin Modern by default (the OpenType version), but you can also load it manually like any other font: \setmainfont{Latin Modern Roman} etc. – Khaled Hosny Feb 24 '13 at 11:46

Your example works as there exists suitable font definitions files for the "lmr" and the "lmss" families for the EU2 font encoding in the euenc package. (If you look in the log-file you will see that a eu2lmss.fd is loaded).

If you would replace lmodern by e.g. times it would no longer work. You would see in the log-file a warning:

LaTeX Font Info:    No file EU2phv.fd. on input line 14.

LaTeX Font Warning: Font shape EU2/phv/m/n' undefined
(Font)              using EU2/lmr/m/n' instead on input line 14.


And the document wouldn't use helvet but the fallback lmr.

To be able to use the helvet font you would have to switch the fontencoding to an encoding for which font definitions for helvet exists, e.g. T1-encoding. But with this encoding you will no longer be able to input non-ascii-chars directly:

\documentclass[paper=a4]{scrartcl}
\usepackage{fontspec}
\usepackage{times}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
¼½¾ Hellöö! ßßäü
% this gives helvet, but some chars are wrong:
\fontencoding{T1}\selectfont ¼½¾ Hellöö! ßßäü \ss
\end{document}

-
Thanks Ulrike for these insights. So the take home message is that we really should use the fontspec commands indead of e.g. \usepackage{times}. – Jan-Philip Gehrcke Feb 26 '13 at 8:16
@Jan-PhilipGehrcke The take home message is: It depends on the package. lmodern or e.g. libertine works fine with lualatex as they are adapted to EU2 encoding. Symbol fonts like e.g. wasysym or chessfonts works fine too, as their commands switch locally to suitable encodings. Some packages like times are ignored and so useless. And there are also packages which could mess up the font setup e.g. if they change to LGR or T2A encoding. – Ulrike Fischer Feb 26 '13 at 8:41
@UlrikeFischer: Are you sure about wasysym? When I replace lmodern with wasysym and add e.g. \currency to the document, I get a !LuaTeX error (file wasy10): Font wasy10 at 657 not found. Am I missing something? – dapperdan Feb 26 '13 at 23:33
@dapperdan: You haven't enabled the map file correctly (updmap/updmap-sys depending on your system). You can add it locally to your document with \pdfmapfile{=wasy.map}. – Ulrike Fischer Feb 27 '13 at 7:44