Thread (9 messages) 9 messages, 4 authors, 2021-03-07

Re: Escaping hyphens ("real" minus signs in groff)

From: Michael Kerrisk (man-pages) <hidden>
Date: 2021-01-22 08:09:46

Hi Deri,

On Thu, 21 Jan 2021 at 18:42, Deri [off-list ref] wrote:
On Thursday, 21 January 2021 11:03:13 GMT Michael Kerrisk (man-pages) wrote:
quoted
quoted
And I mean copy-and-paste not just from PDF but from a terminal window.
Yes, but I have a question: "\-1" renders in PDF as a long dash
followed by a "1". This looks okay in PDF, but if I copy and paste
into a terminal, I don't get an ASCII 45. Seems seems to contradict
what you are saying about cut-and-paste above. What am I missing?
If I do:-

echo "- \- \[fi]"|groff -Tpdf | okular -

I see a hyphen, minus and fi ligature. Copying to a text document gives hyphen
hyphen f i. The reason is because gropdf adds a ToUnicode CMAP entry to fonts
which used the text.enc encoding when created with afmtodit. You can see a
difference if you run:-

echo "- \- \[fi]"|groff -Tpdf -P-u | okular -

Which prevents the CMAP entry, and when you copy to text the minus unicode cha
character is seen. (On my system the fi ligature is separated into f i still
but I suspect that is KDE being "helpful").
Thanks! That's a helpful explanation!

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help