1

I am trying to print text in SmallCaps with the Ubuntu font, but it does not work for me.

Code:

% !TeX program = lualatex
\documentclass[ebook,11pt,twoside,openright,showtrims]{memoir}
% -------------------------------------------------------Packages
\usepackage{fontspec}
\usepackage{xcolor}  

\begin{document}

    \mainmatter
    
    \setmainfont{Ubuntu}    
    \textsc{Lorem not working}
    
    \scshape{Lorem not working}

    \setmainfont{Free Sans} 

    \textsc{Lorem working}

    \scshape{Lorem working} 
    
\end{document}

Output

enter image description here

In the log it says that Ubuntu has smallcaps, so why isn't it working?

. fontspec info: "defining-font"
. 
. Font family 'Ubuntu(0)' created for font 'Ubuntu' with options
. [Ligatures=TeX].
.  
.  This font family consists of the following NFSS series/shapes:
.  
. - 'normal' (m/n) with NFSS spec.:
. <->"Ubuntu:mode=node;script=latn;language=DFLT;+tlig;"
. - 'small caps'  (m/sc) with NFSS spec.: 
. - 'bold' (bx/n) with NFSS spec.:
. <->"Ubuntu/B:mode=node;script=latn;language=DFLT;+tlig;"
. - 'bold small caps'  (bx/sc) with NFSS spec.: 
. - 'italic' (m/it) with NFSS spec.:
. <->"Ubuntu/I:mode=node;script=latn;language=DFLT;+tlig;"
. - 'italic small caps'  (m/itsc) with NFSS spec.: 
. - 'bold italic' (bx/it) with NFSS spec.:
. <->"Ubuntu/BI:mode=node;script=latn;language=DFLT;+tlig;"
. - 'bold italic small caps'  (bx/itsc) with NFSS spec.: 
.................................................
LaTeX Info: Redefining \rmfamily on input line 11.
1
  • Does the font actually support small-caps features? When you run otfinfo -f on the font file, is small caps listed?
    – Davislor
    Feb 25, 2021 at 12:42

1 Answer 1

2

If I run the simplified code (with choice of the font by file name because I haven't it installed as a system font, but it's irrelevant)

\documentclass{article}
\usepackage{fontspec}

\setmainfont{Ubuntu}[
  Extension=.ttf,
  UprightFont=*-Regular,
  BoldFont=*-Bold,
  ItalicFont=*-Italic,
  BoldItalicFont=*-BoldItalic,
]

\begin{document}

\textsc{Lorem not working}
    
\end{document}

I see in the log file

Package fontspec Info: Font family 'Ubuntu(0)' created for font 'Ubuntu' with
(fontspec)             options
(fontspec)             [Ligatures=TeX,Extension=.ttf,UprightFont=*-Regular,Bold
Font=*-Bold,ItalicFont=*-Italic,BoldItalicFont=*-BoldItalic].
(fontspec)
(fontspec)              This font family consists of the following NFSS
(fontspec)             series/shapes:
(fontspec)
(fontspec)             - 'normal' (m/n) with NFSS spec.:
(fontspec)             <->"[Ubuntu-Regular.ttf]/OT:script=latn;language=dflt;ma
pping=tex-text;"
(fontspec)             - 'small caps'  (m/sc) with NFSS spec.:
(fontspec)             - 'bold' (b/n) with NFSS spec.:
(fontspec)             <->"[Ubuntu-Bold.ttf]/OT:script=latn;language=dflt;mappi
ng=tex-text;"
(fontspec)             - 'bold small caps'  (b/sc) with NFSS spec.:
(fontspec)             - 'italic' (m/it) with NFSS spec.:
(fontspec)             <->"[Ubuntu-Italic.ttf]/OT:script=latn;language=dflt;map
ping=tex-text;"
(fontspec)             - 'italic small caps'  (m/scit) with NFSS spec.:
(fontspec)             - 'bold italic' (b/it) with NFSS spec.:
(fontspec)             <->"[Ubuntu-BoldItalic.ttf]/OT:script=latn;language=dflt
;mapping=tex-text;"
(fontspec)             - 'bold italic small caps'  (b/scit) with NFSS spec.:

but also

LaTeX Font Warning: Font shape `TU/Ubuntu(0)/m/sc' undefined
(Font)              using `TU/Ubuntu(0)/m/n' instead on input line 14.

which simply tells you that there is no scmp feature for the font. This is confirmed by otfinfo:

> otfinfo -f Ubuntu-Regular.ttf
case    Case-Sensitive Forms
dnom    Denominators
frac    Fractions
kern    Kerning
liga    Standard Ligatures
numr    Numerators
ordn    Ordinals
pnum    Proportional Figures
salt    Stylistic Alternates
sinf    Scientific Inferiors
ss01    Stylistic Set 1
subs    Subscript
sups    Superscript
tnum    Tabular Figures
2
  • I've been able to use font-variant-caps: small-caps; in CSS with the Ubuntu font. Viewable here via the Variant selector: cssfontstack.com/Ubuntu ... is there a way to access that with XeLaTeX...? Apr 30, 2021 at 9:20
  • 1
    @JoeCorneli I believe that, when the smcp feature is absent, the browsers fake the small caps using smaller uppercase letters. This is not done by XeTeX, for typographical reasons.
    – egreg
    Apr 30, 2021 at 10:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .