Bug 691864 - `, GRAVE ACCENT, U+0060, becomes ‘, LEFT SINGLE QUOTATION MARK, U+2018
Summary: `, GRAVE ACCENT, U+0060, becomes ‘, LEFT SINGLE QUOTATION MARK, U+2018
Status: RESOLVED INVALID
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 9.00
Hardware: Macintosh Mac System 9.x
: P4 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-04 00:37 UTC by Peter Dyballa
Modified: 2011-01-04 10:42 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
PS output from ps-print v7.3.5 (38.61 KB, application/postscript)
2011-01-04 09:26 UTC, Peter Dyballa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Dyballa 2011-01-04 00:37:51 UTC
In GNU Emacs (versions 23.2 or 24.0.50) I can use the built-in ps-print to print the ascii(7) man page, rendered in some buffer. The generated PostScript file has `, GRAVE ACCENT, U+0060, three times. When converted to PDF the backtick has be become a typographic quote ‘, LEFT SINGLE QUOTATION MARK, U+2018. A Lisp programme with ‘ as the quote character is not really legible.

(It also appears that the PS Interpreter presents the backquote as a typographic quote.)

How can this behaviour be corrected that the ` is saved?

Interestingly a simple PostScript file like

	%!PS
	/Courier findfont
	15 scalefont
	setfont
	72 200 moveto
	(This is in `Courier') show

shows the GRAVE ACCENT correctly when viewing the PS or the PDF file. Similarly doc-view-mode in GNU Emacs renders the PS file from printing the ascii(7) man page correctly in PNG format. The ` is apparently still a `. The conversion happens with gs and these options:

	"-dSAFER" ;; Avoid security problems when rendering files from untrusted
		      ;; sources.
	    "-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4"
	    "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET")
Comment 1 Alex Cherepanov 2011-01-04 04:32:41 UTC
Please attach a PS file that doesn't look correctly
or doesn't convert to PDF correctly.
PostScript programmers like to read PostScript at the bedtime
and don't really know how to print ascii man page in emacs.
Comment 2 Peter Dyballa 2011-01-04 09:26:18 UTC
Created attachment 7084 [details]
PS output from ps-print v7.3.5

In GNU Emacs 24.0.50 I invoked manual-entry and entered "ascii". The formatted man page was then converted to PostScript with the ps-spool-buffer command. It created a new buffer "*PostScript*" which I saved as the attached file. When I use gv 3.7.1 or gs 9.00 directly to display the PS file, the backquotes at octal \140, hex \x60, and decimal 96 do not show up as ` but merely as ´.

Gs produces this output:

GPL Ghostscript  9.00 (2010-09-14)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Loading NimbusMonL-Regu font from /opt/local/share/ghostscript/9.00/Resource/Font/NimbusMonL-Regu... 2567232 1238315 2725924 1442507 1 done.
Loading URWChanceryL-MediItal font from /opt/local/share/ghostscript/9.00/Resource/Font/URWChanceryL-MediItal... 2724568 1401260 2846500 1553713 1 done.
Loading NimbusMonL-Bold font from /opt/local/share/ghostscript/9.00/Resource/Font/NimbusMonL-Bold... 2881904 1554094 2846500 1559411 1 done.
Loading URWPalladioL-Roma font from /opt/local/share/ghostscript/9.00/Resource/Font/URWPalladioL-Roma... 3059336 1724187 2866596 1566440 1 done.
Loading NimbusMonL-ReguObli font from /opt/local/share/ghostscript/9.00/Resource/Font/NimbusMonL-ReguObli... 3196576 1857596 2866596 1573683 1 done.
Loading NimbusMonL-BoldObli font from /opt/local/share/ghostscript/9.00/Resource/Font/NimbusMonL-BoldObli... 3333816 1999596 2866596 1577391 1 done.
>>showpage, press <return> to continue<<


Mac OS X 10.5.8, PPC. Ghostscript was installed via MacPorts.
Comment 3 Ken Sharp 2011-01-04 10:42:18 UTC
(In reply to comment #2)

> In GNU Emacs 24.0.50 I invoked manual-entry and entered "ascii". The formatted
> man page was then converted to PostScript with the ps-spool-buffer command. It
> created a new buffer "*PostScript*" which I saved as the attached file. When I
> use gv 3.7.1 or gs 9.00 directly to display the PS file, the backquotes at
> octal \140, hex \x60, and decimal 96 do not show up as ` but merely as ´.

The file uses the Courier font, and establishes an ISOLatin1Encoding. At position 96 the Encoding contains the /quoteleft glyph.

Checking the ISOLatin1Encoding as defined in the PostScript Language Reference Manual we see that this is correct (see p785 of the 3rd edition)

The grave accent is encoded at position octal 221 (decimal 145, 0x91).

If you want to map the /grave into position 96 of the Encoding then you will need to re-encode the font.

Ghostscript is certainly working as expected with this file, so this is not a bug. As far as I can tell the ASCII chart specifies position 96 as a back quote/left quote, not a grave, so I don't really see what the problem is. Of course this is not the same file as originally reported. Comment #0 says that "The generated PostScript file has `, GRAVE ACCENT, U+0060, three times". If this is the case then there may be a problem, but if so its a different problem in a different file.

I suspect the difficulty is more one of font design than anything else. The 'quoteleft' glyph is quite different among fonts. The one shown in the PLRM for instance is curved, and nothing at all like a grave accent. The one in the NimbusMonL-Regu font (which is the URW version of Courier) is shaped like a truncated wedge. Both the left and right quotes angle upwards from left to right, the right quote is widest at the top, the left quote is widest at the bottom.

Eg:
/Courier 50 selectfont
10 10 moveto
/quoteleft glyphshow
40 10 moveto
/quoteright glyphshow
70 10 /grave glyphshow
showpage

will demonstrate the shapes.

Copying the example PostScript shown in comment #0 does *not* result in a grave accent for me, but instead has left and right single quotes. These are quite clearly the same as those from the test above.