3

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􀄆􀄎􀄓 F􀄔􀄓􀄙
gaffer 􀏐ix 􀏐low af􀏐irm af􀏐luent 􀍔􀍕􀍖􀍗􀍘􀍙􀍚􀍛􀍜􀍝
􀍖 S􀄆􀄓􀄘 F􀄔􀄓􀄙
gaffer fix flow affirm affluent 􀎺􀎻􀎼􀎽􀎾􀎿􀏀􀏁􀏂􀏃
􀍗 M􀄔􀄓􀄔􀄘􀄕􀄆􀄈􀄊 F􀄔􀄓􀄙
gaffer fix flow affirm affluent 0123456789
􀍘 M􀄆􀄙􀄍 F􀄔􀄓􀄙
𝑥􀬶 + 𝑦􀬶 = 𝑧􀬶
􀍘.􀍕 M􀄔􀄗􀄊 M􀄆􀄙􀄍
sin 𝜃 = 𝜔̇
􀍙 L􀄔􀄌􀄔
LATEX
􀍕

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).

  • 4
    If one ignore math it looks as if only cambria is a problem -- and that is a ttc-font. – Ulrike Fischer May 3 '17 at 22:16
  • @UlrikeFischer the numbers in calibri don't work either... – Joe May 4 '17 at 4:37
  • Old style numbers are often a problem. – Ulrike Fischer May 4 '17 at 5:48
  • 3
    Try \XeTeXgenerateactualtext=1. The copy&paste may become better. – Akira Kakuto May 4 '17 at 7:26
  • @AkiraKakuto where is this command documented? in any case, while the document becomes searchable/copyable, the locations of all selection boxes are now incorrect as seen here: imgur.com/a/bGeCG – Joe May 4 '17 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.