all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* ps-print question
@ 2010-12-31  7:22 David Penton
  2010-12-31  7:33 ` David Penton
  2010-12-31  9:22 ` Peter Dyballa
  0 siblings, 2 replies; 18+ messages in thread
From: David Penton @ 2010-12-31  7:22 UTC (permalink / raw)
  To: help-gnu-emacs

I am trying to use ps-print-buffer to print Lisp source code. However, all of my backquotes (left single quotes) like this: ` are coming out as right single quotes like this: '   This makes the printout unusable for Lisp.

I don't understand this. I saved the generated postscript file and looked at it in emacs. The backquote characters look ok there.

Is there something I should do to get the right character?

Best,

- Dave -


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2010-12-31  7:22 ps-print question David Penton
@ 2010-12-31  7:33 ` David Penton
  2010-12-31  9:22 ` Peter Dyballa
  1 sibling, 0 replies; 18+ messages in thread
From: David Penton @ 2010-12-31  7:33 UTC (permalink / raw)
  To: help-gnu-emacs


On 2010-12-31, at 2:22 AM, David Penton wrote:

> I am trying to use ps-print-buffer to print Lisp source code. However, all of my backquotes (left single quotes) like this: ` are coming out as right single quotes like this: '   This makes the printout unusable for Lisp.
> 
> I don't understand this. I saved the generated postscript file and looked at it in emacs. The backquote characters look ok there.
> 
> Is there something I should do to get the right character?
> 
> Best,
> 
> - Dave -

Sorry - I forgot to post the detalis which are: 

Using aquamacs (based on GNU Emacs 23.2.50.1) on OS X 10.6.5, using ghostscript to convert ps to pdf.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2010-12-31  7:22 ps-print question David Penton
  2010-12-31  7:33 ` David Penton
@ 2010-12-31  9:22 ` Peter Dyballa
  2010-12-31 14:02   ` David Penton
  1 sibling, 1 reply; 18+ messages in thread
From: Peter Dyballa @ 2010-12-31  9:22 UTC (permalink / raw)
  To: David Penton; +Cc: help-gnu-emacs


Am 31.12.2010 um 08:22 schrieb David Penton:

> Is there something I should do to get the right character?

Change the font! Use one with a visible backquote. Character Palette  
can help, Font Book as well with a personal text palette.

 From the header and prologue of the PostScript file you saved you can  
exactly determine which font is used for printing the backquote (GRAVE  
ACCENT, U+0060) and the other Lisp code. In GNU Emacs you can  
customise the use of fonts.

--
Greetings

   Pete

Build a man a fire and he'll be warm for a night, but set a man on  
fire and he'll be warm for the rest of his life.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2010-12-31  9:22 ` Peter Dyballa
@ 2010-12-31 14:02   ` David Penton
  2010-12-31 14:44     ` Peter Dyballa
  2011-01-01  2:07     ` David Penton
  0 siblings, 2 replies; 18+ messages in thread
From: David Penton @ 2010-12-31 14:02 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1283 bytes --]


On 2010-12-31, at 4:22 AM, Peter Dyballa wrote:

> 
> Am 31.12.2010 um 08:22 schrieb David Penton:
> 
>> Is there something I should do to get the right character?
> 
> Change the font! Use one with a visible backquote. Character Palette can help, Font Book as well with a personal text palette.
> 

Thanks, Pete.

I am trying to use Courier. I don't know how to choose any of the fonts you suggested, because to my knowledge the font choices for ps-print are limited. Here is a quote from the emacs website:

The variable ps-font-family specifies which font family to use for printing ordinary text. Legitimate values include Courier,         Helvetica,NewCenturySchlbk, Palatino and Times. 

There is mention of using BDF fonts for foreign languages, but I am not sure that is the answer. Also, I am puzzled because I thought Courier had a grave accent anyway.

> From the header and prologue of the PostScript file you saved you can exactly determine which font is used for printing the backquote (GRAVE ACCENT, U+0060) and the other Lisp code. In GNU Emacs you can customise the use of fonts.
> 
> --
> Greetings
> 
>  Pete
> 
> Build a man a fire and he'll be warm for a night, but set a man on fire and he'll be warm for the rest of his life.
> 


[-- Attachment #2: Type: text/html, Size: 5106 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2010-12-31 14:02   ` David Penton
@ 2010-12-31 14:44     ` Peter Dyballa
  2011-01-01  2:07     ` David Penton
  1 sibling, 0 replies; 18+ messages in thread
From: Peter Dyballa @ 2010-12-31 14:44 UTC (permalink / raw)
  To: David Penton; +Cc: help-gnu-emacs


Am 31.12.2010 um 15:02 schrieb David Penton:

> The variable ps-font-family specifies which font family to use for  
> printing ordinary text. Legitimate values include Courier,          
> Helvetica,NewCenturySchlbk, Palatino and Times.

If your printer or Ghostscript has built-in or knows more (Ghostscript  
has a file like Fontmap.local or Fontmap.gs) fonts, you can use them.

The restriction to the cited names is based on the fact that a few  
font families are always supported by PostScript (or PDF). Therefore  
these fonts do not need to be embedded into the PostScript (or PDF)  
file, it's sufficient to just reference them. This is also then  
sufficient when Ghostscript converts the PS output from Emacs into a  
raster data stream which is then sent to your printer, so that it uses  
the vector fonts it finds on disk.

This could fail with CUPS. (And I haven't checked how CUPS can be  
configured to use additional PostScript or TrueType fonts on disk.)

>
> There is mention of using BDF fonts for foreign languages, but I am  
> not sure that is the answer. Also, I am puzzled because I thought  
> Courier had a grave accent anyway.


It has, of course! You can compare all the backquotes in Character  
Palette. And: Forget BDF!


You have more options when you use htmlize (it understands customised  
font faces) and then print off the internet browser (htmlize-view.el  
does that "data transfer"). Mac OS X then should be able to render the  
pages with any font it knows and is on disk.

--
Greetings

   Pete

Theory and practice are the same, in theory, but, in practice, they  
are different.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2010-12-31 14:02   ` David Penton
  2010-12-31 14:44     ` Peter Dyballa
@ 2011-01-01  2:07     ` David Penton
  2011-01-01 20:55       ` Peter Dyballa
  1 sibling, 1 reply; 18+ messages in thread
From: David Penton @ 2011-01-01  2:07 UTC (permalink / raw)
  To: help-gnu-emacs


Ok, I took Pete Dyballa's advice and set up both ghostscript and aquamacs to add some fonts for ps-print in aquamacs. It is not working correctly yet, although I have made considerable progress.

I did the following as a result of my research:

I added the Bitstream Vera fonts to my system fonts, and also to the ghostscript Fontmap.GS. This made the fonts available in ghostscript. I was able to run gs interactively, do a findfont on all of the added fonts, and output some text using those fonts. So the additions to Fontmap.GS worked. Here are the relevant lines in Fontmap.GS:

(BitstreamVeraSans-Bold)                   (/Library/Fonts/VeraBd.ttf) ;
(BitstreamVeraSans-BoldOblique)	   (/Library/Fonts/VeraBI.ttf) ;
(BitstreamVeraSans-Oblique)	           (/Library/Fonts/VeraIt.ttf) ;
(BitstreamVeraSans-Roman)               (/Library/Fonts/Vera.ttf) ;
(BitstreamVeraSansMono-Bold)          (/Library/Fonts/VeraMoBd.ttf) ;
(BitstreamVeraSansMono-BoldOb)     (/Library/Fonts/VeraMoBI.ttf) ;
(BitstreamVeraSansMono-Oblique)	    (/Library/Fonts/VeraMoIt.ttf) ;
(BitstreamVeraSansMono-Roman)     (/Library/Fonts/VeraMono.ttf) ;
(BitstreamVeraSerif-Bold)                     (/Library/Fonts/VeraSeBd.ttf) ;

I then I added the following to my aquamacs preference file  (equivalent to .emacs) to make the fonts known to ps-print-buffer:

(setq ps-font-info-database
	    (append
	     '((BitstreamVera             ; the family key
	        (fonts (normal      . "BitstreamVeraSansMono-Roman")
		       (bold               . "BitstreamVeraSansMono-Bold")
		       (italic               . "BitstreamVeraSansMono-Oblique")
		       (bold-italic      . "BitstreamVeraSansMono-BoldOb"))
	        (size . 10.0)
	        (line-height . 23.84)
	        (space-width . 6.31739)
	        (avg-char-width . 6.31739)))
	     ps-font-info-database))

In aquamacs I then set the Ps Font Family customization to "BitstreamVera" to match the above addition to ps-font-info-database.

Then, when I did C-u M-x ps-print-buffer, aquamacs created a postscript file with no complaints.  I looked at this file, and it did have a bunch of stuff that loads the Bitstream Vera fonts, apparently as desired.

However, the postscript file generates some font-related errors when passed to ghostscript.

I shall not post the offending postscript file, not the ghostscript errors just yet. It seems more likely to me that there are additional emacs customizations that I may have to set to get this to work correctly. If I should post these or other info please let me know.

Can anyone point me in the right direction?

TIA,

- Dave -




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-01  2:07     ` David Penton
@ 2011-01-01 20:55       ` Peter Dyballa
  2011-01-02  0:43         ` Peter Dyballa
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Dyballa @ 2011-01-01 20:55 UTC (permalink / raw)
  To: David Penton; +Cc: help-gnu-emacs


Am 01.01.2011 um 03:07 schrieb David Penton:

> (setq ps-font-info-database
> 	    (append
> 	     '((BitstreamVera             ; the family key
> 	        (fonts (normal      . "BitstreamVeraSansMono-Roman")
> 		       (bold               . "BitstreamVeraSansMono-Bold")
> 		       (italic               . "BitstreamVeraSansMono-Oblique")
> 		       (bold-italic      . "BitstreamVeraSansMono-BoldOb"))
> 	        (size . 10.0)
> 	        (line-height . 23.84)
> 	        (space-width . 6.31739)
> 	        (avg-char-width . 6.31739)))
> 	     ps-font-info-database))


I used the font (or rather *compressed* family) name  
BitstreamVeraSansMono, because of the two proportional text fonts, and  
I used a line height of only 12.5 pt – I think the larger value is a  
fault. I added the font family via the customisation interface, and  
the preference to BitstreamVeraSansMono as well. So I have now this  
customisation:

  '(ps-font-family (quote BitstreamVeraSansMono))
  '(ps-font-info-database (quote ((BitstreamVeraSansMono (fonts  
(normal . "BitstreamVeraSansMono-Roman") (italic .  
"BitstreamVeraSansMono-Oblique") (bold . "BitstreamVeraSansMono-Bold")  
(bold-italic . "BitstreamVeraSansMono-BoldOb")) (size . 10.0) (line- 
height . 12.5) (space-width . 6.25) (avg-char-width . 6.25)) (Courier  
(fonts (normal . "Courier") (bold . "Courier-Bold") (italic . "Courier- 
Oblique") (bold-italic . "Courier-BoldOblique")) (size . 10.0) (line- 
height . 10.55) (space-width . 6.0) (avg-char-width . 6.0)) (Helvetica  
(fonts (normal . "Helvetica") (bold . "Helvetica-Bold") (italic .  
"Helvetica-Oblique") (bold-italic . "Helvetica-BoldOblique")) (size .  
10.0) (line-height . 11.56) (space-width . 2.78) (avg-char-width .  
5.09243)) (Times (fonts (normal . "Times-Roman") (bold . "Times-Bold")  
(italic . "Times-Italic") (bold-italic . "Times-BoldItalic")) (size .  
10.0) (line-height . 11.0) (space-width . 2.5) (avg-char-width .  
4.71432)) (Palatino (fonts (normal . "Palatino-Roman") (bold .  
"Palatino-Bold") (italic . "Palatino-Italic") (bold-italic . "Palatino- 
BoldItalic")) (size . 10.0) (line-height . 12.1) (space-width . 2.5)  
(avg-char-width . 5.08676)) (Helvetica-Narrow (fonts (normal .  
"Helvetica-Narrow") (bold . "Helvetica-Narrow-Bold") (italic .  
"Helvetica-Narrow-Oblique") (bold-italic . "Helvetica-Narrow- 
BoldOblique")) (size . 10.0) (line-height . 11.56) (space-width .  
2.2796) (avg-char-width . 4.17579)) (NewCenturySchlbk (fonts (normal .  
"NewCenturySchlbk-Roman") (bold . "NewCenturySchlbk-Bold") (italic .  
"NewCenturySchlbk-Italic") (bold-italic . "NewCenturySchlbk- 
BoldItalic")) (size . 10.0) (line-height . 12.15) (space-width . 2.78)  
(avg-char-width . 5.31162)) (AvantGarde-Book (fonts (normal .  
"AvantGarde-Book") (italic . "AvantGarde-BookOblique")) (size . 10.0)  
(line-height . 11.77) (space-width . 2.77) (avg-char-width . 5.45189))  
(AvantGarde-Demi (fonts (normal . "AvantGarde-Demi") (italic .  
"AvantGarde-DemiOblique")) (size . 10.0) (line-height . 12.72) (space- 
width . 2.8) (avg-char-width . 5.51351)) (Bookman-Demi (fonts  
(normal . "Bookman-Demi") (italic . "Bookman-DemiItalic")) (size .  
10.0) (line-height . 11.77) (space-width . 3.4) (avg-char-width .  
6.05946)) (Bookman-Light (fonts (normal . "Bookman-Light") (italic .  
"Bookman-LightItalic")) (size . 10.0) (line-height . 11.79) (space- 
width . 3.2) (avg-char-width . 5.67027)) (Symbol (fonts (normal .  
"Symbol")) (size . 10.0) (line-height . 13.03) (space-width . 2.5)  
(avg-char-width . 3.24324)) (Zapf-Dingbats (fonts (normal . "Zapf- 
Dingbats")) (size . 10.0) (line-height . 9.63) (space-width . 2.78)  
(avg-char-width . 2.78)) (ZapfChancery-MediumItalic (fonts (normal .  
"ZapfChancery-MediumItalic")) (size . 10.0) (line-height . 11.45)  
(space-width . 2.2) (avg-char-width . 4.10811)) (Zapf-Chancery- 
MediumItalic (fonts (normal . "ZapfChancery-MediumItalic")) (size .  
10.0) (line-height . 11.45) (space-width . 2.2) (avg-char-width .  
4.10811)))))

This works fine. With Ghostscript 9.0 – 8.71 fails. It seems (otool -L  
<gs binary> gives a hint) that gs 8.71 has no support for TrueType  
fonts built-in, i.e., libfreetype...

Lucida Sans Typewriter, in /System/Library/Frameworks/JavaVM.framework/ 
Versions/*/Home/lib/fonts, is TTF, and also Liberation Mono or DejaVu  
Sans Mono or Free Mono.

X11 has Luxi Mono in /usr/X11/share/fonts/Type1 – as PostScript Type 1  
font files l047*t.pfa.

TeX Live distributions come with Latin Modern PostScript Type 1 fonts  
– some of them are monospaced. And Luxi Mono is among them...

--
Greetings

   Pete

For some reason, this fortune reminds everyone of Marvin Zelkowitz.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-01 20:55       ` Peter Dyballa
@ 2011-01-02  0:43         ` Peter Dyballa
  2011-01-02 21:20           ` David Penton
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Dyballa @ 2011-01-02  0:43 UTC (permalink / raw)
  To: David Penton; +Cc: GNU Emacs List


Am 01.01.2011 um 21:55 schrieb Peter Dyballa:

> 8.71 fails. It seems (otool -L <gs binary> gives a hint) that gs  
> 8.71 has no support for TrueType fonts built-in, i.e., libfreetype...


This is wrong! Ghostscript or gs can handle TrueType fonts – but when  
gs is invoked to convert the file format (PS -> PDF, text extraction)  
it fails to find the TT fonts! The PS T1 fonts are found...

The reason is not clear, maybe dtruss brings some hints, that loading  
some PS module is omitted or such...

--
Greetings
                                  <]
   Pete       o        __o         |__    o           recumbo
     ___o    /I       -\<,         |o \  -\),-%       ergo sum!
___/\ /\___./ \___...O/ O____.....`-O-'-()--o_________________




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-02  0:43         ` Peter Dyballa
@ 2011-01-02 21:20           ` David Penton
  2011-01-03  0:22             ` Peter Dyballa
  0 siblings, 1 reply; 18+ messages in thread
From: David Penton @ 2011-01-02 21:20 UTC (permalink / raw)
  To: GNU Emacs List

[-- Attachment #1: Type: text/plain, Size: 1919 bytes --]

Pete:

Thanks for sending me some sample postscript files.

More developments on my end:

The error generated by ps2pdf when converting a file using added Bitstream fonts as described in an earlier post is caused by the use of the -dSAFER option being passed to ghostscript by ps2pdf and related shell scripts. I made a copy of the script ps2pdfwr (which is ultimately invoked by ps2pdf on my system) and removed the gs command line option -dSAFER. I also removed the -q command line option so that I could get verbose output. My version of the ps2pdfwr script reported that it was loading the Bitstream Vera fonts when converting.

Using my altered version of ps2pdfwr, the conversion from postscript from pdf occurred without reporting any errors. However, the output is still wrong. In the output from ps-print, I am still getting a right single quote instead of a left single quote. As far as I can tell, it is otherwise in the correct Bitstream Vera fond. I suppose the only way to understand this is to dig around in the postscript file.

The left single quote should work. I converted the following postscript using my altered version of ps2pdfwr, and the left single quote come through fine:

/BitstreamVeraSansMono-Roman findfont
15 scalefont
setfont
72 200 moveto
(This is in `Bitstream Vera Sans Mono Roman) show

The problem must be somewhere in the setup postscript generated by ps-print. I am not that expert at postscript, so it will not be easy to figure out. However, in the ps-print generated file, here is the line that actually prints the text with a left single quote:

(This is in `Bitstream Vera Sans Mono Roman)

That is, it is identical to my simple example, but when converted to pdf the ps-print version shows a right single quote in front of the word Bitstream. That's why I think something in the setup part of the ps-print postscript must be causing this.

- Dave -

[-- Attachment #2: Type: text/html, Size: 2722 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-02 21:20           ` David Penton
@ 2011-01-03  0:22             ` Peter Dyballa
  2011-01-03  2:19               ` David Penton
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Dyballa @ 2011-01-03  0:22 UTC (permalink / raw)
  To: David Penton; +Cc: GNU Emacs List


Am 02.01.2011 um 22:20 schrieb David Penton:

> (This is in `Bitstream Vera Sans Mono Roman)


Yeah – this is OK, except that the font is not "Roman". The `  
character becomes

         character: ‘ (8216, #o20030, #x2018)

in the PDF file via a CMAP (character mapping) in the PDF output file!  
Heh, this is a GNU service! Messages from the GNU Compiler Collection  
(GCC) are quoted in these "typographic" single or double quotes. (For  
which you can see in the *compilation* buffer lots of \342\200\234,  
\342\200\235, \342\200\236, \342\200\237 sequences.)

I tried to use -dCMAPDEBUG -dTTFDEBUG to debug a bit what gs is doing,  
but it's not clear why and when which CMap file gets inserted. Maybe  
you can find on the Ghostscript home page a clue to get specific  
ps2pdfwr help.


What keeps you from using mac-print-mode? It preserves the backquote.  
Or /quoteleft in PostScript.

--
Greetings

   Pete

A common mistake that people make when trying to design something  
completely foolproof is to underestimate the ingenuity of complete  
fools.
	- Douglas Adams, »Mostly Harmless«




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-03  0:22             ` Peter Dyballa
@ 2011-01-03  2:19               ` David Penton
  2011-01-03 13:15                 ` Peter Dyballa
  0 siblings, 1 reply; 18+ messages in thread
From: David Penton @ 2011-01-03  2:19 UTC (permalink / raw)
  To: GNU Emacs List


On 2011-01-02, at 7:22 PM, Peter Dyballa wrote:

> 
> Am 02.01.2011 um 22:20 schrieb David Penton:
> 
>> (This is in `Bitstream Vera Sans Mono Roman)
> 
> 
> Yeah – this is OK, except that the font is not "Roman". The ` character becomes

Actually, the font IS a Roman font. In typography Roman can either mean a serif font or an upright (not slanted, not italic) font. (Check wikipedia on this point.)  The Bitstream Vera font name uses Roman in the second sense.

In any case this font name was generated by the genfontmap.ps utility that comes with ghostscript, which extracts the font name directly from the TTF font file. That is what I used to generate a new fontmap for ghostscript; I did not choose the font names.

No matter; this is not part of the problem in any case.

> 
>        character: ‘ (8216, #o20030, #x2018)
> 
> in the PDF file via a CMAP (character mapping) in the PDF output file! Heh, this is a GNU service! Messages from the GNU Compiler Collection (GCC) are quoted in these "typographic" single or double quotes. (For which you can see in the *compilation* buffer lots of \342\200\234, \342\200\235, \342\200\236, \342\200\237 sequences.)
> 
> I tried to use -dCMAPDEBUG -dTTFDEBUG to debug a bit what gs is doing, but it's not clear why and when which CMap file gets inserted. Maybe you can find on the Ghostscript home page a clue to get specific ps2pdfwr help.
> 

Well, thanks for the information, Peter, but this line of analysis may not help very much, I fear.

The content of the pdf file is not directly relevant to the problem, nor is ps2pdfwr. The problem arises before conversion to pdf.

In my earlier posts I pointed out that the backquote IS preserved in the simple little postscript example that I supplied. It is preserved in interactive ghostscript, and also by my modified ps2pdfwr script so that the backquote appears properly in the resulting pdf file.

However, postscript generated by ps-print does NOT preserve the backquote - even when viewed interactively in ghostscript, without converting to pdf. So something about the way ps-print generates postscript is interfering with the use of the added fonts, perhaps.

Thus inspecting the resulting PDF is unlikely to tell us anything interesting. It would be far easier to just inspect the original postscript generated by ps-print.

> 
> What keeps you from using mac-print-mode? It preserves the backquote. Or /quoteleft in PostScript.

By now I already have more than one way of printing that preserves the backquote. But I am still interested in getting ps-print to work as I believe it should.

> 
> --
> Greetings
> 
>  Pete
> 
> A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
> 	- Douglas Adams, »Mostly Harmless«
> 




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-03  2:19               ` David Penton
@ 2011-01-03 13:15                 ` Peter Dyballa
  2011-01-03 14:25                   ` David Penton
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Dyballa @ 2011-01-03 13:15 UTC (permalink / raw)
  To: David Penton; +Cc: GNU Emacs List


Am 03.01.2011 um 03:19 schrieb David Penton:

> The content of the pdf file is not directly relevant to the problem,  
> nor is ps2pdfwr. The problem arises before conversion to pdf.

You don't seem to print (send to the printer, queue into the printer  
queue) the PS file, so the PDF file *is* the problem. And there, by  
means of a Character Mapping table (the CMap table) the ` (GRAVE  
ACCENT, U+0060) becomes ‘ (LEFT SINGLE QUOTATION MARK, U+2018).

>
> In my earlier posts I pointed out that the backquote IS preserved in  
> the simple little postscript example that I supplied.

Why is not possible to print the PS file directly?

> It is preserved in interactive ghostscript, and also by my modified  
> ps2pdfwr script so that the backquote appears properly in the  
> resulting pdf file.

Please, tell me which Ghostscript version you are using and what the  
command line is! I'd like to see this result myself. With the output  
of ps-print, if you refer to this. If you mean your own PS test file,  
then I understand that omitting -dSAFER allows gs some reasonable doing.

>
> However, postscript generated by ps-print does NOT preserve the  
> backquote - even when viewed interactively in ghostscript, without  
> converting to pdf.

I see! Before I just looked into the PS file... (it's OK) It's a bug  
on the presentation level. Certainly! The font encoding used in the PS  
file, /ISOLatin1Encoding, does not change the ` to ‘ – and I think  
it's even not applied because the /FontType of BitstreamVeraSansMono  
(I just noticed the "Roman" in its PostScript font name!) is 0 (and  
PostScript font is only then re-encoded when it does not know about  
the /ISOLatin1Encoding). And so its Unicode font encoding is used  
straight away – which might cause the application of some default  
features of the font, one of them being the change from ASCII quotes  
to "typographic" quotes. You can check this behaviour in OpenOffice or  
TextEdit. There must be some way of turning these default features  
off! I am thinking of reporting a bug... Or at least a request for  
enhancement!

Your first report was with the "standard" Ghostscript fonts in use,  
i.e. with substituting the real fonts, Courier, with clones from urw+ 
+, NimbusMonL. These are PostScript Type 1 fonts, they have kind of a  
backquote, which could be clearer. When I produce with a ps-print  
output from the ascii(7) man page it uses the Courier font name but  
looks up NimbusMonL. Pdffonts tells Courier is used in the PDF file –  
which shows ‘ instead of `. When gs or gv are displaying the PDF file  
I can't see an open font file with lsof, will try later–European  
evening, five or six hours from now–with some DTrace to determine  
which font file get used. If at all! Libfontconfig might supply them.  
And then they'll be TrueType or OpenType.

I'm thinking of one more experiment: embedding the PostScript fonts,  
Courier and LuxiMono.

> So something about the way ps-print generates postscript is  
> interfering with the use of the added fonts, perhaps.

No! This is *not* happening. Although I can understand the cause of  
this: your short test file shows `, the other file from ps-print  
not... But see above!

>
> Thus inspecting the resulting PDF is unlikely to tell us anything  
> interesting. It would be far easier to just inspect the original  
> postscript generated by ps-print.


As far as I can understand the PS code it's OK. Inside it no  
conversion of ` to ‘ happens. But then I wonder why when I use the  
PostScript Type 1 LuxiMono fonts from X11, which do not have a TT or  
OT "counterpart", the same conversion happens! It's a deep mystery,  
making life worth living, presumingly.

The Mac OS X software uses this to convert between formats:

	/System/Library/Printers/Libraries/convert -f Vera.ps -o Vera.pdf -i  
application/postscript -j application/pdf -P « path your printer's PPD  
file, for example /etc/cups/ppd/EPSON_EPL_5800.ppd or where ever the  
Installer installs the printer driver package; /etc/cups/ppd is the  
place where the PrintUtility copies and customises it »

--
Greetings

   Pete
Progress (n.): Process through which USENET evolved from smart people  
in front of dumb terminals to dumb people in front of smart terminals.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-03 13:15                 ` Peter Dyballa
@ 2011-01-03 14:25                   ` David Penton
  2011-01-03 18:02                     ` Peter Dyballa
                                       ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: David Penton @ 2011-01-03 14:25 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: GNU Emacs List

Pete:

I'm not sure I understand your last post. Let's start again.

In answer to one of your questions, I cannot send the ps file directly to the printer because I do not have a postscript printer. You must know that one cannot send postscript directly to a non-postscript printer and get the expected results. My only option is to use ghostscript, either with pdf or the printer as output device.

I am using ghostscript 9.0.

I have two postscript files. One I created by hand (it is the simple example I posted earlier). The second one was created by ps-print.

I converted both of these to pdf using exactly the same process. That is, I used the ps2pdfwr script (which call gs), but I altered ps2pdfwr to take out the -dSAFER option.

The postscript of the simple example converts to pdf which DOES contain the backquote. When I print out this pdf, the backquote prints correctly, as I wish.

The postscript generated by ps-print does NOT show up as a backquote, either on the screen or when printed.

Of course the two pdfs are different. But the reason for the difference obviously lies in the postscript files used to create the pdfs.

I will send you the files off the list.

Best,

- Dave -




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-03 14:25                   ` David Penton
@ 2011-01-03 18:02                     ` Peter Dyballa
  2011-01-03 23:43                     ` Peter Dyballa
  2011-01-05  0:20                     ` Peter Dyballa
  2 siblings, 0 replies; 18+ messages in thread
From: Peter Dyballa @ 2011-01-03 18:02 UTC (permalink / raw)
  To: David Penton; +Cc: GNU Emacs List


Am 03.01.2011 um 15:25 schrieb David Penton:

> I cannot send the ps file directly to the printer because I do not  
> have a postscript printer.

Just a short question: Did you install the driver for your printer? If  
your printer's manufacturer does not supply one for Mac OS X, then you  
can use Gimp-Print, or Gutenprint, as it's now called ("High quality  
printer drivers for Canon, Epson, Lexmark, and PCL printers." -> http://gimp-print.sourceforge.net/MacOSX.php 
; there is a list of supported printers). It's based on Ghostscript,  
though...

CUPS should be able to convert any input to the output format your  
printer understands – once your printer's capabilities are known to  
CUPS. This conversion/adaptation is the printing system's task. (Not  
that much your's.)

--
Greetings

   Pete

Well begun is half done.
			– Optimist.
Half done is well begun.
			– Realist.
Half begun is well done.
			– Australian.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-03 14:25                   ` David Penton
  2011-01-03 18:02                     ` Peter Dyballa
@ 2011-01-03 23:43                     ` Peter Dyballa
  2011-01-05  0:20                     ` Peter Dyballa
  2 siblings, 0 replies; 18+ messages in thread
From: Peter Dyballa @ 2011-01-03 23:43 UTC (permalink / raw)
  To: David Penton; +Cc: GNU Emacs List


Am 03.01.2011 um 15:25 schrieb David Penton:

> In answer to one of your questions, I cannot send the ps file  
> directly to the printer because I do not have a postscript printer.

CUPS should be able to convert every type of input to the correct  
output data stream – once the printer driver is correctly installed  
and all necessary resources are installed as well.

> The postscript of the simple example converts to pdf which DOES  
> contain the backquote. When I print out this pdf, the backquote  
> prints correctly, as I wish.
>
> The postscript generated by ps-print does NOT show up as a  
> backquote, either on the screen or when printed.

Interestingly in doc-view-mode the not visible ` in the PDF file is  
rendered in the PNG output as ` – which seems to second my assumption  
about character mapping. But it does not explain why one PS source  
produces the correct PDF output...

>
> Of course the two pdfs are different. But the reason for the  
> difference obviously lies in the postscript files used to create the  
> pdfs.

Yes, something in the PS file might trigger the insertion of a CMap  
into the PDF output.


Dave, let's try this: you launch Emacs with -Q and create a bug report  
about ps-print that you send to GNU Emacs developers (and maybe why  
only gs is able to convert the PS output to PDF or something else).  
And I'll try to report the gs bug. OK?


BTW, I had no success in preserving the backquote or backtick!

--
Greetings

   Pete

Time flies like an error – but fruit flies like a banana!
				- (almost) Groucho Marx




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-03 14:25                   ` David Penton
  2011-01-03 18:02                     ` Peter Dyballa
  2011-01-03 23:43                     ` Peter Dyballa
@ 2011-01-05  0:20                     ` Peter Dyballa
  2011-01-07  3:56                       ` David Penton
  2 siblings, 1 reply; 18+ messages in thread
From: Peter Dyballa @ 2011-01-05  0:20 UTC (permalink / raw)
  To: David Penton; +Cc: GNU Emacs List

Dave,

I have an answer from Ghostscript/Artifex. It points to footnote in  
PRML, the PostScript Language Reference
Manual (see p785 of the 3rd edition):

	3. The ISOLatin1Encoding encoding vector deviates from the ISO 8859-1  
standard in one
	   respect: the character at position 140 is quoteleft, whereas the  
ISO standard specifies
	   grave. A PostScript program needing to conform exactly to the ISO  
standard should
	   create a modified encoding vector with this entry changed.

So what is displayed in the buffer as

	character: ` (96, #o140, #x60)

is in reality, printed on some medium or on screen

	character: ‘ (8216, #o20030, #x2018)

or: instead of /grave the character /quoteleft is encoded here.


You can try yourself to open the PS file (any with a `) without any  
precautions and it will be Unicode or ISO Latin, maybe some ASCII. In  
a second buffer open the same file–actually a copy, because I don't  
think that GNU Emacs can display the same file in two different  
encodings–in adobe-standard-encoding. To do so start with:

	C-x RET c adobe-standard-encoding RET v

I assume you are in dired-mode and the text cursor is on the copy.  
Otherwise you have to use C-x f. Now notice the difference!


I think of continuing the conversation with the Ghostscript folks  
(extending to PDF), and I also sent a bug report to the GNU Emacs  
developers because PS files are *not* opened in a PostScript but some  
text encoding. With the consequence that folks like you and me think a  
` is a ` while it's a ‘...

--
Greetings

   Pete

"By filing this bug report you have challenged the honor of my family.  
Prepare to die!"




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-05  0:20                     ` Peter Dyballa
@ 2011-01-07  3:56                       ` David Penton
  2011-01-07 10:28                         ` Peter Dyballa
  0 siblings, 1 reply; 18+ messages in thread
From: David Penton @ 2011-01-07  3:56 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: GNU Emacs List


On 2011-01-04, at 7:20 PM, Peter Dyballa wrote:

> Dave,
> 
> I have an answer from Ghostscript/Artifex. It points to footnote in PRML, the PostScript Language Reference
> Manual (see p785 of the 3rd edition):
> 
> 	3. The ISOLatin1Encoding encoding vector deviates from the ISO 8859-1 standard in one
> 	   respect: the character at position 140 is quoteleft, whereas the ISO standard specifies
> 	   grave. A PostScript program needing to conform exactly to the ISO standard should
> 	   create a modified encoding vector with this entry changed.
> 
> So what is displayed in the buffer as
> 
> 	character: ` (96, #o140, #x60)
> 
> is in reality, printed on some medium or on screen
> 
> 	character: ‘ (8216, #o20030, #x2018)
> 
> or: instead of /grave the character /quoteleft is encoded here.
> 
> 
> You can try yourself to open the PS file (any with a `) without any precautions and it will be Unicode or ISO Latin, maybe some ASCII. In a second buffer open the same file–actually a copy, because I don't think that GNU Emacs can display the same file in two different encodings–in adobe-standard-encoding. To do so start with:
> 
> 	C-x RET c adobe-standard-encoding RET v
> 
> I assume you are in dired-mode and the text cursor is on the copy. Otherwise you have to use C-x f. Now notice the difference!
> 
> 
> I think of continuing the conversation with the Ghostscript folks (extending to PDF), and I also sent a bug report to the GNU Emacs developers because PS files are *not* opened in a PostScript but some text encoding. With the consequence that folks like you and me think a ` is a ` while it's a ‘...

Peter:

Yes, I discovered that several days ago. You are correct that the problem is with the encoding vector. But there is no bug that anyone is likely to fix anytime soon. 

The issue is not related to the encoding of the postscript file. In order to understand this, you must understand what postscript font encoding vectors are. And, as I indicated to you several posts ago, the "problem" is indeed in the postscript generated by ps-print. The ps-print code generates postscript that intentionally replaces the font's encoding vector with the ISOLatin1 encoding vector, which does the "wrong thing" with the grave character.

I suggest that you do a bit of reading in PRML to understand what a font encoding vector is. Once you do you will see that the encoding of the ps file is not really the problem, although it is possible to get the grave to print by textually replacing the grave with the string \221 everywhere. The ISOLatin1 encoding puts grave at #o221.

I have done my own fix for now, by altering the postscript generated by ps-print. My fix involves changing the font encoding vector at octal 140 to map it onto the grave character. So I don't care whether anyone fixes it. I suspect that this issue has been known for a long time.

- Dave -




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ps-print question
  2011-01-07  3:56                       ` David Penton
@ 2011-01-07 10:28                         ` Peter Dyballa
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Dyballa @ 2011-01-07 10:28 UTC (permalink / raw)
  To: David Penton; +Cc: GNU Emacs List


Am 07.01.2011 um 04:56 schrieb David Penton:

> The issue is not related to the encoding of the postscript file.

I did not mean to express this. What I wanted to write is that a ` in  
the input is displayed or printed as ‘.

> And, as I indicated to you several posts ago, the "problem" is  
> indeed in the postscript generated by ps-print. The ps-print code  
> generates postscript that intentionally replaces the font's encoding  
> vector with the ISOLatin1 encoding vector, which does the "wrong  
> thing" with the grave character.

This is commonly done so. Other text to PostScript or PDF convertors  
(a2ps, enscript) work the same way.

--
Greetings

   Pete

Sending unsolicited commercial eMail to this account incurs a fee of €  
500 per message and acknowledges the legality of this contract.




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-01-07 10:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-31  7:22 ps-print question David Penton
2010-12-31  7:33 ` David Penton
2010-12-31  9:22 ` Peter Dyballa
2010-12-31 14:02   ` David Penton
2010-12-31 14:44     ` Peter Dyballa
2011-01-01  2:07     ` David Penton
2011-01-01 20:55       ` Peter Dyballa
2011-01-02  0:43         ` Peter Dyballa
2011-01-02 21:20           ` David Penton
2011-01-03  0:22             ` Peter Dyballa
2011-01-03  2:19               ` David Penton
2011-01-03 13:15                 ` Peter Dyballa
2011-01-03 14:25                   ` David Penton
2011-01-03 18:02                     ` Peter Dyballa
2011-01-03 23:43                     ` Peter Dyballa
2011-01-05  0:20                     ` Peter Dyballa
2011-01-07  3:56                       ` David Penton
2011-01-07 10:28                         ` Peter Dyballa

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.