latex3 / fontspec

Font selection in LaTeX for XeTeX and LuaTeX
http://latex3.github.io/fontspec/
LaTeX Project Public License v1.3c
277 stars 34 forks source link

No small caps with `\setmainfont{Latin Modern Roman}` #449

Open dbitouze opened 3 years ago

dbitouze commented 3 years ago

Description

A sentence or two describing the issue.

Check/indicate

Minimal examples demonstrating the issue

Minimal example 1

\documentclass{article}
\begin{document}
\textsc{Small capitals}.
\end{document}

Minimal example 2

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
\textsc{Small capitals}.
\end{document}

Minimal example 3

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}
\begin{document}
\textsc{Small capitals}.
\end{document}

Minimal example 4

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}[
  SmallCapsFont = Latin Modern Roman Caps,
]
\begin{document}
\textsc{Small capitals}.
\end{document}

Further details

Minimal examples 1 (compiled with lualatex) and 2 (compiled with pdflatex and lualatex) provide small caps. By contrast, minimal example 3 (compiled with lualatex) doesn't provide small caps:

LaTeX Font Warning: Font shape TU/LatinModernRoman(0)/m/sc' undefined (Font) usingTU/LatinModernRoman(0)/m/n' instead on input line 39 .

Okay, small caps can be obtained with the code in minimal example 4, but shouldn't they be included in the basic font and obtained by the smcp font feature?

u-fischer commented 3 years ago

Okay, small caps can be obtained with the code in minimal example 4, but shouldn't they be included in the basic font and obtained by the smcp font feature?

Well perhaps, but how a font implements a feature (and which one) is not an fontspec issue.

interkosmos commented 3 years ago

Having the same issue here with TexLive 2021 and LuaTeX, regardless of the small caps feature provided by the chosen OTF. Seems to be a fontspec bug.

Edit: Log of example 3:

[…]
LaTeX Font Warning: Font shape `TU/LatinModernRoman(0)/m/sc' undefined
(Font)              using `TU/LatinModernRoman(0)/m/n' instead on input line 12
[…]
dbitouze commented 3 years ago

@u-fischer Sorry, I was not sure where to report this. Should I report to the maintainers of lmodern package?

@interkosmos I guess Ulrike is right, since the problem does not arise with e.g. Erewhon:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{erewhon}
\begin{document}
\textsc{Small capitals}.
\end{document}
interkosmos commented 3 years ago

@dbitouze Specifically, I’m having the issue with the Minion Pro OTF font. Small caps are a style of the OTF font but not recognised by fontspec:

$ otfinfo -f ~/.fonts/Minion\ Pro/MinionPro-Regular.otf
aalt    Access All Alternates
c2sc    Small Capitals From Capitals
case    Case-Sensitive Forms
cpsp    Capital Spacing
dlig    Discretionary Ligatures
dnom    Denominators
fina    Terminal Forms
frac    Fractions
hist    Historical Forms
kern    Kerning
liga    Standard Ligatures
lnum    Lining Figures
numr    Numerators
onum    Oldstyle Figures
ordn    Ordinals
ornm    Ornaments
pnum    Proportional Figures
salt    Stylistic Alternates
sinf    Scientific Inferiors
size    Optical Size
smcp    Small Capitals
sups    Superscript
swsh    Swash
tnum    Tabular Figures
xx01    <unknown feature>
zero    Slashed Zero

In contrast, fontspec:

LaTeX Font Warning: Font shape `TU/MinionPro(1)/m/sc' undefined
(Font)              using `TU/MinionPro(1)/m/n' instead on input line 16.

[1{/usr/local/texlive/2021/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./test.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.
dbitouze commented 3 years ago

@interkosmos Indeed, sorry. In contrast, small caps aren't a style of the OTF Latin Modern Roman font:

otfinfo -f /usr/local/texlive/2021/texmf-dist/fonts/opentype/public/lm/lmroman12-regular.otf    
aalt    Access All Alternates
cpsp    Capital Spacing
dlig    Discretionary Ligatures
frac    Fractions
kern    Kerning
liga    Standard Ligatures
lnum    Lining Figures
onum    Oldstyle Figures
pnum    Proportional Figures
size    Optical Size
tnum    Tabular Figures
zero    Slashed Zero

so your issue (which seems to be a fontspec's one) differs from mine (which isn't a fontspec's one). It is worth opening a new issue I guess.

interkosmos commented 3 years ago

@dbitouze: Right, thank you for the feedback.