# Copy-and-paste small-caps with ConTeXt and simplefonts

I am trying to typeset some text with small caps in ConTeXt (mkiv — version 2015.05.18 12:26), and have that text available for copy–and–paste.

Here's a minimum problematic setup:

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = ConTeXt (LuaTeX)
\usemodule[simplefonts]
\setmainfont[Warnock Pro]
\starttext
\sc Hello.
\stoptext


The ello portion will not copy and paste as expected (at least, apparently, on Mac and Windows, but I presume this is a system-agnostic problem). What is copied appears as H.

The Warnock font being referenced is OpenType and has the smcp feature.

I would hope this would be resolvable with both the \sc and \setff{smallcaps} macros.

In addition to the manuals, there are a number of seemingly applicable resources on ConTeXtGarden, but the parts I have read and various attempts I have made, have not revealed the underlying cause nor indicated the appropriate path to a solution or workaround.

What seems to be the most popular on-topic question on this site, Small-caps, old-style numbers, and some ligatures produce odd symbols in PDF copy text?, suggests that by using LuaTeX one works around problems with XeLaTeX, but it is not clear how to replicate the result in ConTeXt.

For ease of reference, see e.g.:

So this may not be the ideal answer, but I hope it gives future readers some insight.

First, my version of Warnock Pro (via Adobe Typekit) does not correctly substitute the small caps characters. It has them, and they work with native OS X apps such as TextEdit, but it seems they are just not used correctly with LuaTeX/ConTeXt.

Thankfully I have its cousin, Minion Pro, and its small caps substitutes work.

Second, even with Minion Pro substituted, one has to perform things in very specific ways. For example, if you use \MinionPro followed by a font-size changing macro e.g. \tfa, it appears to break the small caps substitutions and copy-and-paste will no longer work.

This is an order that worked for me:

### Define the fonts

\setmainfont[Warnock Pro]
\definefont[Minion][minionprodisp at 12pt]
\definefontfeature[f:smallcaps][always][smcp=yes, tlig=yes, trep=yes]


### Employ the fonts

This text is in Warnock.

Finally, here's a Dropbox Link sharing part of my experiments. There are two PDF files, ExampleFromTextEdit.pdf and SmallCapsWarnock.pdf, which respectively illustrate copy and paste working from a PDF created by TextEdit and not working from one created by ConTeXt. If someone were working backwards to identify the problematic mapping for small caps in ConTeXt, the comparison between these two files might be illuminating.