# Equivalent of fontenc in LuaLaTex

I'm writing a paper, and have recently switched to LuaLaTex. In pdfLaTex I've used

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

now how should I replace these, to maintain the same font(s)? In example I'm trying to maintain this font-style:

Including \usepackage{fontspec} doesn't helps to maintain this style for chapter and section titles.

MWE in pdfLaTex:

\documentclass{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}
\chapter{First}
\section{Second}
Third
\end{document}

What I tried, but haven't brought the correct result (in LuaLatex):

\documentclass{scrreprt}

\usepackage{fontspec}

\begin{document}
\chapter{First}
\section{Second}
Third
\end{document}
• Show a complete, small example. – Ulrike Fischer Jan 4 at 13:03
• fontenc has nothing to do with chapter and section title style. Maybe you did load another font package that uses legacy fonts which do not work with LuaLaTeX. – TeXnician Jan 4 at 13:08
• I added a MWE (a working one in pdfLaTex and a not working one in LuaLaTex), the document class I have to use is scrreprt. – cortesis Jan 4 at 14:44
• Ok, I changed the screenshot. The previous screenshot was taken with a renewcommand to add that dot. The thing I'm not able to do is the font style. – cortesis Jan 4 at 14:56

The default font families of LaTeX using pdflatex are Computer Modern. Computer Modern has a sans-serif font with a bold extended series with a high weight:

In the log file of a corresponding example file you would find, that the Type-1 version of font file cmssbx10.pfb is used. This font file contains a font in encoding OT1.

Loading of \usepackage[T1]{fontenc} not only changes the font encoding but also results in usage of the European Computer Modern families, because a font with another encoding is needed. The bold extended series of the sans-serif family has a lower weight:

In the screenshot not the original ecsx font has been used but the Type-1 replacement sfsx2488.pfb of cm-super.

With lualatex or xelatex an unicode-encoded font is needed. So the default font families switch to Latin Modern. Here the bold series of the sans-serif family has a weight similar to Computer Modern:

If you'd have a look into the log file, you will find, that the OpenType font lmsans10-bold.otf is used.

So the different weights of the bold series of the sans-serif font used for the headings of your example is because usage of lualatex with TU1-encoded fonts results in usage of another font family than usage of pdflatex with T1-encoded fonts. If you want the same weight, you would need a series of the Latin Modern Sans Serif OpenType-font with another weight, e.g. a semi bold series. AFAIK such a font does not exist.

With KOMA-Script you could force lualatex to use the same T1 encoded legacy font for the headings used by pdflatex:

\documentclass{scrreprt}
\setkomafont{disposition}{\usefont{T1}{cmss}{bx}{n}}
\begin{document}
\chapter{First}
\section{Second}
Third
\end{document}

However, you will be in trouble, if you would have characters with different code positions in your headings like the German sharp-s:

\documentclass{scrreprt}
\setkomafont{disposition}{\usefont{T1}{cmss}{bx}{n}}
\begin{document}
\chapter{Trouble with ß}
\end{document}

There are several other characters with similar problems, e.g. » or «. So this is nothing I would recommend!

Note 1: It is much easier to use a font with pdflatex that is similar to the font used with lualatex:

\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
\chapter{First}
\section{Second}
Third
\end{document}

uses the Type-1 version of Latin Modern Sans Serif bold extended lmssbx10.pfb, that looks the same like the OpenType version.

Note 2: There are some other fonts, that also exist in a Type-1 version and an OpenType version, but AFAIK nothing with the same look or metrics as European Computer Modern.

Note 3: The difference in the weight of Computer Modern Roman, European Computer Modern Roman and Latin Modern Roman is much more moderate. So if you don't need sans serif headings you could also use \setkomafont{disposition}{\normalcolor\bfseries}.