[Tex/LaTex] Why is “Latin Modern Roman” appearing differently in TeXStudio than in SumatraPDF

fontslmodernluatexrendering

Related question: XeLaTeX font rendering tend to be slightly bolder compared to PDFlatex

I am trying to use lualatex, because of the selnolig package.

I was recommended to use "Latin Modern Roman" instead of "cfr-lm" in the case of LuaLaTeX (see somehow How to use selnolig package together with default lualalatex font?). Note that lmodern is in the basic mode equal to cfr-lm. See Difference between cfr-lm and lm package.

% !TeX program = pdflatex
\documentclass{article}
\usepackage{blindtext}

\usepackage{ifluatex}
\ifluatex
  \usepackage{fontspec}
  \setmainfont{Latin Modern Roman}
\else
  \usepackage{lmodern}
\fi

\begin{document}
\blindtext
\end{document}

TexStudio

Rendered output with pdflatex in TeXStudio on Windows 10:

Rendered output with pdflatex

Rendered output with lualatex in TeXStudio on Windows 10:

Rendered output with lualatex

See that the lualatex output is thicker? How to have the output being rendered in equal thickness?

SumatraPDF

Rendered output in SumatraPDF:

pdflatex output

lualatex output


The other equivalent font settings are as follows (see What ist the fontspec equivalent for "variable=true"):

\setsansfont{Latin Modern Sans}
\setmonofont{Latin Modern Mono} % "variable=false"
%\setmonofont{Latin Modern Mono Prop} % "variable=true"

Best Answer

latin modern is the default font family in lualatex so you don't need do anything at all, you would get the same font without loading fontspec or specifying \setmainfont.

Note that pdflatex is using the type1 font format and lualatex the opentype format, the two versions of the font are derived from the same glyph definitions but the exact appearance in any particular rendering system may have slight variations depending on how font hinting and other things are implemented for each of the two formats.