Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libertinus Serif font's small caps face doesn't work (needs a workaround) #624

Closed
tlikonen opened this issue Jan 22, 2024 · 3 comments
Closed

Comments

@tlikonen
Copy link

Libertinus Serif font family has small caps face but it does not work with Polyglossia normally. Here is an example document:

\documentclass{article}
%\usepackage[finnish]{babel}  % works with Babel
\usepackage{polyglossia} \setdefaultlanguage{finnish} % doesn't work with Polyglossia
\usepackage{fontspec}

\setmainfont{Libertinus Serif}

\begin{document}
\textsc{small caps} normal text
\end{document}

The \textsc{...} part is displayed with normal upright font face and there is an error in the compile output (lualatex):

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

However, with Babel package, this all works without errors. I know two workarounds for Polyglossia. One is by adding \rmfamily command at the beginning of document environment.

\begin{document}
\rmfamily
\textsc{small caps} normal text
\end{document}

Another workaround is defining the font family with these options:

\setmainfont{Libertinus Serif}[
SmallCapsFont={* Regular},
SmallCapsFeatures={Language=Default, Letters=SmallCaps}]

I don't know it this is a Polyglossia bug but it triggers with it (and not with Babel), so I dare the report it here.

@tlikonen tlikonen changed the title Libertinus Serif font's small caps face don't work (needs a workaround) Libertinus Serif font's small caps face doesn't work (needs a workaround) Jan 22, 2024
@tlikonen
Copy link
Author

Actually the issue happens with Babel too if I set the font family with \babelfont:

\babelfont{rm}{Libertinus Serif}

With that command there must be the same font options as described in my previous message:

\babelfont{rm}[
SmallCapsFont={* Regular},
SmallCapsFeatures={Language=Default, Letters=SmallCaps}
]{Libertinus Serif}

So probably this is not much about Polyglossia and more about Libertinus Serif and Fontspec. I don't know.

@Udi-Fogiel
Copy link
Collaborator

I'm not sure what is the source of the problem, but I'm guessing it is a bug in fontspec. The problem occurs when fontspec try to load the font with the language tag (which polyglossia \babelfont is adding):

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Libertinus Serif}
\begin{document}
\textsc{small caps} normal text

\addfontfeature{Language=Finnish}
\textsc{small caps} normal text
\end{document}

notice in the log file how in the second loading of the font,
the line (fontspec) - 'small caps' (m/sc) with NFSS spec.:
is not followed by any description.

However, if I load the font directly with luaotfload,
it seems to work:

\documentclass{article}
\usepackage{fontspec}

\begin{document}
\font\foo="LibertinusSerif:mode=node;script=latn;language=FIN;+tlig;"\foo
\textsc{small caps} normal text

\setmainfont{Libertinus Serif}[Language=Finnish]
\textsc{small caps} normal text
\end{document}

As a workaround, you can define the finish font with \newfontfamily\finishfont, this way polyglossia will not add
any font features, and will use the font as you loaded it (so pass the desired features).

I'll close for now, but feel free to reopen if you think I misunderstood anything.

@jspitz
Copy link
Collaborator

jspitz commented Jan 23, 2024

Maybe related to latex3/fontspec#449

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants