On Sat, Nov 12, 2022 at 10:18:31PM +0000, Werner LEMBERG wrote:
> LilyPond's input encoding is UTF-8; markup strings must be thus
> emitted as UTF-8, too. Its Texinfo documentation extracts code
> snippets from master files (using the `lilypond-book` script),
> compiles them for graphical output, and shows the source code at the
> same time. Example:
>
> ```
> \markup {
> default
> \hspace #2
> \rotate #45
> \line {
> rotated 45°
> }
> }
> ```
Since you have a real use case here, and the case of someone trying
to use a degree sign without the EC font is only hypothetical, I have
instated your proposed definition for \textdegree.
I found that copying and pasting produced an extra space before
the degree sign, like 45 °. The output in the PDF file corresponding
to 45° was
[(45)]TJ/F126 10.9589 Tf 10.909 0 Td [(\260)]TJ
(produced using \pdfcompresslevel0) although I didn't/couldn't
investigate further. It may depend on the PDF reader.
I did investigate if something could be done inside the PDF output
to make the copiable text differ from the displayed text, using
a feature called ActualText (available in PDF standard from version 1.5
onwards), but it seemed far more trouble than it was worth.