A follow up to this question.
For this and quite a few other fonts, the small cap glyphs show as uppercase when copied, as in line 1 and 4 in the output below. I am trying to override each individual unicode value to be the same in the output as in the input, and do the same for commands expanded as far as possible. Maybe I am misunderstanding how expansion works.
Is
\@tforthe right tool for this? Can it be made to respect spaces while still affecting each character individually?accsuppseems to have more levels of expansion. Can this be extended? What is the proper use of expansion commands? Is there a command to expand until there are no more commands to expand?
Output
MULTIPLE WORDS OCTOBER 11, 2018
MultipleWords\today
MultipleWords\today
MULTIPLE WORDS OCTOBER 11, 2018
MultipleWordsOctober 11, 2018
MultipleWordsOctober 11, 2018
MWE
\documentclass{report}
\usepackage{fontspec}
\setmainfont{SourceSerifPro-Regular.otf}
\usepackage{tagpdf}
\tagpdfsetup{uncompress,activate-all}
\usepackage{accsupp}
\makeatletter
\DeclareRobustCommand*{\actualtext}[1]{{%
\@tfor\next@letter:=#1\do{%
\tagmcbegin{tag=Span,actualtext-o=\next@letter}%
\next@letter%
\tagmcend%
}%
}}%
\DeclareRobustCommand{\PDFreplace}[1]{{%
\@tfor\next@letter:=#1\do{%
\BeginAccSupp{method=escape,ActualText=\next@letter}%
\next@letter%
\EndAccSupp{}%
}%
}}%
\makeatother
\begin{document}
{\scshape{Multiple Words \today}}
{\scshape\actualtext{Multiple Words \today}}
{\scshape\expandafter\actualtext\expandafter{Multiple Words \today}}
{\scshape{Multiple Words \today}}
{\scshape\PDFreplace{Multiple Words \today}}
{\scshape\expandafter\PDFreplace\expandafter{Multiple Words \today}}
\end{document}
activate-all. You are not adding structures. – Ulrike Fischer Oct 11 '18 at 20:55