Small caps only apply to capitals

I am trying to get small caps to work with the Doves Type font. It is an OpenType font and supports both UppercaseSmallCaps & SmallCaps (c2sc & smcp, if I’m correct). Unfortunately when I try to actually use the small caps (whether with \textsc or manually, only the actual capitals are in small caps, while the lowercase letters remain in lowercase.

Here’s an example:

\documentclass{article}
\usepackage[TU]{fontenc}
\usepackage{fontspec}
\setmainfont[Renderer=ICU]{Doves Type}

\begin{document}

This is not Small Caps text.

\textsc{This is Small Caps text}.

{\fontspec{Doves Type}THIS SENTENCE no verb}

{\fontspec[Letters=SmallCaps]{Doves Type}THIS SENTENCE no verb}

{\fontspec[Letters=UppercaseSmallCaps]{Doves Type}THIS SENTENCE no verb}

{\fontspec[Letters=SmallCaps]{Linux Libertine O}THIS SENTENCE no verb}

{\fontspec[Letters=SmallCaps]{Junicode}THIS SENTENCE no verb}

\end{document}


And here’s the output:

Or, render a bit badly as plain text:

This is not Small Caps text.

This is Small Caps text.

THIS SENTENCE no verb

THIS SENTENCE no verb

THIS SENTENCE no verb

THIS SENTENCE NO VERB

THIS SENTENCE NO VERB


I think maybe it’s defaulting to c2sc, but am unsure if that’s really what’s happening internally. Any ideas how I can get proper small caps out of this? I’ve tried Googling and reviewing questions under the small-caps tag, but with no luck.

• I bought a license for the first release of Doves Type, and also for the only update of which I received notification: version 2.03. That has no small caps, and yet I see small caps pictured on the web site to which you link. What’s the version number of your copy? Trying to answer your question will give me an excuse to update again ;-) – Thérèse Jun 3 '19 at 23:58
• Is there a math font that goes with that? – JPi Jun 4 '19 at 3:07
• @Thérèse, it’s 3.116. – Bob Uhl Jun 4 '19 at 3:18
• @JPi, not that I know of — I’m typesetting prose, not math, so I’ve not looked to see if there’s a math font which looks good with it. – Bob Uhl Jun 4 '19 at 3:18
• Why are you forcing the ICU renderer? And did you try to compile with lualatex? – Ulrike Fischer Jun 4 '19 at 6:32

NEWS: As of 2019-06-17, the designer has fixed the smcp feature. It now suffices to write \setmainfont{Doves Type}[SmallCapsFeatures={Ligatures={NoCommon,NoRare}}], and this question becomes of interest only as an example of diagnosing font problems and repairing them on the fly with \directlua{...}.

Let me start by showing the problem more clearly:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Doves Type}
\begin{document}
This is not Small Caps text.

\textsc{This is Small Caps text, WRONGLY affecting only caps.}

{\addfontfeatures{Letters=SmallCaps}This is Small Caps text, WRONGLY affecting only caps.}

{\addfontfeatures{Letters=UppercaseSmallCaps}This is Small Caps text, RIGHTLY affecting only caps.}
\end{document}


(Notice the use of \addfontfeatures{...} rather than the less efficient repetition of \fontspec{...}, a command which the manual describes as not generally recommended.)

Why the problem? Because the smcp feature has been defined in exactly the same way as c2sc, by mistake. That is, it replaces A by A.sc, whereas it should replace a by A.sc, and so on for the rest of the alphabet.

What to do? I rarely use xelatex, so I’d need more time to think about solutions for it (and someone else could do it better). But with lualatex, the solution is using \directlua{...} to add the correct substitutions to smcp:

\documentclass{article}
\usepackage{fontspec}
\directlua{
name = "smcp",
type = "substitution",
data = {
a = "A.sc",
b = "B.sc",
c = "C.sc",
d = "D.sc",
e = "E.sc",
f = "F.sc",
g = "G.sc",
h = "H.sc",
i = "I.sc",
j = "J.sc",
k = "K.sc",
l = "L.sc",
m = "M.sc",
n = "N.sc",
o = "O.sc",
p = "P.sc",
q = "Q.sc",
r = "R.sc",
s = "S.sc",
t = "T.sc",
u = "U.sc",
v = "V.sc",
w = "W.sc",
x = "X.sc",
y = "Y.sc",
z = "Z.sc",
},
}
}
\setmainfont{Doves Type}
\begin{document}
This is not Small Caps text.

\textsc{This is Small Caps text, WRONGLY affecting only caps.}

{\addfontfeatures{Letters=SmallCaps}This is Small Caps text, WRONGLY affecting only caps.}

{\addfontfeatures{Letters=UppercaseSmallCaps}This is Small Caps text, RIGHTLY affecting only caps.}
\end{document}


As you can see, this isn’t a complete solution: in the first place, it gives a “c2sc plus smcp” result (which you may or may not want), and second, it chokes on ligatures. I’ll experiment with refining my solution and update this answer later.

An even better solution would be contacting the designer, pointing to this question, and asking whether he could repair the definition of smcp in the next version of the font. (For accessibility, it would also be desirable to rename glyphs like the swashy Q and fix their encoding: right now, that Q is where ✓ ought to be, and it’s named accordingly.) In my experience, most designers want to know about any flaws so that they can fix them.

Update

To fix the problem with ligatures, turn them off for small caps; and to apply small caps to lowercase letters only, substitute A for A.sc, etc., as follows:

\documentclass{article}
\usepackage{fontspec}
\directlua{
name = "smcp",
type = "substitution",
data = {
["A.sc"] = "A",
a = "A.sc",
["B.sc"] = "B",
b = "B.sc",
["C.sc"] = "C",
c = "C.sc",
["D.sc"] = "D",
d = "D.sc",
["E.sc"] = "E",
e = "E.sc",
["F.sc"] = "F",
f = "F.sc",
["G.sc"] = "G",
g = "G.sc",
["H.sc"] = "H",
h = "H.sc",
["I.sc"] = "I",
i = "I.sc",
["J.sc"] = "J",
j = "J.sc",
["K.sc"] = "K",
k = "K.sc",
["L.sc"] = "L",
l = "L.sc",
["M.sc"] = "M",
m = "M.sc",
["N.sc"] = "N",
n = "N.sc",
["O.sc"] = "O",
o = "O.sc",
["P.sc"] = "P",
p = "P.sc",
["Q.sc"] = "Q",
q = "Q.sc",
["R.sc"] = "R",
r = "R.sc",
["S.sc"] = "S",
s = "S.sc",
["T.sc"] = "T",
t = "T.sc",
["U.sc"] = "U",
u = "U.sc",
["V.sc"] = "V",
v = "V.sc",
["W.sc"] = "W",
w = "W.sc",
["X.sc"] = "X",
x = "X.sc",
["Y.sc"] = "Y",
y = "Y.sc",
["Z.sc"] = "Z",
z = "Z.sc",
},
}
}
\setmainfont{Doves Type}[
SmallCapsFeatures={Ligatures={NoCommon,NoRare}}]
\begin{document}
This is not Small Caps text.

\textsc{This is Small Caps text, WRONGLY affecting only caps.}

{\addfontfeatures{Letters=SmallCaps,Ligatures={NoCommon,NoRare}}This is Small Caps text, WRONGLY AFFECTING only caps.}

{\addfontfeatures{Letters=UppercaseSmallCaps}This is Small Caps text, RIGHTLY AFFECTING only caps.}
\end{document}


For older installations

For older versions of luaotfload, try this older syntax (see Recent change to luaotfload or fontspec, otf? and How to adjust font features in LuaTeX?):

\directlua{
name = "smcp",
{
type = "substitution",
data = {
["A.sc"] = "A",
a = "A.sc",
}
},
"correction of smcp feature"
}
}

• Unfortunately, that fails to work on LuaTeX, Version 0.95.0 (TeX Live 2016/Debian)/LaTeX2e <2017/01/01> patch level 3 with the error texmf-dist/tex/luatex/luao tfload/luaotfload-features.lua:1354: attempt to index local 'specifications' (a nil value). I’ll be upgrading soon, so maybe that will fix it. In the interim, I’ll just use Junicode for small caps. It’s not terribly jarring. – Bob Uhl Jun 7 '19 at 11:21
• @BobUhl Debian is my operating system too, but I use a vanilla TeX Live rather than the Debian packages. Makes life much easier once you get the hang of installing it (see tex.stackexchange.com/a/29089), because the updates have solved lots and lots of problems. – Thérèse Jun 7 '19 at 12:31
• @BobUhl By the way, do you plan to contact the font designer? If not, let me know and I’ll do it. – Thérèse Jun 7 '19 at 12:36
• I reached out directly to him. Haven’t heard back, but hopefully he’ll be able to fix it. – Bob Uhl Jun 11 '19 at 2:58
• And he provided a new version that fixes the issue. Now that’s service! – Bob Uhl Jun 19 '19 at 17:46