Is there a good (possibly free) opentype font out there with small-caps figures and small question and exclamation marks; and could I use them with xelatex + fontspec?
Or, better still, is there a workaround I can use with one of the excellent free fonts like Linux Libertine or TeX Gyre Pagella? I need this for my page headers, which I want to typeset in all-smallcaps; therefore it would be useful to have some kind of mechanism I can put in my pagestyle macro. Shrinking all-caps is not the way — in Linux Libertine, for example, lining numbers and question and exclamation marks are noticably smaller than the capital letters, and anyway, scaled caps don't look that good.
Based on this answer I tried the following, which seems to work within normal text, but not in the pagestyle macro (I'm not very comfortable around \catcode
and \lccode
, so it's more or less copy and paste and trial and error; maybe it just needs the odd \protect
strewn in?):
File mysmallcaps.sty
:
\ProvidesPackage{mysmallcaps}
\newenvironment{mylcsc}{%
\addfontfeature{Letters=UppercaseSmallCaps,Letters=SmallCaps,LetterSpace=2,WordSpace=1.2,Numbers=Lining}%
\catcode`\'=\active\begingroup\lccode`\~=`\'\lowercase{\endgroup\def~{\protect\raisebox{-0.45ex}{\kern0.03em'}}}%
\catcode`!=\active\begingroup\lccode`\~=`!\lowercase{\endgroup\def~{\protect\scalebox{1}[0.75]{\kern0.01em!}}}%
\catcode`?=\active\begingroup\lccode`\~=`?\lowercase{\endgroup\def~{\protect\scalebox{1}[0.75]{\kern0.02em?}}}%
\catcode`1=\active\begingroup\lccode`\~=`1\lowercase{\endgroup\def~{\protect\scalebox{1}[0.8]{1}}}%
\catcode`2=\active\begingroup\lccode`\~=`2\lowercase{\endgroup\def~{\protect\scalebox{1}[0.8]{2}}}%
\catcode`3=\active\begingroup\lccode`\~=`3\lowercase{\endgroup\def~{\protect\scalebox{1}[0.8]{3}}}%
\catcode`4=\active\begingroup\lccode`\~=`4\lowercase{\endgroup\def~{\protect\scalebox{1}[0.8]{4}}}%
\catcode`5=\active\begingroup\lccode`\~=`5\lowercase{\endgroup\def~{\protect\scalebox{1}[0.8]{5}}}%
\catcode`6=\active\begingroup\lccode`\~=`6\lowercase{\endgroup\def~{\protect\scalebox{1}[0.8]{6}}}%
\catcode`7=\active\begingroup\lccode`\~=`7\lowercase{\endgroup\def~{\protect\scalebox{1}[0.8]{7}}}%
\catcode`8=\active\begingroup\lccode`\~=`8\lowercase{\endgroup\def~{\protect\scalebox{1}[0.8]{8}}}%
\catcode`9=\active\begingroup\lccode`\~=`9\lowercase{\endgroup\def~{\protect\scalebox{1}[0.8]{9}}}%
\catcode`0=\active\begingroup\lccode`\~=`0\lowercase{\endgroup\def~{\protect\scalebox{1}[0.8]{0}}}%
}{}
% redefining \ps@headings like this does _not_ work:
\def\ps@mynewheadings{%
\ps@headings
\let\@oddfoot\@empty\let\@evenfoot\@empty
\def\@evenhead{%
\thepage\hfil
\normalfont\small\begin{mylcsc}\MakeLowercase{\leftmark}\end{mylcsc}%
}%
\def\@oddhead{%
{\normalfont\small\begin{mylcsc}\MakeLowercase{\rightmark}\end{mylcsc}}%
\hfil\thepage%
}%
}
\pagestyle{mynewheadings}
File test.tex
:
\documentclass{book}
\usepackage{lipsum}
\usepackage{fontspec}
\setmainfont[Numbers=OldStyle, Ligatures=TeX]{Linux Libertine O}
\usepackage{mysmallcaps}
\begin{document}
\chapter{Here comes Orwell's 1984!}
\section{Whatever happened in 336\,\textsc{bc} that made the high priest blush?}%
Can't? Won't! 0123456789\\[3mm]
\emph{Small-caps with homemade corrections:}\\
\begin{mylcsc}Can't? Won't! 0123456789\end{mylcsc}\\[3mm]
\emph{Scaled all-caps:}\\
\scalebox{0.65}[0.65]{\addfontfeature{Numbers=Lining, LetterSpace=4}\MakeUppercase{Can't? Won't! 0123456789}}\\[12mm]
\lipsum\lipsum
\end{document}
\endinput
Best Answer
Even among commercial fonts, few have small cap figures and punctuation marks, but the following do, and I’ve used them successfully with
luatex
andxetex
: Augustin, Cartier Book Pro, Jannon 10 Pro, and Neacademia Latin. In the case of Jannon 10 Pro, you have to specifyScript=Default
in your invocation offontspec
for the feature to work.Here is a demonstration, from which you can see that Neacademia and Cartier have small cap figures whose ascending and descending parts are tucked in more (Cartier) or less (Neacademia), while the small cap figures in Jannon and Augustin are lining.