latex3 / fontspec

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

OpenType feature 'Letters=SmallCaps' actually not available for font 'LatinModernRomanCaps' with script 'CustomDefault' and language 'Default'? #432

Closed dbitouze closed 3 years ago

dbitouze commented 4 years ago

Description

Why and how to get rid of a (AFAICS) useless warning about OpenType feature 'Letters=SmallCaps' not available for font 'LatinModernRomanCaps' with script 'CustomDefault' and language 'Default'?

Check/indicate

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{texgyrepagella}[
  Extension = .otf ,
  UprightFont = *-regular.otf ,
  ItalicFont  = *-italic.otf  ,
]
\begin{document}
hello \emph{hello}
\end{document}

File List:

 article.cls    2019/12/20 v1.4l Standard LaTeX document class
  size10.clo    2019/12/20 v1.4l Standard LaTeX file (size option)
fontspec.sty    2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTeX
  xparse.sty    2020-05-15 L3 Experimental document command parser
   expl3.sty    2020-09-06 L3 programming layer (loader) 
l3backend-luatex.def    2020-09-11 L3 backend support: PDF output (LuaTeX)
xparse-generic.tex
fontspec-luatex.sty    2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTeX

 fontenc.sty
fontspec.cfg
  ts1cmr.fd    2019/12/16 v2.5j Standard LaTeX font definitions
 ***********

Further details

The compilation of the previous MCE gives the following warnings:

Package fontspec Warning: OpenType feature 'Letters=SmallCaps' (smcp) not
(fontspec)                available for font 'LatinModernRomanCaps' with
(fontspec)                script 'CustomDefault' and language 'Default'.

Package fontspec Warning: OpenType feature 'Letters=SmallCaps' (smcp) not
(fontspec)                available for font 'LatinModernRomanCaps' with
(fontspec)                script 'CustomDefault' and language 'Default'.

Package fontspec Warning: OpenType feature 'Letters=SmallCaps' (smcp) not
(fontspec)                available for font 'LMRomanCaps10-Oblique' with
(fontspec)                script 'CustomDefault' and language 'Default'.

Package fontspec Warning: OpenType feature 'Letters=SmallCaps' (smcp) not
(fontspec)                available for font 'LatinModernRomanCaps' with
(fontspec)                script 'CustomDefault' and language 'Default'.

but the text is, as expected, in small caps:

$ pdffonts test.pdf                          
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
HCEGLI+LMRomanCaps10-Regular         CID Type 0C       Identity-H       yes yes yes      4  0
JFRMQG+LMRoman10-Regular             CID Type 0C       Identity-H       yes yes yes      5  0
zauguin commented 3 years ago

@dbitouze Given that your minimal example contains neither any text in small caps nor uses Latin Modern in the first place, I highly doubt that is gives the warnings you showed.

u-fischer commented 3 years ago

the example actually errors as .otf is added twice.

dbitouze commented 3 years ago

Outch! Sorry, I should have mixed some MCEs... and I cannot find the one relevant for this issue. I've tried to rebuild a MCE that gives the mentioned warning:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}[
SmallCapsFont=Latin Modern Roman Caps,
SmallCapsFeatures = { Letters=SmallCaps},
]

\begin{document}
\textsc{Foo}
\end{document}

but I guess it just says what it says :$

While we're at it, why 4 occurrences of this warning?

zauguin commented 3 years ago

While we're at it, why 4 occurrences of this warning?

The font is loaded in four variants: regular, bold, italic, bold italic.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}[
SmallCapsFont=Latin Modern Roman Caps,
SmallCapsFeatures = { Letters=SmallCaps},
]

\begin{document}
\textsc{Foo}
\end{document}

If you explicitly request Letters=SmallCaps for a font where this doesn't have any effect the warning does seem useful.