I am on Windows using TeX Live 2016 and both xelatex and lualatex produce broken encodings when building the following
\documentclass{scrartcl}\usepackage{fontspec,unicode-math}\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}\setmainfont[Numbers={Proportional,OldStyle}]{Cambria}\setsansfont[Numbers={Proportional,OldStyle}]{Calibri}\setmonofont{Consolas}\setmathfont[Scale=MatchLowercase]{Cambria Math}\setkomafont{disposition}{\normalfont\scshape}\begin{document} \section{Main Font} gaffer fix flow affirm affluent 0123456789 \section{Sans Font} \textsf{gaffer fix flow affirm affluent 0123456789} \section{Monospace Font} \texttt{gaffer fix flow affirm affluent 0123456789} \section{Math Font} $x^2 + y^2 = z^2$ \subsection{More Math} $\sin \theta = \dot{\omega}$ \section{Logo} \LaTeX{}\end{document}
Copying the result in Adobe results in something like
M Fgaffer ix low afirm afluent S Fgaffer fix flow affirm affluent M Fgaffer fix flow affirm affluent 0123456789 M F𝑥+𝑦 = 𝑧. M Msin 𝜃 = 𝜔̇ LLATEX
Small caps, ligatures, old-style numbers, and math are all uncopyable/unsearchable.
Previous questions such as Copy oldstyle numbers from pdf (Minion Pro) have been marked as off-topic because they refer to allegedly fixed bugs (several versions ago).Is this a regression (in both lualatex and xelatex?!) or am I doing something wrong?
Update as of TeXLive 2018:
lualatex now produces sane unicode text on copying, if not necessarily the most compatible versions of each character (e.g., the ω in the equation is copied as 𝜔 [U+1D714, Mathematical Italic Small Omega], which it did before as well, only at the time neither common text editors, nor browsers dealt with it properly).
xelatex is as broken as before.
While both now produce ligatures on the sans serif text (which surprisingly, are copied correctly from the xelatex pdf), neither now emits ligatures in the serif text (but is not copied correctly from the xelatex pdf, oddly enough).