[XeTeX] Fwd: PDFs and advanced font features

Joel C. Salomon joelcsalomon at gmail.com
Fri Oct 29 17:42:46 CEST 2010


On 10/28/2010 12:55 PM, Bogdan Butnaru wrote:
> So XeTeX isn’t technically mangling anything: it just uses the
> private-area codepoints the font uses to encode the small caps/titling
> caps/old-style digits. I just need it to stop doing that, somehow —
> or, more specifically, to also remember and note in the PDF what those
> characters mean.
<snip>
> At this point in writing I realized that my fruitless searches have
> all been about small-caps and variant glyphs. I tried searching for
> ligature issues, and noticed this:
> http://www.tug.org/pipermail/xetex/2010-May/016628.html
> 
> So theoretically the basics exist. I’ve tried accsupp, and it doesn’t
> quite seem to work.

In the vein of \texorpdfstring, here’s a macro I’m using:

\documentclass{article}
\usepackage[unicode]{hyperref}
\usepackage{accsupp}

\newcommand*{\displayorcopystring}[2]{\BeginAccSupp{
	method=pdfstringdef, unicode,
	ActualText={#2}}#1\EndAccSupp{}}


\begin{document}
\displayorcopystring{See this}{But copy this}.
\end{document}

I’ve used it for acronyms, e.g.,
	\newcommand*{\acronym}[1]{%
		\displayorcopystring{\textsc{\MakeLowercase{#1}}}{#1}}
	\acronym{PDF}	% displays as ‘ᴘᴅꜰ’; copies as ‘PDF’.
and have not had trouble with copy-and-paste.

--Joel


More information about the XeTeX mailing list