all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* printing
@ 2003-03-18 21:18 Kevin Reeder
  0 siblings, 0 replies; 147+ messages in thread
From: Kevin Reeder @ 2003-03-18 21:18 UTC (permalink / raw)


Text printing runs the left most columns off of the page. From the command
line I can run say, pr -h "" -0 5 %s | lpr and get what I expect but
haven't had success within Emacs. I've toyed with various switches and
options in the WP-Lpr Group and still no good. Any tips?

Kevin

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

* Printing
@ 2009-03-28 10:31 Андрей Парамонов
  2009-03-28 14:56 ` Printing Jan Djärv
                   ` (4 more replies)
  0 siblings, 5 replies; 147+ messages in thread
From: Андрей Парамонов @ 2009-03-28 10:31 UTC (permalink / raw)
  To: emacs-devel

Hello!

I use Emacs on regular basis for a couple of years already, and I find
it a great piece of software. Currently I use Emacs 23. As a user, I'm
very pleased with the overall direction of development. I highly
appreciate recent usability improvements, namely Xft fonts, visual
line wrapping, transparent remote file access, etc.

With the most important internationalisation and display issues fixed
in Emacs 23, it's probably the right time to attack another long
standing problem: the printing. By this post I wish to attract your
attention to fundamental usability problems of Emacs printing
mechanism, and initiate a discussion of how to resolve them.

Emacs printing is broken -- and I mean it -- is *fundamentally*,
totally broken. You have either to be a PostScript guru, restrict
yourself to ASCII characters, or cheat/hack to be able to use Emacs
printing. And I'm not even talking about non-GNU systems! Many users
find it major pain or impossible to setup printing in Emacs (here are
links to *recent* threads at gnu.emacs.help):

Pretty multilingual PostScript printing:
http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/4b08d4ff107d48d/

Printing with emacs: Not working:
http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/c477e1561c444583/

Printing in Emacs:
http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/d4c5ee0e29adcdfb/

To reproduce the problem you only need Emacs, X and a printer:

1) C-h h; the 'Hello' buffer with international characters shows
   up. If you don't see anything except Latin characters, please
   install the TTF version of unifont.

2) M-x ps-print-buffer-faces; the buffer is printed, but every
   non-Latin character is replaced with '?'.

However, if the 'Hello' buffer contents is printed via as simple
editor as GEdit, *all* the characters are printed, and appear smooth
and nice!

Having analysed mine and other users' experience, and having examined
how the printing works in modern applications, I propose the following
requirements for the Emacs printing mechanism:

1) Simple printing configuration should require no or almost no
   knowledge and effort. The only user input that might be required is
   the printer name.

2) It should not be necessary to install additional packages/files
   solely for the Emacs printing.

3) Printing functionality should work equally good on PostScript and
   non-PostScript printers.

I can think of the following ways of how these requirements may be
achieved:

a) Try to improve current functionality, making no or almost no
   modifications to the current printing engine. This includes
   simplifying the configuration interface. Not sure points 2) and 3)
   can be fixed this way though.

b) Use standard GTK+ printing facilities as GEdit and many other
   applications do. Emacs is built with GTK+ interface for quite some
   time now, so I suppose there should be no architectural problem in
   using GTK+ for printing as well. Please correct me if I'm wrong.

c) Utilise superior rendering capabilities of some other application,
   like it is done by package hfyview.el:
   http://www.emacswiki.org/emacs/PrintWithWebBrowser . This
   approach doesn't conform to 2) though.

From the user perspective, I like b) because I think it would solve 3)
and would present a nice user interface. I call you to discuss the
pros and contras of the proposed approaches from the programmer
perspective and/or propose other solutions.

Thanks for your effort,
Andrey Paramonov

To reproduce the problem you only need Emacs, X and a printer:

1) C-h h; the 'Hello' buffer with international characters shows
   up. If you don't see anything except latin characters, please
   install the TTF version of unifont.

2) M-x ps-print-buffer-faces; the buffer is printed, but every
   non-latin character is replaced with '?'.

However, if the 'Hello' buffer contents is printed via as simple
editor as GEdit, *all* the characters are printed, and appear smooth
and nice!

Having analyzed mine and other users' experience, and having examined
how the printing works in modern applications, I propose the following
requirements for the Emacs printing mechanism:

1) Simple printing configuration should require no or almost no
   knowledge and effort. The only user input that might be required is
   the printer name.

2) It should not be necessary to install additional packages/files
   solely for the Emacs printing.

3) Printing functionality should work equally good on PostScript and
   non-PostScript printers.

I can think of the following ways of how these requirements may be
achieved:

a) Try to improve current functionality, making no or almost no
   modifications to the current printing engine. This includes
   simplifying the configuration interface. Not sure points 2) and 3)
   can be fixed this way though.

b) Use standard GTK+ printing facilities as GEdit and many other
   applications do. Emacs is built with GTK+ interface for quite some
   time now, so I suppose there should be no architectural problem in
   using GTK+ for printing as well. Please correct me if I'm wrong.

c) Utilize superior rendering capabilities of some other application,
   like it is done by package hfyview.el:
   http://www.emacswiki.org/emacs/PrintWithWebBrowser . This
   approach doesn't conform to 2) though.

From the user perspective, I like b) because I think it would solve 3)
and would present a nice user interface. I call you to discuss the
pros and contras of the proposed approaches from the programmer
perspective and/or propose other solutions.

Thanks for your effort,
Andrey Paramonov




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

* Re: Printing
  2009-03-28 10:31 Printing Андрей Парамонов
@ 2009-03-28 14:56 ` Jan Djärv
  2009-03-31  2:13   ` Printing YAMAMOTO Mitsuharu
  2009-03-28 15:46 ` Printing Michael Ekstrand
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 147+ messages in thread
From: Jan Djärv @ 2009-03-28 14:56 UTC (permalink / raw)
  To: Андрей Парамонов
  Cc: emacs-devel

Андрей Парамонов skrev:

> b) Use standard GTK+ printing facilities as GEdit and many other
>    applications do. Emacs is built with GTK+ interface for quite some
>    time now, so I suppose there should be no architectural problem in
>    using GTK+ for printing as well. Please correct me if I'm wrong.
> 

The problem is that Gtk+ printing assumes you are rendering with cairo.  Emacs
 does not do that.  Changing that would be a major undertaking.  Something
like porting Emacs to a totally new toolkit.

	Jan D.




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

* Re: Printing
  2009-03-28 10:31 Printing Андрей Парамонов
  2009-03-28 14:56 ` Printing Jan Djärv
@ 2009-03-28 15:46 ` Michael Ekstrand
  2009-03-28 18:37 ` Printing Stefan Monnier
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 147+ messages in thread
From: Michael Ekstrand @ 2009-03-28 15:46 UTC (permalink / raw)
  To: emacs-devel

Андрей Парамонов <cmr.pent@gmail.com> writes:
> Having analysed mine and other users' experience, and having examined
> how the printing works in modern applications, I propose the following
> requirements for the Emacs printing mechanism:
>
> 1) Simple printing configuration should require no or almost no
>    knowledge and effort. The only user input that might be required is
>    the printer name.

If you have your printer set up correctly on your system, this should be
easy to do.  Setting it up correctly can be a challenge, but A., that
isn't an Emacs problem, and B., CUPS seems to do a good job of
auto-detecting USB and network printers these days.

> 2) It should not be necessary to install additional packages/files
>    solely for the Emacs printing.

I hope you mean packages beyond the core things needed to get printing
working on GNU/Linux systems in general (CUPS, GhostScript, hpijs for HP
printers, etc.).

> 3) Printing functionality should work equally good on PostScript and
>    non-PostScript printers.

Already covered in a properly configured environment (provided your
printer is supported by GhostScript/gimpprint/foomatic).

> I can think of the following ways of how these requirements may be
> achieved:
>
> a) Try to improve current functionality, making no or almost no
>    modifications to the current printing engine. This includes
>    simplifying the configuration interface. Not sure points 2) and 3)
>    can be fixed this way though.

2 and 3 are covered by this one as pretty much any Linux printing is
going through Postscript, even for non-Postscript printers; the printing
engine (e.g. CUPS) uses Ghostscript to render the PostScript to the
appropriate printer language.  The GTK+ printing systems are just
creating PostScript with Cairo, so far as I know.  If you can print on
your GNU/Linux system, you either have the appropriate conversion tools
or are talking to a PostScript printer (or print server doing the
conversion for you).

This solution also has the benefit of working in a TTY :).

I wouldn't mind, however, seeing the GTK+ UI able to use the GTK print
dialogs to select what printer to run the PostScript it generates
through.

- Michael

-- 
mouse, n: A device for pointing at the xterm in which you want to type.
Confused by the strange files?  I cryptographically sign my messages.
For more information see <http://www.elehack.net/resources/gpg>.





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

* Re: Printing
  2009-03-28 10:31 Printing Андрей Парамонов
  2009-03-28 14:56 ` Printing Jan Djärv
  2009-03-28 15:46 ` Printing Michael Ekstrand
@ 2009-03-28 18:37 ` Stefan Monnier
  2009-03-28 20:52   ` Printing Андрей Парамонов
  2009-03-28 20:30 ` Printing James Cloos
  2009-03-29  2:15 ` Printing Richard M Stallman
  4 siblings, 1 reply; 147+ messages in thread
From: Stefan Monnier @ 2009-03-28 18:37 UTC (permalink / raw)
  To: Андрей Парамонов
  Cc: emacs-devel

> 2) M-x ps-print-buffer-faces; the buffer is printed, but every
>    non-Latin character is replaced with '?'.

Yes, this is a serious problem that needs to be addressed.

> b) Use standard GTK+ printing facilities as GEdit and many other
>    applications do. Emacs is built with GTK+ interface for quite some
>    time now, so I suppose there should be no architectural problem in
>    using GTK+ for printing as well. Please correct me if I'm wrong.

This is a lot more difficult than it sounds: Emacs uses Gtk is very
non-essential ways (i.e. only for the scrollbars, toolbars, and
menubars, but not for the actual text).
It might be a good idea to try and do a real Gtk port of Emacs, tho.


        Stefan




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

* Re: Printing
  2009-03-28 10:31 Printing Андрей Парамонов
                   ` (2 preceding siblings ...)
  2009-03-28 18:37 ` Printing Stefan Monnier
@ 2009-03-28 20:30 ` James Cloos
  2009-03-29  2:15 ` Printing Richard M Stallman
  4 siblings, 0 replies; 147+ messages in thread
From: James Cloos @ 2009-03-28 20:30 UTC (permalink / raw)
  To: emacs-devel
  Cc: Андрей Парамонов

This is indeed a real issue.  Some slightly random thoughts:

Using the gtk print dialog when emacs is compiled --with-x-toolkit-gtk
and is in GUI mode would be a useful improvement.  (Using the toolkit's
print dialog is generally the way to go, but of the x-toolkits emacs
currently supports only gtk has a useful print dialog.)

The cups-based workflow is changing from postscript to pdf.  It would be
useful for emacs to have pdf-(print|spool)-(buffer|region)(-with-faces)?
commands.  A pdf-print.el similar to ps-print.el is therefore desired.

Work is underway on a pan-toolkit print dialog.  One of the deliverables
is an application which can be used in place of lp(1) or lpr(1).  This
will be similar to xpp(1) or gtklp(1), but using the new dialog.  I
expect there will be separate apps for each toolkit linked against the
pan-toolkit lib.  It would be useful for ps-lpr-command to default to
such an app when using gtk and in GUI mode.  Until that app is available
gtklp might be a useful option.

Anything which outputs pdf can be trivially expanded to support ps
output as well; it requires only a simple ps procset and a few small
conditionals in the code.  Most of the ps output looks identical to
the pdf output.

Improving ps-print.el to support all of the UCS is not outrageously
difficult.  I'm confident patches would be welcomed.  There are a large
number of acceptably-licensed apps and libs in the wild which one could
use as inspiration.  Cairo's pdf backend is a good example.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6




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

* Re: Printing
  2009-03-28 18:37 ` Printing Stefan Monnier
@ 2009-03-28 20:52   ` Андрей Парамонов
  2009-03-30 13:06     ` Printing Michael Ekstrand
  0 siblings, 1 reply; 147+ messages in thread
From: Андрей Парамонов @ 2009-03-28 20:52 UTC (permalink / raw)
  To: michael; +Cc: emacs-devel

2009/3/28 Michael Ekstrand <michael@elehack.net>:
>> Having analysed mine and other users' experience, and having
>> examined how the printing works in modern applications, I propose
>> the following requirements for the Emacs printing mechanism:
>>
>> 1) Simple printing configuration should require no or almost no
>>    knowledge and effort. The only user input that might be required
>>    is the printer name.
>
> If you have your printer set up correctly on your system, this
> should be easy to do.

Yes, exactly, this should be easy. And it *is* easy in other
applications, namely GEdit, Firefox, etc. But unfortunately, it is not
easy in Emacs. That's why I've started the discussion.

Do you have a printer? If so, could you please print the contents of
Emacs 'Hello' buffer and tell us if all the characters you see on the
screen appear on the printed page as well?

>> 2) It should not be necessary to install additional packages/files
>>    solely for the Emacs printing.
>
> I hope you mean packages beyond the core things needed to get
> printing working on GNU/Linux systems in general (CUPS, GhostScript,
> hpijs for HP printers, etc.).

I mean that if you have all the fonts needed to render your text in
Emacs frame, and you can print that text using GEdit, you must not be
required to install anything else to be able to print from
Emacs. Currently, you must install so-called BDF fonts (in this case,
the quality would be inacceptably bad, but at least some non-Latin
characters would be printed), or you must install a web browser to be
able to use hfyview.el.

>> 3) Printing functionality should work equally good on PostScript
>>    and non-PostScript printers.
>
> Already covered in a properly configured environment (provided your
> printer is supported by GhostScript/gimpprint/foomatic).

I own a HP LaserJet 1018 which doesn't support PostScript directly, as
don't most of the consumer printers sold today. I'm not a PostScript
guru, but I'm pretty sure that my system indeed does some kind of
PostScript emulation, translating PostScript commands via GhostScript
and then telling the printer what to do in the language the latter
understands.

Maybe -- just maybe -- the Emacs printing works nicely on more
expensive printers which support PostScript directly. I can't tell for
sure because I don't have access to such a printer. As for my setup,
the printing functionality provided by Emacs works bad.

To clear things up: the problem is *not* in the printer, and *not* in
the drivers. Installing the printer on my system was a breeze. I've
encountered the only problematic application so far, and the
disappointing part is that it's Emacs.

Andrey Paramonov




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

* Re: Printing
  2009-03-28 10:31 Printing Андрей Парамонов
                   ` (3 preceding siblings ...)
  2009-03-28 20:30 ` Printing James Cloos
@ 2009-03-29  2:15 ` Richard M Stallman
  2009-03-29  3:20   ` Printing Eli Zaretskii
  2009-03-30 18:03   ` Printing Андрей Парамонов
  4 siblings, 2 replies; 147+ messages in thread
From: Richard M Stallman @ 2009-03-29  2:15 UTC (permalink / raw)
  To: Андрей Парамонов
  Cc: emacs-devel

    Emacs printing is broken -- and I mean it -- is *fundamentally*,
    totally broken. You have either to be a PostScript guru, restrict
    yourself to ASCII characters, or cheat/hack to be able to use Emacs
    printing.

I am sure that is not true.  I am not a PostScript guru, but when I
use ps-print-buffer, it works fine.

This is not to say that there can't be bugs.  I see you included
some test cases -- thank you for them.  I hope people will fix them.

    b) Use standard GTK+ printing facilities as GEdit and many other
       applications do. Emacs is built with GTK+ interface for quite some
       time now, so I suppose there should be no architectural problem in
       using GTK+ for printing as well. Please correct me if I'm wrong.

Sorry, that won't work.  Emacs can be built with several display
platforms, GTK being just one.  Sometimes none is used.  I normally
use Emacs on a tty and I want printing to work there too.





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

* Re: Printing
  2009-03-29  2:15 ` Printing Richard M Stallman
@ 2009-03-29  3:20   ` Eli Zaretskii
  2009-03-30  1:17     ` Printing Richard M Stallman
  2009-03-30 18:03   ` Printing Андрей Парамонов
  1 sibling, 1 reply; 147+ messages in thread
From: Eli Zaretskii @ 2009-03-29  3:20 UTC (permalink / raw)
  To: rms; +Cc: cmr.pent, emacs-devel

> From: Richard M Stallman <rms@gnu.org>
> Date: Sat, 28 Mar 2009 22:15:42 -0400
> Cc: emacs-devel@gnu.org
> 
>     Emacs printing is broken -- and I mean it -- is *fundamentally*,
>     totally broken. You have either to be a PostScript guru, restrict
>     yourself to ASCII characters, or cheat/hack to be able to use Emacs
>     printing.
> 
> I am sure that is not true.  I am not a PostScript guru, but when I
> use ps-print-buffer, it works fine.

It works fine out of the box for ASCII and Latin-1 characters.
Outside that area, ps-print needs non-trivial setup.  Note that the OP
said "restrict yourself to ASCII characters".




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

* Re: Printing
  2009-03-29  3:20   ` Printing Eli Zaretskii
@ 2009-03-30  1:17     ` Richard M Stallman
  2009-03-30  3:10       ` Printing Eli Zaretskii
  0 siblings, 1 reply; 147+ messages in thread
From: Richard M Stallman @ 2009-03-30  1:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: cmr.pent, emacs-devel

    It works fine out of the box for ASCII and Latin-1 characters.
    Outside that area, ps-print needs non-trivial setup.

What setup does it need?  Why is it needed?

If the user invokes it without doing this setup,
does it warn the user it won't work?




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

* Re: Printing
  2009-03-30  1:17     ` Printing Richard M Stallman
@ 2009-03-30  3:10       ` Eli Zaretskii
  2009-03-30  6:36         ` Printing Lennart Borgman
  2009-03-30 21:50         ` Printing Richard M Stallman
  0 siblings, 2 replies; 147+ messages in thread
From: Eli Zaretskii @ 2009-03-30  3:10 UTC (permalink / raw)
  To: rms; +Cc: cmr.pent, emacs-devel

> From: Richard M Stallman <rms@gnu.org>
> CC: cmr.pent@gmail.com, emacs-devel@gnu.org
> Date: Sun, 29 Mar 2009 21:17:07 -0400
> 
>     It works fine out of the box for ASCII and Latin-1 characters.
>     Outside that area, ps-print needs non-trivial setup.
> 
> What setup does it need?

See the commentary at the beginning of ps-mule.el.

> Why is it needed?

Because ps-print needs to know how to send non-ASCII characters to the
printer.  Characters from scripts that the printer supports directly
can be sent verbatim (encoded by a suitable coding-system).  Other
characters need to be downloaded into the printer before we can use
them.

> If the user invokes it without doing this setup,
> does it warn the user it won't work?

If some of the characters in the region you print don't have a
corresponding entry in ps-mule-font-info-database, it says something
vague about "some characters will not be printed".  If all of them
have entries, but the entries do not correctly reflect what the
printer can or cannot do, you get bad printout with no warning at all.

One way to fix this would be to update our default for
ps-mule-font-info-database so that it handles Unicode -- assuming that
modern PostScript printers indeed support large subranges of the
Unicode codespace.  I'm not an expert on printing, so I wouldn't know
if this is possible.




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

* Re: Printing
  2009-03-30  3:10       ` Printing Eli Zaretskii
@ 2009-03-30  6:36         ` Lennart Borgman
  2009-03-30 18:41           ` Printing Eli Zaretskii
  2009-03-30 21:50         ` Printing Richard M Stallman
  1 sibling, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2009-03-30  6:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rms, cmr.pent, emacs-devel

On Mon, Mar 30, 2009 at 5:10 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> One way to fix this would be to update our default for
> ps-mule-font-info-database so that it handles Unicode -- assuming that
> modern PostScript printers indeed support large subranges of the
> Unicode codespace.  I'm not an expert on printing, so I wouldn't know
> if this is possible.

Since printing with Emacs through the web browser (using
htmlfontify.el) does work it seems like modern printers do support
this. Or am I missing something?




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

* Re: Printing
  2009-03-28 20:52   ` Printing Андрей Парамонов
@ 2009-03-30 13:06     ` Michael Ekstrand
  2009-03-30 15:24       ` Printing Stefan Monnier
  0 siblings, 1 reply; 147+ messages in thread
From: Michael Ekstrand @ 2009-03-30 13:06 UTC (permalink / raw)
  To: emacs-devel

Андрей Парамонов <cmr.pent@gmail.com> writes:
> 2009/3/28 Michael Ekstrand <michael@elehack.net>:
>>> Having analysed mine and other users' experience, and having
>>> examined how the printing works in modern applications, I propose
>>> the following requirements for the Emacs printing mechanism:
>>>
>>> 1) Simple printing configuration should require no or almost no
>>>    knowledge and effort. The only user input that might be required
>>>    is the printer name.
>>
>> If you have your printer set up correctly on your system, this
>> should be easy to do.
>
> Yes, exactly, this should be easy. And it *is* easy in other
> applications, namely GEdit, Firefox, etc. But unfortunately, it is not
> easy in Emacs. That's why I've started the discussion.
>
> Do you have a printer? If so, could you please print the contents of
> Emacs 'Hello' buffer and tell us if all the characters you see on the
> screen appear on the printed page as well?

I tried it, using my HP PSC 2175 (so GhostScript/hpijs is doing the PS
to HP language conversion), and yes, it failed miserably on the vast
majority of the characters.

>>> 2) It should not be necessary to install additional packages/files
>>>    solely for the Emacs printing.
>>
>> I hope you mean packages beyond the core things needed to get
>> printing working on GNU/Linux systems in general (CUPS, GhostScript,
>> hpijs for HP printers, etc.).
>
> I mean that if you have all the fonts needed to render your text in
> Emacs frame, and you can print that text using GEdit, you must not be
> required to install anything else to be able to print from
> Emacs. Currently, you must install so-called BDF fonts (in this case,
> the quality would be inacceptably bad, but at least some non-Latin
> characters would be printed), or you must install a web browser to be
> able to use hfyview.el.

That is a reasonable expectation IMO.

>>> 3) Printing functionality should work equally good on PostScript
>>>    and non-PostScript printers.
>>
>> Already covered in a properly configured environment (provided your
>> printer is supported by GhostScript/gimpprint/foomatic).
>
> I own a HP LaserJet 1018 which doesn't support PostScript directly, as
> don't most of the consumer printers sold today. I'm not a PostScript
> guru, but I'm pretty sure that my system indeed does some kind of
> PostScript emulation, translating PostScript commands via GhostScript
> and then telling the printer what to do in the language the latter
> understands.
>
> Maybe -- just maybe -- the Emacs printing works nicely on more
> expensive printers which support PostScript directly. I can't tell for
> sure because I don't have access to such a printer. As for my setup,
> the printing functionality provided by Emacs works bad.
>
> To clear things up: the problem is *not* in the printer, and *not* in
> the drivers. Installing the printer on my system was a breeze. I've
> encountered the only problematic application so far, and the
> disappointing part is that it's Emacs.

OK.  I misunderstood the framing of the problem.  With this
clarification, I agree, the problem is a valid one and a solution should
be found somehow.  I do believe that the solution with the best results
will be to enhance the PostScript generation to properly handle the
non-latin characters, although this does not seem to be an easy task.

- Michael

-- 
mouse, n: A device for pointing at the xterm in which you want to type.
Confused by the strange files?  I cryptographically sign my messages.
For more information see <http://www.elehack.net/resources/gpg>.





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

* Re: Printing
  2009-03-30 13:06     ` Printing Michael Ekstrand
@ 2009-03-30 15:24       ` Stefan Monnier
  2009-03-30 18:38         ` Printing Eli Zaretskii
  0 siblings, 1 reply; 147+ messages in thread
From: Stefan Monnier @ 2009-03-30 15:24 UTC (permalink / raw)
  To: Michael Ekstrand; +Cc: emacs-devel

>> I own a HP LaserJet 1018 which doesn't support PostScript directly, as
>> don't most of the consumer printers sold today. I'm not a PostScript
>> guru, but I'm pretty sure that my system indeed does some kind of
>> PostScript emulation, translating PostScript commands via GhostScript
>> and then telling the printer what to do in the language the latter
>> understands.

AFAIK, there are mainly 2 problems:
1 - Printing non-ascii chars is poorly supported.
2 - Printing on systems that do not support Postscript.

The second problem is less important to the extent that it only affects
proprietary operating systems, AFAIK, and it can be solved by installing
additional Free Software (mostly Ghostscript).

A further problem is the lack of "printing dialog" to choose the printer
and the printing style.


        Stefan




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

* Re: Printing
  2009-03-29  2:15 ` Printing Richard M Stallman
  2009-03-29  3:20   ` Printing Eli Zaretskii
@ 2009-03-30 18:03   ` Андрей Парамонов
  1 sibling, 0 replies; 147+ messages in thread
From: Андрей Парамонов @ 2009-03-30 18:03 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

2009/3/29 Richard M Stallman <rms@gnu.org>:
>    b) Use standard GTK+ printing facilities as GEdit and many other
>       applications do. Emacs is built with GTK+ interface for quite some
>       time now, so I suppose there should be no architectural problem in
>       using GTK+ for printing as well. Please correct me if I'm wrong.
>
> Sorry, that won't work.  Emacs can be built with several display
> platforms, GTK being just one.  Sometimes none is used.  I normally
> use Emacs on a tty and I want printing to work there too.
>

Yes, this is indeed an important requirement.

I think that neither GTK nor GhostScript depend on X per se. For
example, Debian installer uses GTK to provide multilingual user
interface from the very early stages of installation. I don't know if
the printing functionality of GTK actually requires X.

Thanks for your effort,
Andrey Paramonov




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

* Re: Printing
  2009-03-30 15:24       ` Printing Stefan Monnier
@ 2009-03-30 18:38         ` Eli Zaretskii
  2009-03-31  1:56           ` Printing Stefan Monnier
  0 siblings, 1 reply; 147+ messages in thread
From: Eli Zaretskii @ 2009-03-30 18:38 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: michael, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Mon, 30 Mar 2009 11:24:35 -0400
> Cc: emacs-devel@gnu.org
> 
> 1 - Printing non-ascii chars is poorly supported.
> 2 - Printing on systems that do not support Postscript.
> 
> The second problem is less important to the extent that it only affects
> proprietary operating systems, AFAIK, and it can be solved by installing
> additional Free Software (mostly Ghostscript).

The second problem is simply irrelevant: if the printer supports
PostScript, the OS is not important, because all modern OSs support
PostScript printers.

IOW, there's no such thing as a ``system that doesn't support
PostScript''.




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

* Re: Printing
  2009-03-30  6:36         ` Printing Lennart Borgman
@ 2009-03-30 18:41           ` Eli Zaretskii
  2009-03-30 19:04             ` Printing Lennart Borgman
  0 siblings, 1 reply; 147+ messages in thread
From: Eli Zaretskii @ 2009-03-30 18:41 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: rms, cmr.pent, emacs-devel

> Date: Mon, 30 Mar 2009 08:36:01 +0200
> From: Lennart Borgman <lennart.borgman@gmail.com>
> Cc: rms@gnu.org, cmr.pent@gmail.com, emacs-devel@gnu.org
> 
> On Mon, Mar 30, 2009 at 5:10 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > One way to fix this would be to update our default for
> > ps-mule-font-info-database so that it handles Unicode -- assuming that
> > modern PostScript printers indeed support large subranges of the
> > Unicode codespace.  I'm not an expert on printing, so I wouldn't know
> > if this is possible.
> 
> Since printing with Emacs through the web browser (using
> htmlfontify.el) does work it seems like modern printers do support
> this. Or am I missing something?

You are missing the fact that I was talking about PostScript printing,
not printing via the Windows printer API.





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

* Re: Printing
  2009-03-30 18:41           ` Printing Eli Zaretskii
@ 2009-03-30 19:04             ` Lennart Borgman
  2009-03-30 20:48               ` Printing Eli Zaretskii
  0 siblings, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2009-03-30 19:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rms, cmr.pent, emacs-devel

On Mon, Mar 30, 2009 at 8:41 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Mon, 30 Mar 2009 08:36:01 +0200
>> From: Lennart Borgman <lennart.borgman@gmail.com>
>> Cc: rms@gnu.org, cmr.pent@gmail.com, emacs-devel@gnu.org
>>
>> On Mon, Mar 30, 2009 at 5:10 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> > One way to fix this would be to update our default for
>> > ps-mule-font-info-database so that it handles Unicode -- assuming that
>> > modern PostScript printers indeed support large subranges of the
>> > Unicode codespace.  I'm not an expert on printing, so I wouldn't know
>> > if this is possible.
>>
>> Since printing with Emacs through the web browser (using
>> htmlfontify.el) does work it seems like modern printers do support
>> this. Or am I missing something?
>
> You are missing the fact that I was talking about PostScript printing,
> not printing via the Windows printer API.

I am not sure about that. Could someone who have this problem and have
a PostScript printer try printing through the web browser, please?




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

* Re: Printing
  2009-03-30 19:04             ` Printing Lennart Borgman
@ 2009-03-30 20:48               ` Eli Zaretskii
  2009-03-30 20:53                 ` Printing Lennart Borgman
  0 siblings, 1 reply; 147+ messages in thread
From: Eli Zaretskii @ 2009-03-30 20:48 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: rms, cmr.pent, emacs-devel

> Date: Mon, 30 Mar 2009 21:04:37 +0200
> From: Lennart Borgman <lennart.borgman@gmail.com>
> Cc: rms@gnu.org, cmr.pent@gmail.com, emacs-devel@gnu.org
> 
> On Mon, Mar 30, 2009 at 8:41 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> >> Date: Mon, 30 Mar 2009 08:36:01 +0200
> >> From: Lennart Borgman <lennart.borgman@gmail.com>
> >> Cc: rms@gnu.org, cmr.pent@gmail.com, emacs-devel@gnu.org
> >>
> >> On Mon, Mar 30, 2009 at 5:10 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> >> > One way to fix this would be to update our default for
> >> > ps-mule-font-info-database so that it handles Unicode -- assuming that
> >> > modern PostScript printers indeed support large subranges of the
> >> > Unicode codespace.  I'm not an expert on printing, so I wouldn't know
> >> > if this is possible.
> >>
> >> Since printing with Emacs through the web browser (using
> >> htmlfontify.el) does work it seems like modern printers do support
> >> this. Or am I missing something?
> >
> > You are missing the fact that I was talking about PostScript printing,
> > not printing via the Windows printer API.
> 
> I am not sure about that. Could someone who have this problem and have
> a PostScript printer try printing through the web browser, please?

And that will prove what, exactly? that Windows knows how to use a PS
driver for a printer?





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

* Re: Printing
  2009-03-30 20:48               ` Printing Eli Zaretskii
@ 2009-03-30 20:53                 ` Lennart Borgman
  2009-03-30 20:59                   ` Printing Eli Zaretskii
  2009-03-30 21:46                   ` Printing Óscar Fuentes
  0 siblings, 2 replies; 147+ messages in thread
From: Lennart Borgman @ 2009-03-30 20:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rms, cmr.pent, emacs-devel

On Mon, Mar 30, 2009 at 10:48 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Mon, 30 Mar 2009 21:04:37 +0200
>> From: Lennart Borgman <lennart.borgman@gmail.com>
>> Cc: rms@gnu.org, cmr.pent@gmail.com, emacs-devel@gnu.org
>>
>> On Mon, Mar 30, 2009 at 8:41 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> >> Date: Mon, 30 Mar 2009 08:36:01 +0200
>> >> From: Lennart Borgman <lennart.borgman@gmail.com>
>> >> Cc: rms@gnu.org, cmr.pent@gmail.com, emacs-devel@gnu.org
>> >>
>> >> On Mon, Mar 30, 2009 at 5:10 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> >> > One way to fix this would be to update our default for
>> >> > ps-mule-font-info-database so that it handles Unicode -- assuming that
>> >> > modern PostScript printers indeed support large subranges of the
>> >> > Unicode codespace.  I'm not an expert on printing, so I wouldn't know
>> >> > if this is possible.
>> >>
>> >> Since printing with Emacs through the web browser (using
>> >> htmlfontify.el) does work it seems like modern printers do support
>> >> this. Or am I missing something?
>> >
>> > You are missing the fact that I was talking about PostScript printing,
>> > not printing via the Windows printer API.
>>
>> I am not sure about that. Could someone who have this problem and have
>> a PostScript printer try printing through the web browser, please?
>
> And that will prove what, exactly? that Windows knows how to use a PS
> driver for a printer?

I think that the browser will send PostScript to the printer. So I
believe it will show that the printer actually can print all the text
- but I am sure I might be missing something here.




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

* Re: Printing
  2009-03-30 20:53                 ` Printing Lennart Borgman
@ 2009-03-30 20:59                   ` Eli Zaretskii
  2009-03-30 21:27                     ` Printing Lennart Borgman
  2009-03-30 21:46                   ` Printing Óscar Fuentes
  1 sibling, 1 reply; 147+ messages in thread
From: Eli Zaretskii @ 2009-03-30 20:59 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: rms, cmr.pent, emacs-devel

> Date: Mon, 30 Mar 2009 22:53:04 +0200
> From: Lennart Borgman <lennart.borgman@gmail.com>
> Cc: rms@gnu.org, cmr.pent@gmail.com, emacs-devel@gnu.org
> 
> On Mon, Mar 30, 2009 at 10:48 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> >> Date: Mon, 30 Mar 2009 21:04:37 +0200
> >> From: Lennart Borgman <lennart.borgman@gmail.com>
> >> Cc: rms@gnu.org, cmr.pent@gmail.com, emacs-devel@gnu.org
> >>
> >> On Mon, Mar 30, 2009 at 8:41 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> >> >> Date: Mon, 30 Mar 2009 08:36:01 +0200
> >> >> From: Lennart Borgman <lennart.borgman@gmail.com>
> >> >> Cc: rms@gnu.org, cmr.pent@gmail.com, emacs-devel@gnu.org
> >> >>
> >> >> On Mon, Mar 30, 2009 at 5:10 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> >> >> > One way to fix this would be to update our default for
> >> >> > ps-mule-font-info-database so that it handles Unicode -- assuming that
> >> >> > modern PostScript printers indeed support large subranges of the
> >> >> > Unicode codespace.  I'm not an expert on printing, so I wouldn't know
> >> >> > if this is possible.
> >> >>
> >> >> Since printing with Emacs through the web browser (using
> >> >> htmlfontify.el) does work it seems like modern printers do support
> >> >> this. Or am I missing something?
> >> >
> >> > You are missing the fact that I was talking about PostScript printing,
> >> > not printing via the Windows printer API.
> >>
> >> I am not sure about that. Could someone who have this problem and have
> >> a PostScript printer try printing through the web browser, please?
> >
> > And that will prove what, exactly? that Windows knows how to use a PS
> > driver for a printer?
> 
> I think that the browser will send PostScript to the printer.

Yes, it will.

> So I believe it will show that the printer actually can print all
> the text

Not necessarily: PostScript language includes a capability to download
characters and images to the printer.  So the fact that something is
on paper does not yet mean it was printed using fonts that are built
into the printer.  (See ps-bdf.el for an example of how Emacs does
that; however, the results are not very nice, perhaps because the BDF
fonts are not suited well to printer resolution, only to that of
terminals.)





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

* Re: Printing
  2009-03-30 20:59                   ` Printing Eli Zaretskii
@ 2009-03-30 21:27                     ` Lennart Borgman
  2009-03-31  3:19                       ` Printing Eli Zaretskii
  0 siblings, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2009-03-30 21:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rms, cmr.pent, emacs-devel

On Mon, Mar 30, 2009 at 10:59 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> I think that the browser will send PostScript to the printer.
>
> Yes, it will.
>
>> So I believe it will show that the printer actually can print all
>> the text
>
> Not necessarily: PostScript language includes a capability to download
> characters and images to the printer.  So the fact that something is
> on paper does not yet mean it was printed using fonts that are built
> into the printer.  (See ps-bdf.el for an example of how Emacs does
> that; however, the results are not very nice, perhaps because the BDF
> fonts are not suited well to printer resolution, only to that of
> terminals.)

Do you mean that the web browser might have the needed font and can
sent it to the printer?




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

* Re: Printing
  2009-03-30 20:53                 ` Printing Lennart Borgman
  2009-03-30 20:59                   ` Printing Eli Zaretskii
@ 2009-03-30 21:46                   ` Óscar Fuentes
  1 sibling, 0 replies; 147+ messages in thread
From: Óscar Fuentes @ 2009-03-30 21:46 UTC (permalink / raw)
  To: emacs-devel

Lennart Borgman <lennart.borgman@gmail.com> writes:

>>> > You are missing the fact that I was talking about PostScript printing,
>>> > not printing via the Windows printer API.
>>>
>>> I am not sure about that. Could someone who have this problem and have
>>> a PostScript printer try printing through the web browser, please?
>>
>> And that will prove what, exactly? that Windows knows how to use a PS
>> driver for a printer?
>
> I think that the browser will send PostScript to the printer.

The browser will render the page using the GDI Windows API. Then,
the printer driver will translate this to wathever the printer requires
(PostScript, in this case).

[snip]

-- 
Oscar





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

* Re: Printing
  2009-03-30  3:10       ` Printing Eli Zaretskii
  2009-03-30  6:36         ` Printing Lennart Borgman
@ 2009-03-30 21:50         ` Richard M Stallman
  2009-03-31  3:18           ` Printing Eli Zaretskii
  1 sibling, 1 reply; 147+ messages in thread
From: Richard M Stallman @ 2009-03-30 21:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: cmr.pent, emacs-devel

    Because ps-print needs to know how to send non-ASCII characters to the
    printer.  Characters from scripts that the printer supports directly
    can be sent verbatim (encoded by a suitable coding-system).  Other
    characters need to be downloaded into the printer before we can use
    them.

Does GTK printing need similar setup?  If not, can we use whatever
mechanism it uses?

    If some of the characters in the region you print don't have a
    corresponding entry in ps-mule-font-info-database, it says something
    vague about "some characters will not be printed".

We could turn that into a query or an error.




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

* Re: Printing
  2009-03-30 18:38         ` Printing Eli Zaretskii
@ 2009-03-31  1:56           ` Stefan Monnier
  2009-03-31  3:15             ` Printing Eli Zaretskii
  0 siblings, 1 reply; 147+ messages in thread
From: Stefan Monnier @ 2009-03-31  1:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael, emacs-devel

>> The second problem is less important to the extent that it only affects
>> proprietary operating systems, AFAIK, and it can be solved by installing
>> additional Free Software (mostly Ghostscript).

> The second problem is simply irrelevant: if the printer supports
> PostScript, the OS is not important, because all modern OSs support
> PostScript printers.

By "the system" I mean "the hardware & OS on which Emacs runs".
For Emacs to be able to print, the system (either the printer or some
part of the software) needs to support Postscript.

Printers that don't understand Postscript are still pretty common,
AFAIK.  And Windows doesn't provide Postscript support for
non-Postscript printers unless you install ghostscript.  So it's
not irrelevant.


        Stefan




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

* Re: Printing
  2009-03-28 14:56 ` Printing Jan Djärv
@ 2009-03-31  2:13   ` YAMAMOTO Mitsuharu
  2009-04-02  9:39     ` Printing YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-03-31  2:13 UTC (permalink / raw)
  To: emacs-devel

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

>>>>> On Sat, 28 Mar 2009 15:56:04 +0100, Jan Djärv <jan.h.d@swipnet.se> said:

> Андрей Парамонов skrev:
>> b) Use standard GTK+ printing facilities as GEdit and many other
>> applications do. Emacs is built with GTK+ interface for quite some
>> time now, so I suppose there should be no architectural problem in
>> using GTK+ for printing as well. Please correct me if I'm wrong.
>> 

> The problem is that Gtk+ printing assumes you are rendering with
> cairo.  Emacs does not do that.  Changing that would be a major
> undertaking.  Something like porting Emacs to a totally new toolkit.

FWIW, several ports for Mac OS X are using Quartz 2D that can generate
PDF as in Cairo.  So creating a "resolution-independent screenshot" is
immediate especially with Cocoa.  Of course, it is still not
sufficient for general printing.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

[-- Attachment #2: ctfont.pdf --]
[-- Type: application/pdf, Size: 52506 bytes --]

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

* Re: Printing
  2009-03-31  1:56           ` Printing Stefan Monnier
@ 2009-03-31  3:15             ` Eli Zaretskii
  2009-04-01  0:52               ` Printing Stefan Monnier
  0 siblings, 1 reply; 147+ messages in thread
From: Eli Zaretskii @ 2009-03-31  3:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: michael, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: michael@elehack.net,  emacs-devel@gnu.org
> Date: Mon, 30 Mar 2009 21:56:51 -0400
> 
> >> The second problem is less important to the extent that it only affects
> >> proprietary operating systems, AFAIK, and it can be solved by installing
> >> additional Free Software (mostly Ghostscript).
> 
> > The second problem is simply irrelevant: if the printer supports
> > PostScript, the OS is not important, because all modern OSs support
> > PostScript printers.
> 
> By "the system" I mean "the hardware & OS on which Emacs runs".
> For Emacs to be able to print, the system (either the printer or some
> part of the software) needs to support Postscript.
> 
> Printers that don't understand Postscript are still pretty common,
> AFAIK.  And Windows doesn't provide Postscript support for
> non-Postscript printers unless you install ghostscript.  So it's
> not irrelevant.

I hope you are not saying that ps-print machinery is the only way
Emacs will be able to print in the future, i.e. rely on PostScript
support of the OS infrastructure.  Because if you do, the history of
that until today should tell us this is not necessarily a good idea.




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

* Re: Printing
  2009-03-30 21:50         ` Printing Richard M Stallman
@ 2009-03-31  3:18           ` Eli Zaretskii
  2009-03-31 19:14             ` Printing Richard M Stallman
  0 siblings, 1 reply; 147+ messages in thread
From: Eli Zaretskii @ 2009-03-31  3:18 UTC (permalink / raw)
  To: rms; +Cc: cmr.pent, emacs-devel

> From: Richard M Stallman <rms@gnu.org>
> CC: cmr.pent@gmail.com, emacs-devel@gnu.org
> Date: Mon, 30 Mar 2009 17:50:30 -0400
> 
>     Because ps-print needs to know how to send non-ASCII characters to the
>     printer.  Characters from scripts that the printer supports directly
>     can be sent verbatim (encoded by a suitable coding-system).  Other
>     characters need to be downloaded into the printer before we can use
>     them.
> 
> Does GTK printing need similar setup?  If not, can we use whatever
> mechanism it uses?

No, we can't.  As Jan explained, GTK+ requires that applications use
cairo for rendering, which we probably will not able to do even in the
GTK build, at least not easily.

>     If some of the characters in the region you print don't have a
>     corresponding entry in ps-mule-font-info-database, it says something
>     vague about "some characters will not be printed".
> 
> We could turn that into a query or an error.

Yes, but that still leaves unresolved the issue of how to set it up
correctly _after_ you know you need some setup.  There's not enough
information in ps-mule.el (or elsewhere in Emacs docs) to know what to
do, unless you have intimate knowledge of what your printer supports
and the fonts that are available.




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

* Re: Printing
  2009-03-30 21:27                     ` Printing Lennart Borgman
@ 2009-03-31  3:19                       ` Eli Zaretskii
  0 siblings, 0 replies; 147+ messages in thread
From: Eli Zaretskii @ 2009-03-31  3:19 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: rms, cmr.pent, emacs-devel

> Date: Mon, 30 Mar 2009 23:27:19 +0200
> From: Lennart Borgman <lennart.borgman@gmail.com>
> Cc: rms@gnu.org, cmr.pent@gmail.com, emacs-devel@gnu.org
> 
> On Mon, Mar 30, 2009 at 10:59 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> >> I think that the browser will send PostScript to the printer.
> >
> > Yes, it will.
> >
> >> So I believe it will show that the printer actually can print all
> >> the text
> >
> > Not necessarily: PostScript language includes a capability to download
> > characters and images to the printer.  So the fact that something is
> > on paper does not yet mean it was printed using fonts that are built
> > into the printer.  (See ps-bdf.el for an example of how Emacs does
> > that; however, the results are not very nice, perhaps because the BDF
> > fonts are not suited well to printer resolution, only to that of
> > terminals.)
> 
> Do you mean that the web browser might have the needed font and can
> sent it to the printer?

Not the browser itself, but the Windows APIs and the printer driver
can do that.





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

* Re: Printing
  2009-03-31  3:18           ` Printing Eli Zaretskii
@ 2009-03-31 19:14             ` Richard M Stallman
  0 siblings, 0 replies; 147+ messages in thread
From: Richard M Stallman @ 2009-03-31 19:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: cmr.pent, emacs-devel

    > We could turn that into a query or an error.

    Yes, but that still leaves unresolved the issue of how to set it up
    correctly _after_ you know you need some setup.

I agree.  If we follow this route, we need to do both.
So we may as well do one of them as a first step.

The question is whether there is a better route.




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

* Re: Printing
  2009-03-31  3:15             ` Printing Eli Zaretskii
@ 2009-04-01  0:52               ` Stefan Monnier
  2009-04-01  3:14                 ` Printing Eli Zaretskii
  0 siblings, 1 reply; 147+ messages in thread
From: Stefan Monnier @ 2009-04-01  0:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael, emacs-devel

> I hope you are not saying that ps-print machinery is the only way
> Emacs will be able to print in the future, i.e. rely on PostScript
> support of the OS infrastructure.

Yes, that's what I'm saying.

> Because if you do, the history of that until today should tell us this
> is not necessarily a good idea.

What other way to print are you thinking of?


        Stefan




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

* Re: Printing
  2009-04-01  0:52               ` Printing Stefan Monnier
@ 2009-04-01  3:14                 ` Eli Zaretskii
  2009-04-01  4:17                   ` Printing Miles Bader
                                     ` (4 more replies)
  0 siblings, 5 replies; 147+ messages in thread
From: Eli Zaretskii @ 2009-04-01  3:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: michael, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: michael@elehack.net,  emacs-devel@gnu.org
> Date: Tue, 31 Mar 2009 20:52:33 -0400
> 
> > I hope you are not saying that ps-print machinery is the only way
> > Emacs will be able to print in the future, i.e. rely on PostScript
> > support of the OS infrastructure.
> 
> Yes, that's what I'm saying.

Then, if history teaches us anything, we will probably having this
discussion 10 years from now as well.

> > Because if you do, the history of that until today should tell us this
> > is not necessarily a good idea.
> 
> What other way to print are you thinking of?

The way every modern platform does that: through a printer API,
whereby you select fonts and layout, then render text to some device,
and the text gets printed to the printer you select.  Since Emacs
already knows how to render text, it shouldn't be too hard to teach it
do so to something other than a screen.




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

* Re: Printing
  2009-04-01  3:14                 ` Printing Eli Zaretskii
@ 2009-04-01  4:17                   ` Miles Bader
  2009-04-01 17:53                     ` Printing Eli Zaretskii
  2009-04-01  4:24                   ` Printing Jason Rumney
                                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 147+ messages in thread
From: Miles Bader @ 2009-04-01  4:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael, Stefan Monnier, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:
>> What other way to print are you thinking of?
>
> The way every modern platform does that: through a printer API,
> whereby you select fonts and layout, then render text to some device,
> and the text gets printed to the printer you select.

But that's exactly what postscript _is_ -- a printer API that lets you
select fonts and layout and then renders text to some device....

It's sad that some printers don't support it, but it's not like the
alternatives are much more dependable (maybe pdf is, these days, but
it's basically postscript, so maybe something could be worked out).

-Miles

-- 
Cat, n. A soft, indestructible automaton provided by nature to be kicked when
things go wrong in the domestic circle.




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

* Re: Printing
  2009-04-01  3:14                 ` Printing Eli Zaretskii
  2009-04-01  4:17                   ` Printing Miles Bader
@ 2009-04-01  4:24                   ` Jason Rumney
  2009-04-01 17:56                     ` Printing Eli Zaretskii
  2009-04-01  8:11                   ` Printing Stephen J. Turnbull
                                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 147+ messages in thread
From: Jason Rumney @ 2009-04-01  4:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael, Stefan Monnier, emacs-devel

Eli Zaretskii wrote:
> The way every modern platform does that: through a printer API,
> whereby you select fonts and layout, then render text to some device,
> and the text gets printed to the printer you select.  Since Emacs
> already knows how to render text, it shouldn't be too hard to teach it
> do so to something other than a screen.
>   

The problem is that the way Emacs renders text, even in GUI toolkits, is 
based more on the way text is rendered on tty devices than on the 
standard way of rendering text in the GUI toolkit. That does make it 
somewhat harder to teach Emacs to render to a printer than it is for 
other native GTK, NS or Windows apps. ps-print is probably actually 
closer to what we need as a starting point than the existing redisplay 
code, as it already takes care of pagination (albeit assuming a constant 
font height apart from the header and footer), which is usually the 
difficult part of implementing printing support in a GUI app.

FWIW, I agree that printing would be better done that way, but given the 
complications of understanding and modifying the existing redisplay 
code, it will probably be another 10 years before it is, and will 
probably come out of something like a port of Emacs redisplay to cairo 
rather than a dedicated effort to add printing support to existing 
platform specific code.





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

* Re: Printing
  2009-04-01  3:14                 ` Printing Eli Zaretskii
  2009-04-01  4:17                   ` Printing Miles Bader
  2009-04-01  4:24                   ` Printing Jason Rumney
@ 2009-04-01  8:11                   ` Stephen J. Turnbull
  2009-04-01 14:36                   ` Printing Stefan Monnier
  2009-04-02 10:08                   ` Printing tomas
  4 siblings, 0 replies; 147+ messages in thread
From: Stephen J. Turnbull @ 2009-04-01  8:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael, Stefan Monnier, emacs-devel

Eli Zaretskii writes:

 > The way every modern platform does that: through a printer API,
 > whereby you select fonts and layout, then render text to some device,
 > and the text gets printed to the printer you select.  Since Emacs
 > already knows how to render text, it shouldn't be too hard to teach it
 > do so to something other than a screen.

FWIW, XEmacs has an msprinter device for exactly this purpose.  AFAIK,
our Windows users are mostly satisfied with printing per se, although
our printer config dialog seems rife with nasty regressions. :-(





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

* Re: Printing
  2009-04-01  3:14                 ` Printing Eli Zaretskii
                                     ` (2 preceding siblings ...)
  2009-04-01  8:11                   ` Printing Stephen J. Turnbull
@ 2009-04-01 14:36                   ` Stefan Monnier
  2009-04-01 18:16                     ` Printing Eli Zaretskii
  2009-04-02 10:08                   ` Printing tomas
  4 siblings, 1 reply; 147+ messages in thread
From: Stefan Monnier @ 2009-04-01 14:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael, emacs-devel

>> > I hope you are not saying that ps-print machinery is the only way
>> > Emacs will be able to print in the future, i.e. rely on PostScript
>> > support of the OS infrastructure.
>> Yes, that's what I'm saying.
> Then, if history teaches us anything, we will probably having this
> discussion 10 years from now as well.

Note that I'm not opposed to implementations that use some other way of
printing than Postscript.  I'm just saying that AFAICT in the
foreseeable future, Emacs's printing will be based on Postscript.
And in this regard, it works OK on Free systems where Postscript is
always supported by the printing system (so the only problems on such
systems have to do with Emacs's own ability to produce the right
Postscript code).

>> > Because if you do, the history of that until today should tell us this
>> > is not necessarily a good idea.
>> What other way to print are you thinking of?

> The way every modern platform does that: through a printer API,
> whereby you select fonts and layout, then render text to some device,
> and the text gets printed to the printer you select.

Under GNU/Linux, the above goes through Postscript: the app generates
a Postscript file and then passes it to the printing subsystem
(typically CUPS) along with options such as color/bw, duplex/simplex,
... so generating Postscript is not at all contradictory with the desire
to provide the usual printer dialog.

> Since Emacs already knows how to render text, it shouldn't be too hard
> to teach it do so to something other than a screen.

That sounds good as well, but someone has to write the code.


        Stefan




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

* Re: Printing
@ 2009-04-01 17:22 grischka
  2009-04-01 18:55 ` Printing David De La Harpe Golden
  2009-04-01 23:32 ` Printing Stefan Monnier
  0 siblings, 2 replies; 147+ messages in thread
From: grischka @ 2009-04-01 17:22 UTC (permalink / raw)
  To: monnier; +Cc: emacs-devel

 > > The way every modern platform does that: through a printer API,
 > > whereby you select fonts and layout, then render text to some device,
 > > and the text gets printed to the printer you select.
 >
 > Under GNU/Linux, the above goes through Postscript: the app generates
 > a Postscript file and then passes it to the printing subsystem
 > ...

That is not what "the above" means. Postscript is not a "printer API".
If that were so then only postscript experts would be able to teach
their application to print something.

Btw, using "Print Buffer..." from the "File" menu on one computer gave
me an error  "Opening output file: invalid argument, c:/XPSPort:",
on another said something like "Printing OK" but did nothing.  (Both with
MS-Vista)









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

* Re: Printing
  2009-04-01  4:17                   ` Printing Miles Bader
@ 2009-04-01 17:53                     ` Eli Zaretskii
  0 siblings, 0 replies; 147+ messages in thread
From: Eli Zaretskii @ 2009-04-01 17:53 UTC (permalink / raw)
  To: Miles Bader; +Cc: michael, monnier, emacs-devel

> From: Miles Bader <miles@gnu.org>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, michael@elehack.net,
>         emacs-devel@gnu.org
> Date: Wed, 01 Apr 2009 13:17:52 +0900
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> >> What other way to print are you thinking of?
> >
> > The way every modern platform does that: through a printer API,
> > whereby you select fonts and layout, then render text to some device,
> > and the text gets printed to the printer you select.
> 
> But that's exactly what postscript _is_ -- a printer API that lets you
> select fonts and layout and then renders text to some device....

Obviously, there are some problems, since non-ASCII support in
ps-print still needs a lot of tinkering and intimate knowledge of what
your printing infrastructure supports.  This basically didn't change
since ps-mule was added about 10 years ago.  There were good
intentions to add support for Type1 fonts, but 10 years later there
still is no ps-type1.el, and what BDF fonts produce in print is simply
too ugly to be palatable.





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

* Re: Printing
  2009-04-01  4:24                   ` Printing Jason Rumney
@ 2009-04-01 17:56                     ` Eli Zaretskii
  0 siblings, 0 replies; 147+ messages in thread
From: Eli Zaretskii @ 2009-04-01 17:56 UTC (permalink / raw)
  To: Jason Rumney; +Cc: michael, monnier, emacs-devel

> Date: Wed, 01 Apr 2009 12:24:41 +0800
> From: Jason Rumney <jasonr@gnu.org>
> CC: Stefan Monnier <monnier@iro.umontreal.ca>, michael@elehack.net, 
>  emacs-devel@gnu.org
> 
> The problem is that the way Emacs renders text, even in GUI toolkits, is 
> based more on the way text is rendered on tty devices than on the 
> standard way of rendering text in the GUI toolkit. That does make it 
> somewhat harder to teach Emacs to render to a printer than it is for 
> other native GTK, NS or Windows apps.

Perhaps we could use some third-party library that does the hard
work.

> FWIW, I agree that printing would be better done that way, but given the 
> complications of understanding and modifying the existing redisplay 
> code, it will probably be another 10 years before it is

ps-mule was introduced 10 years ago, and we are still basically in the
same place as far as non-ASCII printing is concerned.  So obviously
it's not like ps-print is going to get better in that area tomorrow.




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

* Re: Printing
  2009-04-01 14:36                   ` Printing Stefan Monnier
@ 2009-04-01 18:16                     ` Eli Zaretskii
  2009-04-01 23:42                       ` Printing Stefan Monnier
  2009-04-02 13:02                       ` Printing Richard M Stallman
  0 siblings, 2 replies; 147+ messages in thread
From: Eli Zaretskii @ 2009-04-01 18:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: michael, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: michael@elehack.net,  emacs-devel@gnu.org
> Date: Wed, 01 Apr 2009 10:36:34 -0400
> 
> >> > I hope you are not saying that ps-print machinery is the only way
> >> > Emacs will be able to print in the future, i.e. rely on PostScript
> >> > support of the OS infrastructure.
> >> Yes, that's what I'm saying.
> > Then, if history teaches us anything, we will probably having this
> > discussion 10 years from now as well.
> 
> Note that I'm not opposed to implementations that use some other way of
> printing than Postscript.  I'm just saying that AFAICT in the
> foreseeable future, Emacs's printing will be based on Postscript.
> And in this regard, it works OK on Free systems where Postscript is
> always supported by the printing system (so the only problems on such
> systems have to do with Emacs's own ability to produce the right
> Postscript code).

PostScript is supported well on both free and proprietary platforms,
you are missing the point.  Let me remind you that what started this
thread was the complaints that ps-printing works well only for ASCII
and Latin-1 characters.

In this area, we basically didn't move much since ps-mule was
introduced more than 10 years ago.  Based on that experience, I fear
that if we stick to PostScript as the only decent printing facility in
Emacs, we will not improve our support of printing non-ASCII text for
the foreseeable future.  If you think otherwise, please explain how
come we are still where we were in 1998.

> >> What other way to print are you thinking of?
> 
> > The way every modern platform does that: through a printer API,
> > whereby you select fonts and layout, then render text to some device,
> > and the text gets printed to the printer you select.
> 
> Under GNU/Linux, the above goes through Postscript: the app generates
> a Postscript file and then passes it to the printing subsystem
> (typically CUPS) along with options such as color/bw, duplex/simplex,

You are again missing the point: it is not important how things are
done under the hood.  For example, on my home XP box, the default
printer is set up to use the PostScript driver, but applications still
don't emit PostScript themselves; the driver does.  So applications
don't care where the fonts are nor what fonts are built into the
printer and which ones need to be downloaded into it.  On the same
printer, I need to work hard configure ps-mule if I want to print
something that includes non-ASCII text.

> ... so generating Postscript is not at all contradictory with the desire
> to provide the usual printer dialog.

When PostScript generation is hidden from the application code, you
can leave it to the lower levels to solve problems such as finding and
selecting the right fonts.  With ps-print, since we produce PostScript
in Lisp, we also need to be able to DTRT with fonts, which is
obviously not an easy job to do on an arbitrary end-user platform.
That's the big difference.

> > Since Emacs already knows how to render text, it shouldn't be too hard
> > to teach it do so to something other than a screen.
> 
> That sounds good as well, but someone has to write the code.

Someone has to write the code for better support of non-ASCII
printing, too.  TANSTAAFL.




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

* Re: Printing
  2009-04-01 17:22 Printing grischka
@ 2009-04-01 18:55 ` David De La Harpe Golden
  2009-04-01 18:58   ` Printing David De La Harpe Golden
                     ` (3 more replies)
  2009-04-01 23:32 ` Printing Stefan Monnier
  1 sibling, 4 replies; 147+ messages in thread
From: David De La Harpe Golden @ 2009-04-01 18:55 UTC (permalink / raw)
  To: grischka; +Cc: monnier, emacs-devel



> If that were so then only postscript experts would be able to teach
> their application to print something.
> 

Application developers use toolkits, toolkit developers target the 
printing system.  /Except/ on windows, that printing subsystem tends to 
involve postscript:  A toolkit, like gtk+ with cairo, draws vectors to a 
postscript document [1] instead of rasterising (or sending trapezoids 
(xrandr) or general polys (opengl) to the display driver in the modern 
era) to the screen when it wants to print, then sends that postscript 
document to the printing daemon which does whatever is necessary to 
print it (for cheap printers, maybe rasterising it fully to 
device-specific bitmap data with ghostscript, for postscript printers, 
maybe munging it a bit to the postscript level the printer wants and 
passing it on).  i.e. a hypothetical "pure gtk+ stack" emacs at the 
application level  might well use gtk+ and cairo for both screen display 
and printing and abstract over the individual platform and indeed screen 
vs. print differences, but cairo is still probably just going to be 
drawing to postscript underneath for printing purposes on free or even 
nonfree but unixy platforms.

Since emacs is currently a "toolkit unto itself" for the most part, as 
Stefan has already pointed out, it kind of makes sense for it to 
generate its own postscript.  Though maybe just saving out and 
"enscript"ing text files might currently work about as well...

On windows, the toolkit uses win32 drawing commands on a printer device 
context [2] instead of postscript drawing on a postscript document. 
Typically they might internally rasterise to a high-res DIB (.bmp) then 
printed with basically just one such win32 drawing command consisting of 
"draw this enormous .bmp please".

So, if you squint *a lot*, .bmp in the windows printing world is a 
*little* like .ps in the nonwindows printing world.  Maybe windows 
people might be conceptualising .ps as device-specific thing that things 
are printed _to_ (and it is that _too_ I guess), but it is /also/ a 
quasistandard intermediate format for printing in the relevant OS apis 
on nonwindows.

Mind you, PDF would work just as well or better than postscript for that 
purpose, but the current de-facto standard is for OSes to expose an 
interface that accepts postscript documents for printing. Windows is the 
only vaguely relevant one that _doesn't_, pretty much, and it's only a 
ghostscript installation away anyway, it provides mswinpr2 to rasterise
postscript to .bmps sent to native windows printers (which may then of 
course inefficiently convert them back to postscript to send  to native 
postscript printers, but anyway...)



[1] http://cairographics.org/manual/cairo-ps-surface.html
[2] http://cairographics.org/manual/cairo-win32-surface.html













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

* Re: Printing
  2009-04-01 18:55 ` Printing David De La Harpe Golden
@ 2009-04-01 18:58   ` David De La Harpe Golden
  2009-04-01 20:51   ` Printing grischka
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 147+ messages in thread
From: David De La Harpe Golden @ 2009-04-01 18:58 UTC (permalink / raw)
  To: grischka; +Cc: monnier, emacs-devel

David De La Harpe Golden wrote:


> (or sending trapezoids 
> (xrandr)

uh, xrender I mean.




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

* Re: Printing
  2009-04-01 18:55 ` Printing David De La Harpe Golden
  2009-04-01 18:58   ` Printing David De La Harpe Golden
@ 2009-04-01 20:51   ` grischka
  2009-04-01 21:19   ` Printing Lennart Borgman
  2009-04-02  0:09   ` Printing David De La Harpe Golden
  3 siblings, 0 replies; 147+ messages in thread
From: grischka @ 2009-04-01 20:51 UTC (permalink / raw)
  To: David De La Harpe Golden; +Cc: monnier, emacs-devel

Well, I agree with most you wrote.

Just, if BMP is raw graphical data then Postscript isn't much more than
a sophisticated compression method to encode it.

With higher data capacities nowadays such compressions become more or
less obsolete, also because at the same time accurate WYSIWYG becomes
more important.

So my guess is that anyway the "Postcript experts" are a dying out
species and once they have gone nobody will want to fix that part of
the "toolkit onto itself" in question here.  Admittedly, whether this
happens sooner or later may vary depending on the OS.

--- grischka

David De La Harpe Golden wrote:
> 
> 
>> If that were so then only postscript experts would be able to teach
>> their application to print something.
>>
> 
> Application developers use toolkits, toolkit developers target the 
> printing system.  /Except/ on windows, that printing subsystem tends to 
> involve postscript:  A toolkit, like gtk+ with cairo, draws vectors to a 
> postscript document [1] instead of rasterising (or sending trapezoids 
> (xrandr) or general polys (opengl) to the display driver in the modern 
> era) to the screen when it wants to print, then sends that postscript 
> document to the printing daemon which does whatever is necessary to 
> print it (for cheap printers, maybe rasterising it fully to 
> device-specific bitmap data with ghostscript, for postscript printers, 
> maybe munging it a bit to the postscript level the printer wants and 
> passing it on).  i.e. a hypothetical "pure gtk+ stack" emacs at the 
> application level  might well use gtk+ and cairo for both screen display 
> and printing and abstract over the individual platform and indeed screen 
> vs. print differences, but cairo is still probably just going to be 
> drawing to postscript underneath for printing purposes on free or even 
> nonfree but unixy platforms.
> 
> Since emacs is currently a "toolkit unto itself" for the most part, as 
> Stefan has already pointed out, it kind of makes sense for it to 
> generate its own postscript.  Though maybe just saving out and 
> "enscript"ing text files might currently work about as well...
> 
> On windows, the toolkit uses win32 drawing commands on a printer device 
> context [2] instead of postscript drawing on a postscript document. 
> Typically they might internally rasterise to a high-res DIB (.bmp) then 
> printed with basically just one such win32 drawing command consisting of 
> "draw this enormous .bmp please".
> 
> So, if you squint *a lot*, .bmp in the windows printing world is a 
> *little* like .ps in the nonwindows printing world.  Maybe windows 
> people might be conceptualising .ps as device-specific thing that things 
> are printed _to_ (and it is that _too_ I guess), but it is /also/ a 
> quasistandard intermediate format for printing in the relevant OS apis 
> on nonwindows.
> 
> Mind you, PDF would work just as well or better than postscript for that 
> purpose, but the current de-facto standard is for OSes to expose an 
> interface that accepts postscript documents for printing. Windows is the 
> only vaguely relevant one that _doesn't_, pretty much, and it's only a 
> ghostscript installation away anyway, it provides mswinpr2 to rasterise
> postscript to .bmps sent to native windows printers (which may then of 
> course inefficiently convert them back to postscript to send  to native 
> postscript printers, but anyway...)
> 
> 
> 
> [1] http://cairographics.org/manual/cairo-ps-surface.html
> [2] http://cairographics.org/manual/cairo-win32-surface.html
> 
> 
> 
> 
> 
> 
> 
> 
> 









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

* Re: Printing
  2009-04-01 18:55 ` Printing David De La Harpe Golden
  2009-04-01 18:58   ` Printing David De La Harpe Golden
  2009-04-01 20:51   ` Printing grischka
@ 2009-04-01 21:19   ` Lennart Borgman
  2009-04-02  0:09   ` Printing David De La Harpe Golden
  3 siblings, 0 replies; 147+ messages in thread
From: Lennart Borgman @ 2009-04-01 21:19 UTC (permalink / raw)
  To: David De La Harpe Golden; +Cc: grischka, monnier, emacs-devel

On Wed, Apr 1, 2009 at 8:55 PM, David De La Harpe Golden
<david@harpegolden.net> wrote:
> On windows, the toolkit uses win32 drawing commands on a printer device
> context [2] instead of postscript drawing on a postscript document.
> Typically they might internally rasterise to a high-res DIB (.bmp) then
> printed with basically just one such win32 drawing command consisting of
> "draw this enormous .bmp please".

As Jason pointed out (and I guess you mean) printing using the ms w32
toolkit is done using GDI API:s. It is like outputting things to the
screen. Therefore printing on w32 is normally very simple to
implement. However Emacs does its own output to the screen and does
not use GDI API:s on that level.

Whether the output is a DIB file or a PostScript dito depends on the
printer used. (The printer driver that is part of w32 or installed
with the printer decides that.)

Like someone (Jason?) said it may be possible to use the code in
ps-*.el to implement calls to the w32 GDI API:s (some C code is of
course needed to for the API calls). If someone understands the
structure of both PostScript and the w32 GDI API:s involved
sufficiently well it would perhaps be rather easy. Of course such work
should be coordinated with what is needed on GNU/Linux. (Something for
Google Summer of Code?)




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

* Re: Printing
  2009-04-01 17:22 Printing grischka
  2009-04-01 18:55 ` Printing David De La Harpe Golden
@ 2009-04-01 23:32 ` Stefan Monnier
  2009-04-02  2:33   ` Printing grischka
  1 sibling, 1 reply; 147+ messages in thread
From: Stefan Monnier @ 2009-04-01 23:32 UTC (permalink / raw)
  To: grischka; +Cc: emacs-devel

> Btw, using "Print Buffer..." from the "File" menu on one computer gave
> me an error  "Opening output file: invalid argument, c:/XPSPort:",
> on another said something like "Printing OK" but did nothing.  (Both with
> MS-Vista)

Last I heard MS-Vista is not a Free system.


        Stefan




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

* Re: Printing
  2009-04-01 18:16                     ` Printing Eli Zaretskii
@ 2009-04-01 23:42                       ` Stefan Monnier
  2009-04-02 13:02                       ` Printing Richard M Stallman
  1 sibling, 0 replies; 147+ messages in thread
From: Stefan Monnier @ 2009-04-01 23:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael, emacs-devel

> PostScript is supported well on both free and proprietary platforms,
> you are missing the point.

I may be missing the point, but Postscript is not supported well
under Windows.

>> That sounds good as well, but someone has to write the code.
> Someone has to write the code for better support of non-ASCII
> printing, too.  TANSTAAFL.

Point taken,


        Stefan




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

* Re: Printing
  2009-04-01 18:55 ` Printing David De La Harpe Golden
                     ` (2 preceding siblings ...)
  2009-04-01 21:19   ` Printing Lennart Borgman
@ 2009-04-02  0:09   ` David De La Harpe Golden
  3 siblings, 0 replies; 147+ messages in thread
From: David De La Harpe Golden @ 2009-04-02  0:09 UTC (permalink / raw)
  To: Emacs developers

David De La Harpe Golden wrote:

> Since emacs is currently a "toolkit unto itself" for the most part, as 
> Stefan has already pointed out, it kind of makes sense for it to 
> generate its own postscript.  Though maybe just saving out and 
> "enscript"ing text files might currently work about as well...
> 

Hey, just found enscript homepage itself now recommends the "paps"
(giggle) command line tool for postscript printing of unicode text files.

http://paps.sourceforge.net/

See scans of me printing emacs hello with emacs' ps-print and
through paps - spot the difference:

http://harpegolden.net/misc/emacs-paps/emacs-hello-psprint.jpg
http://harpegolden.net/misc/emacs-paps/emacs-hello-paps.jpg

Yes, the paps output isn't _perfect_ (but all I did was saved
HELLO as utf-8 and fed it to paps), but it's already far, far better
- seeing as it supports non-latin1 stuff at all and all.

Lennart Borgman wrote:
  > Of course such work should be coordinated with what is needed on
  > GNU/Linux. (Something for Google Summer of Code?)

Turns out paps also apparently supports pango's small text formatting
markup language with the --markup flag:

http://library.gnome.org/devel/pango/unstable/PangoMarkupFormat.html

- if emacs could be persuaded to output such marked-up utf-8 text to be
filtered through paps, that might be a *very* short route to semidecent
printing, at least on GNU/linux and similar platforms.

Of course paps is using pango for its rendering - I guess Stefan's
aforementioned "real gtk" emacs port is a long-term solution for
free platforms, using the whole gtk+/cairo/pango stack (I believe
libm17n and libotf are also involved as a possible pango "shaper", but
don't really understand the whole area myself at present...) for a
unified vector-based screen GUI and print layer. Whole lot of work though.

But making emacs output utf-8 text marked up with pango markup language 
(for  replicating font-locking for quasi-wysiwig) to be fed through paps 
might be more at GSoC project scale ? Might even be too small...











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

* Re: Printing
  2009-04-01 23:32 ` Printing Stefan Monnier
@ 2009-04-02  2:33   ` grischka
  2009-04-02  3:05     ` Printing Samuel Bronson
  2009-04-02 13:31     ` Printing Stefan Monnier
  0 siblings, 2 replies; 147+ messages in thread
From: grischka @ 2009-04-02  2:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier wrote:
>> Btw, using "Print Buffer..." from the "File" menu on one computer gave
>> me an error  "Opening output file: invalid argument, c:/XPSPort:",
>> on another said something like "Printing OK" but did nothing.  (Both with
>> MS-Vista)
> 
> Last I heard MS-Vista is not a Free system.
> 

Sorry, I meant "Both with GNU/MS-Vista", of course.

> 
>         Stefan
> 





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

* Re: Printing
  2009-04-02  2:33   ` Printing grischka
@ 2009-04-02  3:05     ` Samuel Bronson
  2009-04-02 13:41       ` Printing grischka
  2009-04-02 13:31     ` Printing Stefan Monnier
  1 sibling, 1 reply; 147+ messages in thread
From: Samuel Bronson @ 2009-04-02  3:05 UTC (permalink / raw)
  To: grischka; +Cc: Stefan Monnier, emacs-devel

On Wed, Apr 1, 2009 at 10:33 PM, grischka <grishka@gmx.de> wrote:

> Sorry, I meant "Both with GNU/MS-Vista", of course.

You mean that MS bloatspace thing isn't needed? You can just run a
*nix userspace on top of an NT kernel now?




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

* Re: Printing
  2009-03-31  2:13   ` Printing YAMAMOTO Mitsuharu
@ 2009-04-02  9:39     ` YAMAMOTO Mitsuharu
  2009-04-04  2:44       ` Printing YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-04-02  9:39 UTC (permalink / raw)
  To: emacs-devel

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

>>>>> On Tue, 31 Mar 2009 11:13:13 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:

>>> b) Use standard GTK+ printing facilities as GEdit and many other
>>> applications do. Emacs is built with GTK+ interface for quite some
>>> time now, so I suppose there should be no architectural problem in
>>> using GTK+ for printing as well. Please correct me if I'm wrong.
>>> 

>> The problem is that Gtk+ printing assumes you are rendering with
>> cairo.  Emacs does not do that.  Changing that would be a major
>> undertaking.  Something like porting Emacs to a totally new
>> toolkit.

> FWIW, several ports for Mac OS X are using Quartz 2D that can
> generate PDF as in Cairo.  So creating a "resolution-independent
> screenshot" is immediate especially with Cocoa.  Of course, it is
> still not sufficient for general printing.

I tried making a really preliminary proof-of-concept cairo port. :-)
It's still rough and has several glitches/limitations, but at least it
can generate a "resolution-independent screenshot" PDF as attached.
Maybe I'll clean up the code this weekend and hopefully post a patch.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

[-- Attachment #2: cairotest.pdf --]
[-- Type: application/pdf, Size: 28152 bytes --]

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

* Re: Printing
  2009-04-01  3:14                 ` Printing Eli Zaretskii
                                     ` (3 preceding siblings ...)
  2009-04-01 14:36                   ` Printing Stefan Monnier
@ 2009-04-02 10:08                   ` tomas
  2009-04-02 10:52                     ` Printing Lennart Borgman
  4 siblings, 1 reply; 147+ messages in thread
From: tomas @ 2009-04-02 10:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Apr 01, 2009 at 06:14:59AM +0300, Eli Zaretskii wrote:

[...]

> > What other way to print are you thinking of?
> 
> The way every modern platform does that: through a printer API,
> whereby you select fonts and layout, then render text to some device,
[...]

Hm. I know that's the modern "trend", but I am unconvinced that it is in
the end a Good Thing. Implement all those interfaces for
$rendering_system_du_jour (GTK, QT, Windows 32, whatever) instead of
going for one more or less abstract (Postscript, PDF), well-documented
and widely implemented?

What next: implement the virtual file systems on the graphics toolkit?
Oh, wait...

(sorry if it sounds too ranty: it isn't personal. But watching all the
desktop environments implement things which belong to other layers of
the system is painful, especially in the Free Software context).

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJ1I6WBcgs9XrR2kYRAoD+AJ99+hGyjdIpFcWUkYWC/cIGdP710wCfWMpg
Pamv7XloQkOBuPlf4x/yj0A=
=2ezH
-----END PGP SIGNATURE-----




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

* Re: Printing
  2009-04-02 10:08                   ` Printing tomas
@ 2009-04-02 10:52                     ` Lennart Borgman
  2009-04-02 11:51                       ` Printing tomas
  0 siblings, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2009-04-02 10:52 UTC (permalink / raw)
  To: tomas; +Cc: Eli Zaretskii, emacs-devel

On Thu, Apr 2, 2009 at 12:08 PM,  <tomas@tuxteam.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wed, Apr 01, 2009 at 06:14:59AM +0300, Eli Zaretskii wrote:
>
> [...]
>
>> > What other way to print are you thinking of?
>>
>> The way every modern platform does that: through a printer API,
>> whereby you select fonts and layout, then render text to some device,
> [...]
>
> Hm. I know that's the modern "trend", but I am unconvinced that it is in
> the end a Good Thing. Implement all those interfaces for
> $rendering_system_du_jour (GTK, QT, Windows 32, whatever) instead of
> going for one more or less abstract (Postscript, PDF), well-documented
> and widely implemented?

Is not this reality versus ideality? I think most users on different
systems will appreciate that we use the API:s for that system. They
will know what to do at once then without having to relearn.

And a simple way to do this is to use an intermediate layer like wxwidgets.




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

* Re: Printing
  2009-04-02 11:51                       ` Printing tomas
@ 2009-04-02 11:49                         ` Lennart Borgman
  2009-04-02 13:37                           ` Printing Stefan Monnier
  0 siblings, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2009-04-02 11:49 UTC (permalink / raw)
  To: tomas; +Cc: Eli Zaretskii, emacs-devel

On Thu, Apr 2, 2009 at 1:51 PM,  <tomas@tuxteam.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Thu, Apr 02, 2009 at 12:52:25PM +0200, Lennart Borgman wrote:
>
> [...]
>
>> Is not this reality versus ideality? I think most users on different
>> systems will appreciate that we use the API:s for that system. They
>> will know what to do at once then without having to relearn.
>
> In a way, yes, but I think my rant still holds. Even while there is some
> truth to what you say above, you are conflating API with "user
> interface" ("most users ...will appreciate that we use the APIs... they
> will know..."). See?

You have a point, but using these API:s you get the standard UI.


>> And a simple way to do this is to use an intermediate layer like wxwidgets.
>
> For printing? Well, that's what my rant was about :-)
>
> Look at the Gnome guys. There is mount, there is FUSE (I'm sure BSDs
> have something similar). Why VFS? Why invent a new way of "mounting"
> "file systems" which is dependent on some random desktop environment?
> (KDE ain't better in this!).
>
> In our printer case I'd propose to start recognizing that we have
> several layers:
>
>  (1) how to render
>  (2) how to choose a printer
>  (3) how to configure the capabilities of a printer
>
> For (1), I think we'd be fine if we managed to render utf-8 via
> one of ps or pdf properly. (2) and (3) might be in the realm of CUPS,
> perhaps?
>
> Showing the "standard" "system" "printer dialog box" would fulfill your
> proposal above, but that is now an entirely separate point.
>
> Regards, and thanks for beearing with my rant :)

Writing a pdf-file would of course allow printing on w32 more simple
too - if you install some software to read and print pdf.




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

* Re: Printing
  2009-04-02 10:52                     ` Printing Lennart Borgman
@ 2009-04-02 11:51                       ` tomas
  2009-04-02 11:49                         ` Printing Lennart Borgman
  0 siblings, 1 reply; 147+ messages in thread
From: tomas @ 2009-04-02 11:51 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Eli Zaretskii, tomas, emacs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Apr 02, 2009 at 12:52:25PM +0200, Lennart Borgman wrote:

[...]

> Is not this reality versus ideality? I think most users on different
> systems will appreciate that we use the API:s for that system. They
> will know what to do at once then without having to relearn.

In a way, yes, but I think my rant still holds. Even while there is some
truth to what you say above, you are conflating API with "user
interface" ("most users ...will appreciate that we use the APIs... they
will know..."). See? That is the think coming from Microsoft and Apple:
One Big System, from device driver up to desktop environment. And we are
copying that (but I'm getting seriously off-topic with that by now, I
fear).

> And a simple way to do this is to use an intermediate layer like wxwidgets.

For printing? Well, that's what my rant was about :-)

Look at the Gnome guys. There is mount, there is FUSE (I'm sure BSDs
have something similar). Why VFS? Why invent a new way of "mounting"
"file systems" which is dependent on some random desktop environment?
(KDE ain't better in this!).

In our printer case I'd propose to start recognizing that we have
several layers:

  (1) how to render
  (2) how to choose a printer
  (3) how to configure the capabilities of a printer

For (1), I think we'd be fine if we managed to render utf-8 via
one of ps or pdf properly. (2) and (3) might be in the realm of CUPS,
perhaps?

Showing the "standard" "system" "printer dialog box" would fulfill your
proposal above, but that is now an entirely separate point.

Regards, and thanks for beearing with my rant :)

- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJ1Ka3Bcgs9XrR2kYRAumVAKCBkVeZ9oVfA0VPpev19GZ67W7xeQCZAdDM
dm+VOpzR4qTYun4PmIpUFCE=
=bhyn
-----END PGP SIGNATURE-----




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

* Re: Printing
  2009-04-01 18:16                     ` Printing Eli Zaretskii
  2009-04-01 23:42                       ` Printing Stefan Monnier
@ 2009-04-02 13:02                       ` Richard M Stallman
  2009-04-02 19:37                         ` Printing Eli Zaretskii
  1 sibling, 1 reply; 147+ messages in thread
From: Richard M Stallman @ 2009-04-02 13:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael, monnier, emacs-devel

    In this area, we basically didn't move much since ps-mule was
    introduced more than 10 years ago.  Based on that experience, I fear
    that if we stick to PostScript as the only decent printing facility in
    Emacs, we will not improve our support of printing non-ASCII text for
    the foreseeable future.  If you think otherwise, please explain how
    come we are still where we were in 1998.

This is not the right way to choose the method for solving a problem.
How much people have worked on this in the past is beside the point.

The real question about printing non-ASCII text is what needs to be
done to make ps-print handle more character sets, and what the
obstacles are.

      For example, on my home XP box, the default
    printer is set up to use the PostScript driver, but applications still
    don't emit PostScript themselves; the driver does.

Supporting application-specific APIs could be a big pain in the neck.
Each one of them could be a big pain in the neck.  It might be a lot
easier to make ps-print find the necessary fonts, if that can be dne
in a mostly portable way, than to support several totally different
printing APIs.

If supporting these printing APIs requires redesigning Emacs
redisplay, that would yoke this big task to an even bigger task which
might be a mistake anyway.  It would take many years to redo redisplay
and fix the bugs.  Interfaces such as Cairo would probably impede
portability even if they are not 100% unportable, and they might also
cause a slowdown in redisplay.

I if you want a good chance of making progress happen, I suggest you
start working on the solitions that are much easier, even if they are
difficult in absolute terms.

Would you like to collect the docs of the APIs used for finding and
specifying fonts on the various systems, so people can see what work
is really involved in supporting them?






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

* Re: Printing
  2009-04-02  2:33   ` Printing grischka
  2009-04-02  3:05     ` Printing Samuel Bronson
@ 2009-04-02 13:31     ` Stefan Monnier
  2009-04-02 18:39       ` Printing grischka
  1 sibling, 1 reply; 147+ messages in thread
From: Stefan Monnier @ 2009-04-02 13:31 UTC (permalink / raw)
  To: grischka; +Cc: emacs-devel

>>> Btw, using "Print Buffer..." from the "File" menu on one computer gave
>>> me an error  "Opening output file: invalid argument, c:/XPSPort:",
>>> on another said something like "Printing OK" but did nothing.  (Both with
>>> MS-Vista)
>> Last I heard MS-Vista is not a Free system.
> Sorry, I meant "Both with GNU/MS-Vista", of course.

I do not know what you mean by "GNU/MS-Vista", but under most GNU
systems, Emacs should print something or signal an error (provided the
print system is configured, of course).  If it didn't, please report it
as a bug.


        Stefan






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

* Re: Printing
  2009-04-02 11:49                         ` Printing Lennart Borgman
@ 2009-04-02 13:37                           ` Stefan Monnier
  2009-04-02 13:47                             ` Printing Óscar Fuentes
  2009-04-02 14:00                             ` Printing Lennart Borgman
  0 siblings, 2 replies; 147+ messages in thread
From: Stefan Monnier @ 2009-04-02 13:37 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Eli Zaretskii, tomas, emacs-devel

> Writing a pdf-file would of course allow printing on w32 more simple
> too - if you install some software to read and print pdf.

Considering that I'd rather not encourage people to install proprietary
software, is it really significantly easier to install support for
printing PDF than support for printing Postscript (in Windows)?


        Stefan


PS: This said, I agree that pdf-print.el would be welcome.




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

* Re: Printing
  2009-04-02  3:05     ` Printing Samuel Bronson
@ 2009-04-02 13:41       ` grischka
  0 siblings, 0 replies; 147+ messages in thread
From: grischka @ 2009-04-02 13:41 UTC (permalink / raw)
  To: Samuel Bronson; +Cc: Stefan Monnier, emacs-devel

Samuel Bronson wrote:
> On Wed, Apr 1, 2009 at 10:33 PM, grischka <grishka@gmx.de> wrote:
> 
>> Sorry, I meant "Both with GNU/MS-Vista", of course.
> 
> You mean that MS bloatspace thing isn't needed? You can just run a
> *nix userspace on top of an NT kernel now?
> 

GNU Emacs as it says on it's "About" splash is "one component of the
GNU operating system", so if GNU Emacs is run with MS-Vista this makes
a combination out of components from GNU and MS-Vista and hence a
GNU/MS-Vista system.  No?





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

* Re: Printing
  2009-04-02 13:37                           ` Printing Stefan Monnier
@ 2009-04-02 13:47                             ` Óscar Fuentes
  2009-04-02 13:55                               ` Printing Samuel Bronson
  2009-04-02 14:00                             ` Printing Lennart Borgman
  1 sibling, 1 reply; 147+ messages in thread
From: Óscar Fuentes @ 2009-04-02 13:47 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Writing a pdf-file would of course allow printing on w32 more simple
>> too - if you install some software to read and print pdf.
>
> Considering that I'd rather not encourage people to install proprietary
> software,

Ghostscript/GSView can display (and print) pdf. It is possible to
install other Free pdf viewers on Windows such as the ones created for
KDE, but not easy.

> is it really significantly easier to install support for printing PDF
> than support for printing Postscript (in Windows)?

AFAIK, restricting ourselves to Free software, no.

-- 
Oscar





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

* Re: Printing
  2009-04-02 13:47                             ` Printing Óscar Fuentes
@ 2009-04-02 13:55                               ` Samuel Bronson
  2009-04-02 14:24                                 ` Printing Óscar Fuentes
  0 siblings, 1 reply; 147+ messages in thread
From: Samuel Bronson @ 2009-04-02 13:55 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: emacs-devel

On Thu, Apr 2, 2009 at 9:47 AM, Óscar Fuentes <ofv@wanadoo.es> wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> is it really significantly easier to install support for printing PDF
>> than support for printing Postscript (in Windows)?
>
> AFAIK, restricting ourselves to Free software, no.

If we were doing that, we wouldn't be in that mess in the first place
-- we'd not be using Windows!

Installing Adobe Reader is surely easier than figuring out how to get
ghostscript set up on windows, no?




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

* Re: Printing
  2009-04-02 13:37                           ` Printing Stefan Monnier
  2009-04-02 13:47                             ` Printing Óscar Fuentes
@ 2009-04-02 14:00                             ` Lennart Borgman
  2009-04-02 16:15                               ` Printing Stefan Monnier
  1 sibling, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2009-04-02 14:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, tomas, emacs-devel

On Thu, Apr 2, 2009 at 3:37 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> Writing a pdf-file would of course allow printing on w32 more simple
>> too - if you install some software to read and print pdf.
>
> Considering that I'd rather not encourage people to install proprietary
> software, is it really significantly easier to install support for
> printing PDF than support for printing Postscript (in Windows)?


Yes, I think so since most people already have a viewer for PDF
installed. And that viewer can be used to print.




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

* Re: Printing
  2009-04-02 13:55                               ` Printing Samuel Bronson
@ 2009-04-02 14:24                                 ` Óscar Fuentes
  2009-04-02 14:34                                   ` Printing Lennart Borgman
  0 siblings, 1 reply; 147+ messages in thread
From: Óscar Fuentes @ 2009-04-02 14:24 UTC (permalink / raw)
  To: emacs-devel

Samuel Bronson <naesten@gmail.com> writes:

>>> is it really significantly easier to install support for printing PDF
>>> than support for printing Postscript (in Windows)?
>>
>> AFAIK, restricting ourselves to Free software, no.
>
> If we were doing that, we wouldn't be in that mess in the first place
> -- we'd not be using Windows!

IIRC, it is a policy of the FSF to discourage using propietary software
for any purpose, even less to require it for adding capabilities to a
Free software package.

> Installing Adobe Reader is surely easier than figuring out how to get
> ghostscript set up on windows, no?

Driving Adobe Reader from an external application (or from the command
line) for printing is tricky: it relies on undocumented features that
changes with each version. OTOH, starting it for document viewing is
easy (although sometimes refuses to work). For printing purposes,
waiting for the pdf reader to start, then printing from it, is an
annoyance if you need to print often.

-- 
Oscar





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

* Re: Printing
  2009-04-02 14:24                                 ` Printing Óscar Fuentes
@ 2009-04-02 14:34                                   ` Lennart Borgman
  0 siblings, 0 replies; 147+ messages in thread
From: Lennart Borgman @ 2009-04-02 14:34 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: emacs-devel

On Thu, Apr 2, 2009 at 4:24 PM, Óscar Fuentes <ofv@wanadoo.es> wrote:
> Driving Adobe Reader from an external application (or from the command
> line) for printing is tricky: it relies on undocumented features that
> changes with each version. OTOH, starting it for document viewing is
> easy (although sometimes refuses to work). For printing purposes,
> waiting for the pdf reader to start, then printing from it, is an
> annoyance if you need to print often.

If it is already started it shows a new document fast. And for w32 it
is surely an easier alternative than most others. (I myself use the
web browser + htmlfontify trick for printing. It is good enough for
me, but I guess ps-print gives more flexibility.)




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

* Re: Printing
  2009-04-02 14:00                             ` Printing Lennart Borgman
@ 2009-04-02 16:15                               ` Stefan Monnier
  2009-04-02 16:47                                 ` Printing Reiner Steib
                                                   ` (2 more replies)
  0 siblings, 3 replies; 147+ messages in thread
From: Stefan Monnier @ 2009-04-02 16:15 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Eli Zaretskii, tomas, emacs-devel

>>> Writing a pdf-file would of course allow printing on w32 more simple
>>> too - if you install some software to read and print pdf.
>> Considering that I'd rather not encourage people to install proprietary
>> software, is it really significantly easier to install support for
>> printing PDF than support for printing Postscript (in Windows)?
> Yes, I think so since most people already have a viewer for PDF
> installed. And that viewer can be used to print.

AFAIK, Windows comes neither with a Postscript viewer/printer nor with
a PDF viewer/printer.  So for ps-print.el we have to ask people to
install Ghostscript on such systems.  Assuming we had pdf-print.el,
which other software would we tell people to install?  As mentioned
non-proprietary options are unacceptable.

This said, maybe ps-print.el could be changed so it can run `gs'
directly (under Windows); this would mean that the user only needs to
install Ghostscript without configuring something like redmon and
creating a special postscript virtual printer.


        Stefan




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

* Re: Printing
  2009-04-02 16:15                               ` Printing Stefan Monnier
@ 2009-04-02 16:47                                 ` Reiner Steib
  2009-04-02 19:44                                 ` Printing Eli Zaretskii
  2009-04-02 20:56                                 ` Printing Lennart Borgman
  2 siblings, 0 replies; 147+ messages in thread
From: Reiner Steib @ 2009-04-02 16:47 UTC (permalink / raw)
  To: emacs-devel

On Thu, Apr 02 2009, Stefan Monnier wrote:

> AFAIK, Windows comes neither with a Postscript viewer/printer nor with
> a PDF viewer/printer.  So for ps-print.el we have to ask people to
> install Ghostscript on such systems.  Assuming we had pdf-print.el,
> which other software would we tell people to install?  As mentioned
> non-proprietary options are unacceptable.

Ghostscript?  ;-)

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: Printing
  2009-04-02 13:31     ` Printing Stefan Monnier
@ 2009-04-02 18:39       ` grischka
  2009-04-02 18:53         ` Printing Stefan Monnier
  0 siblings, 1 reply; 147+ messages in thread
From: grischka @ 2009-04-02 18:39 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier wrote:
>>>> Btw, using "Print Buffer..." from the "File" menu on one computer gave
>>>> me an error  "Opening output file: invalid argument, c:/XPSPort:",
>>>> on another said something like "Printing OK" but did nothing.  (Both with
>>>> MS-Vista)
>>> Last I heard MS-Vista is not a Free system.
>> Sorry, I meant "Both with GNU/MS-Vista", of course.
> 
> I do not know what you mean by "GNU/MS-Vista", but under most GNU
> systems, Emacs should print something or signal an error (provided the
> print system is configured, of course).  If it didn't, please report it
> as a bug.

If it wasn't to solve problems with "Printing" then what is this
thread for?  Clearly you don't need more reports stacked away
in some tracker.





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

* Re: Printing
  2009-04-02 18:39       ` Printing grischka
@ 2009-04-02 18:53         ` Stefan Monnier
  0 siblings, 0 replies; 147+ messages in thread
From: Stefan Monnier @ 2009-04-02 18:53 UTC (permalink / raw)
  To: grischka; +Cc: emacs-devel

>> I do not know what you mean by "GNU/MS-Vista", but under most GNU
>> systems, Emacs should print something or signal an error (provided the
>> print system is configured, of course).  If it didn't, please report it
>> as a bug.

> If it wasn't to solve problems with "Printing" then what is this
> thread for?  Clearly you don't need more reports stacked away
> in some tracker.

Sorry, I just wanted to help,


        Stefan




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

* Re: Printing
  2009-04-02 13:02                       ` Printing Richard M Stallman
@ 2009-04-02 19:37                         ` Eli Zaretskii
  0 siblings, 0 replies; 147+ messages in thread
From: Eli Zaretskii @ 2009-04-02 19:37 UTC (permalink / raw)
  To: rms; +Cc: michael, monnier, emacs-devel

> From: Richard M Stallman <rms@gnu.org>
> CC: monnier@iro.umontreal.ca, michael@elehack.net, emacs-devel@gnu.org
> Date: Thu, 02 Apr 2009 09:02:19 -0400
> 
>     In this area, we basically didn't move much since ps-mule was
>     introduced more than 10 years ago.  Based on that experience, I fear
>     that if we stick to PostScript as the only decent printing facility in
>     Emacs, we will not improve our support of printing non-ASCII text for
>     the foreseeable future.  If you think otherwise, please explain how
>     come we are still where we were in 1998.
> 
> This is not the right way to choose the method for solving a problem.
> How much people have worked on this in the past is beside the point.

It's not beside the point: it can give us some idea how many people
are likely to work on it in the future.

> The real question about printing non-ASCII text is what needs to be
> done to make ps-print handle more character sets, and what the
> obstacles are.

I suspect there are no people among active contributors to Emacs who
know that.  Otherwise, they would have already solved this.

> Supporting application-specific APIs could be a big pain in the neck.
> Each one of them could be a big pain in the neck.

It could, but then again it could be much easier, too.

> Would you like to collect the docs of the APIs used for finding and
> specifying fonts on the various systems, so people can see what work
> is really involved in supporting them?

I will add this to my todo, but it's so long that there's no knowing
if I ever get to doing that.  Nor am I the ideal candidate, for that
matter: I'm not much of an expert on these APIs, I know only a couple
of them, and only very superficially.




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

* Re: Printing
  2009-04-02 16:15                               ` Printing Stefan Monnier
  2009-04-02 16:47                                 ` Printing Reiner Steib
@ 2009-04-02 19:44                                 ` Eli Zaretskii
  2009-04-03  0:43                                   ` Printing Stefan Monnier
  2009-04-02 20:56                                 ` Printing Lennart Borgman
  2 siblings, 1 reply; 147+ messages in thread
From: Eli Zaretskii @ 2009-04-02 19:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: tomas, lennart.borgman, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: tomas@tuxteam.de,  Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
> Date: Thu, 02 Apr 2009 12:15:23 -0400
> 
> AFAIK, Windows comes neither with a Postscript viewer/printer nor with
> a PDF viewer/printer.

True.

> This said, maybe ps-print.el could be changed so it can run `gs'
> directly (under Windows); this would mean that the user only needs to
> install Ghostscript without configuring something like redmon and
> creating a special postscript virtual printer.

There's no need for these complications.  Installing Ghostscript on
Windows is very easy, and once installed, it can immediately be used
to print with ps-print to any Windows printer; no need for redmon or
virtual printers.  The instructions to configure Emacs on Windows to
do that are in the Emacs manual.

Again, this thread was not about PostScript printing in general:
setting that up is almost trivially easy (although I personally think
that printouts produced by Ghostscript are ugly).  The problem was
with printing non-ASCII text, and that needs to be solved in ps-print
and ps-mule, not in external applications.




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

* Re: Printing
  2009-04-02 16:15                               ` Printing Stefan Monnier
  2009-04-02 16:47                                 ` Printing Reiner Steib
  2009-04-02 19:44                                 ` Printing Eli Zaretskii
@ 2009-04-02 20:56                                 ` Lennart Borgman
  2009-04-04  0:00                                   ` Printing Lennart Borgman
  2 siblings, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2009-04-02 20:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, tomas, emacs-devel

On Thu, Apr 2, 2009 at 6:15 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>>> Writing a pdf-file would of course allow printing on w32 more simple
>>>> too - if you install some software to read and print pdf.
>>> Considering that I'd rather not encourage people to install proprietary
>>> software, is it really significantly easier to install support for
>>> printing PDF than support for printing Postscript (in Windows)?
>> Yes, I think so since most people already have a viewer for PDF
>> installed. And that viewer can be used to print.
>
> AFAIK, Windows comes neither with a Postscript viewer/printer nor with
> a PDF viewer/printer.  So for ps-print.el we have to ask people to
> install Ghostscript on such systems.  Assuming we had pdf-print.el,
> which other software would we tell people to install?  As mentioned
> non-proprietary options are unacceptable.
>
> This said, maybe ps-print.el could be changed so it can run `gs'
> directly (under Windows); this would mean that the user only needs to
> install Ghostscript without configuring something like redmon and
> creating a special postscript virtual printer.

An easy way would perhaps be to write a temporary pdf-file and then
call w32-shell-execute on that file with "print" as the operation.




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

* Re: Printing
  2009-04-02 19:44                                 ` Printing Eli Zaretskii
@ 2009-04-03  0:43                                   ` Stefan Monnier
  0 siblings, 0 replies; 147+ messages in thread
From: Stefan Monnier @ 2009-04-03  0:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: tomas, lennart.borgman, emacs-devel

> There's no need for these complications.  Installing Ghostscript on
> Windows is very easy, and once installed, it can immediately be used
> to print with ps-print to any Windows printer; no need for redmon or
> virtual printers.  The instructions to configure Emacs on Windows to
> do that are in the Emacs manual.

Wonderful, thanks.

> The problem was with printing non-ASCII text, and that needs to be
> solved in ps-print and ps-mule, not in external applications.

This thread has mentioned several issues, the non-ASCII chars being one
of them.  I think it's the main one at this point, indeed.


        Stefan




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

* Re: Printing
  2009-04-02 20:56                                 ` Printing Lennart Borgman
@ 2009-04-04  0:00                                   ` Lennart Borgman
  2009-04-04  0:36                                     ` Printing Stefan Monnier
  2009-04-04  8:57                                     ` Printing Eli Zaretskii
  0 siblings, 2 replies; 147+ messages in thread
From: Lennart Borgman @ 2009-04-04  0:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, tomas, emacs-devel

On Thu, Apr 2, 2009 at 10:56 PM, Lennart Borgman
<lennart.borgman@gmail.com> wrote:
> An easy way would perhaps be to write a temporary pdf-file and then
> call w32-shell-execute on that file with "print" as the operation.

Just tested with

  (w32-shell-execute "print" "MY-PDF-FILE")

This just sends the file MY-PDF-FILE to the printer with Acrobat.
Could perhaps someone test with GhostScript?




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

* Re: Printing
  2009-04-04  0:00                                   ` Printing Lennart Borgman
@ 2009-04-04  0:36                                     ` Stefan Monnier
  2009-04-04  0:45                                       ` Printing Lennart Borgman
  2009-04-04  8:57                                     ` Printing Eli Zaretskii
  1 sibling, 1 reply; 147+ messages in thread
From: Stefan Monnier @ 2009-04-04  0:36 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Eli Zaretskii, tomas, emacs-devel

> This just sends the file MY-PDF-FILE to the printer with Acrobat.

Last I heard Acrobat is not Free.


        Stefan




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

* Re: Printing
  2009-04-04  0:36                                     ` Printing Stefan Monnier
@ 2009-04-04  0:45                                       ` Lennart Borgman
  2009-04-04  1:05                                         ` Printing Óscar Fuentes
  0 siblings, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2009-04-04  0:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, tomas, emacs-devel

On Sat, Apr 4, 2009 at 2:36 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> This just sends the file MY-PDF-FILE to the printer with Acrobat.
>
> Last I heard Acrobat is not Free.

If the user has installed a free pdf-viewer then w32-shell-execute may
work the same way as it did for me with Acrobat. That is what I
proposed that someone with a free pdf-viewer should test.

If it does not work as it should then there is a problem with the free
pdf-viewer (which we can suggest to the developers to fix).




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

* Re: Printing
  2009-04-04  0:45                                       ` Printing Lennart Borgman
@ 2009-04-04  1:05                                         ` Óscar Fuentes
  2009-04-04  6:52                                           ` Printing Lennart Borgman
  0 siblings, 1 reply; 147+ messages in thread
From: Óscar Fuentes @ 2009-04-04  1:05 UTC (permalink / raw)
  To: emacs-devel

Lennart Borgman <lennart.borgman@gmail.com> writes:

>>> This just sends the file MY-PDF-FILE to the printer with Acrobat.
>>
>> Last I heard Acrobat is not Free.
>
> If the user has installed a free pdf-viewer then w32-shell-execute may
> work the same way as it did for me with Acrobat. That is what I
> proposed that someone with a free pdf-viewer should test.
>
> If it does not work as it should then there is a problem with the free
> pdf-viewer (which we can suggest to the developers to fix).

Not a problem, but an unimplemented feature.

The method you suggest sends the full document to the default printer,
no questions asked. This is not very user friendly.

-- 
Oscar





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

* Re: Printing
  2009-04-02  9:39     ` Printing YAMAMOTO Mitsuharu
@ 2009-04-04  2:44       ` YAMAMOTO Mitsuharu
  2009-04-04  6:54         ` Printing Lennart Borgman
                           ` (4 more replies)
  0 siblings, 5 replies; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-04-04  2:44 UTC (permalink / raw)
  To: emacs-devel

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

>>>>> On Thu, 02 Apr 2009 18:39:24 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:

> I tried making a really preliminary proof-of-concept cairo port. :-)
> It's still rough and has several glitches/limitations, but at least
> it can generate a "resolution-independent screenshot" PDF as
> attached.  Maybe I'll clean up the code this weekend and hopefully
> post a patch.

Here's the patch for the Emacs 23.0.92 pretest (not the trunk HEAD).

* No configure support.  The easiest way would be to compile it with
  the GTK+ support that is already linked with cairo libs.  Add
  -DUSE_CAIRO to CFLAGS to activate the cairo code.

* With an experimental function (x-export-frame-image FRAME TYPE), you
  can get the current FRAME screenshot as a unibyte string in TYPE
  format.  TYPE can be 'pdf, 'ps, 'png, or 'svg if the installed cairo
  supports their formats.

* Currently, texts, rectangles (filling and stroking), and trapezoids
  for reliefs are drawn using cairo by hooking the corresponding
  drawing routine calls in xterm.c.  They use X11 GC (with extension
  data) for colors and clipping rectangles, but operations on them can
  easily be ported to non-X11 (e.g., terminal-only) environments just
  like the Carbon port.

* Images could also be drawn with cairo, but I didn't do that because
  the image drawing in xterm.c depends on X-specific data structures.
  As a result, you can't see any images in the exported screenshot as
  of now.

* Stipples are ignored (both on screen and exported one).

* Exported png images seem to be incorrect in some cases.  I suspect
  it has something to do with cairo's cluttering the activated FT_Size
  mentioned in ftcrfont.c, but I'm not sure.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

[-- Attachment #2: emacs-23.0.92-cairo.patch.gz --]
[-- Type: application/octet-stream, Size: 12059 bytes --]

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

* Re: Printing
  2009-04-04  1:05                                         ` Printing Óscar Fuentes
@ 2009-04-04  6:52                                           ` Lennart Borgman
  0 siblings, 0 replies; 147+ messages in thread
From: Lennart Borgman @ 2009-04-04  6:52 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: emacs-devel

On Sat, Apr 4, 2009 at 3:05 AM, Óscar Fuentes <ofv@wanadoo.es> wrote:
> Lennart Borgman <lennart.borgman@gmail.com> writes:
>
>>>> This just sends the file MY-PDF-FILE to the printer with Acrobat.
>>>
>>> Last I heard Acrobat is not Free.
>>
>> If the user has installed a free pdf-viewer then w32-shell-execute may
>> work the same way as it did for me with Acrobat. That is what I
>> proposed that someone with a free pdf-viewer should test.
>>
>> If it does not work as it should then there is a problem with the free
>> pdf-viewer (which we can suggest to the developers to fix).
>
> Not a problem, but an unimplemented feature.
>
> The method you suggest sends the full document to the default printer,
> no questions asked. This is not very user friendly.

Hm, yes you are right, there is no print dialog. I do not know if
there is another verb than "print" that can be used as argument to
w32-shell-execute to get the print dialog.

A free viewer can anyway implement such a new verb.




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

* Re: Printing
  2009-04-04  2:44       ` Printing YAMAMOTO Mitsuharu
@ 2009-04-04  6:54         ` Lennart Borgman
  2009-04-04  7:25           ` Printing YAMAMOTO Mitsuharu
  2009-04-04  9:40         ` Printing Leo
                           ` (3 subsequent siblings)
  4 siblings, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2009-04-04  6:54 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

On Sat, Apr 4, 2009 at 4:44 AM, YAMAMOTO Mitsuharu
<mituharu@math.s.chiba-u.ac.jp> wrote:
>>>>>> On Thu, 02 Apr 2009 18:39:24 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:
>
>> I tried making a really preliminary proof-of-concept cairo port. :-)
>> It's still rough and has several glitches/limitations, but at least
>> it can generate a "resolution-independent screenshot" PDF as
>> attached.  Maybe I'll clean up the code this weekend and hopefully
>> post a patch.
>
> Here's the patch for the Emacs 23.0.92 pretest (not the trunk HEAD).
>
> * No configure support.  The easiest way would be to compile it with
>  the GTK+ support that is already linked with cairo libs.  Add
>  -DUSE_CAIRO to CFLAGS to activate the cairo code.
>
> * With an experimental function (x-export-frame-image FRAME TYPE), you
>  can get the current FRAME screenshot as a unibyte string in TYPE
>  format.  TYPE can be 'pdf, 'ps, 'png, or 'svg if the installed cairo
>  supports their formats.
>
> * Currently, texts, rectangles (filling and stroking), and trapezoids
>  for reliefs are drawn using cairo by hooking the corresponding
>  drawing routine calls in xterm.c.  They use X11 GC (with extension
>  data) for colors and clipping rectangles, but operations on them can
>  easily be ported to non-X11 (e.g., terminal-only) environments just
>  like the Carbon port.
>
> * Images could also be drawn with cairo, but I didn't do that because
>  the image drawing in xterm.c depends on X-specific data structures.
>  As a result, you can't see any images in the exported screenshot as
>  of now.
>
> * Stipples are ignored (both on screen and exported one).
>
> * Exported png images seem to be incorrect in some cases.  I suspect
>  it has something to do with cairo's cluttering the activated FT_Size
>  mentioned in ftcrfont.c, but I'm not sure.


Does this work on w32?




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

* Re: Printing
  2009-04-04  6:54         ` Printing Lennart Borgman
@ 2009-04-04  7:25           ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-04-04  7:25 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: emacs-devel

>>>>> On Sat, 4 Apr 2009 08:54:32 +0200, Lennart Borgman <lennart.borgman@gmail.com> said:

>>> I tried making a really preliminary proof-of-concept cairo
>>> port. :-) It's still rough and has several glitches/limitations,
>>> but at least it can generate a "resolution-independent screenshot"
>>> PDF as attached.  Maybe I'll clean up the code this weekend and
>>> hopefully post a patch.
>> 
>> Here's the patch for the Emacs 23.0.92 pretest (not the trunk
>> HEAD).

>> * Currently, texts, rectangles (filling and stroking), and
>> trapezoids for reliefs are drawn using cairo by hooking the
>> corresponding drawing routine calls in xterm.c.  They use X11 GC
>> (with extension data) for colors and clipping rectangles, but
>> operations on them can easily be ported to non-X11 (e.g.,
>> terminal-only) environments just like the Carbon port.
>> 
>> * Images could also be drawn with cairo, but I didn't do that
>> because the image drawing in xterm.c depends on X-specific data
>> structures.  As a result, you can't see any images in the exported
>> screenshot as of now.

> Does this work on w32?

No.  Because I hooked to the drawing routine calls in xterm.c to
minimize the changes as the first step, which is intended for doing
some experiments whether cairo is useful for printing in Emacs.

If it is proved to be useful, then the next step would be to introduce
page-device frames in contrast to the existing screen-device frames,
so as to make the cairo drawing work without window systems.  That's
why I mentioned X-specific data structures above.  As seen by the size
of the changes to xterm.c, core drawing code can be shared between
these different types of frames.

Actually, the design of the cairo patch is based on that of the
Carbon(+AppKit) port.  The work of rewriting from Xlib to cairo was
very similar to that from QuickDraw to Quartz 2D.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp




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

* Re: Printing
  2009-04-04  0:00                                   ` Printing Lennart Borgman
  2009-04-04  0:36                                     ` Printing Stefan Monnier
@ 2009-04-04  8:57                                     ` Eli Zaretskii
  2009-04-04  9:22                                       ` Printing Lennart Borgman
  1 sibling, 1 reply; 147+ messages in thread
From: Eli Zaretskii @ 2009-04-04  8:57 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: tomas, monnier, emacs-devel

> Date: Sat, 4 Apr 2009 02:00:00 +0200
> From: Lennart Borgman <lennart.borgman@gmail.com>
> Cc: tomas@tuxteam.de, Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> 
> On Thu, Apr 2, 2009 at 10:56 PM, Lennart Borgman
> <lennart.borgman@gmail.com> wrote:
> > An easy way would perhaps be to write a temporary pdf-file and then
> > call w32-shell-execute on that file with "print" as the operation.
> 
> Just tested with
> 
>   (w32-shell-execute "print" "MY-PDF-FILE")
> 
> This just sends the file MY-PDF-FILE to the printer with Acrobat.
> Could perhaps someone test with GhostScript?

Test what?  The Emacs manual already says how to set up Emacs for
printing with Ghostscript; please see the node "Windows Printing".
The setup described there worked last time I tested it.




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

* Re: Printing
  2009-04-04  8:57                                     ` Printing Eli Zaretskii
@ 2009-04-04  9:22                                       ` Lennart Borgman
  2009-04-04  9:49                                         ` Printing Eli Zaretskii
  0 siblings, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2009-04-04  9:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: tomas, monnier, emacs-devel

On Sat, Apr 4, 2009 at 10:57 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Sat, 4 Apr 2009 02:00:00 +0200
>> From: Lennart Borgman <lennart.borgman@gmail.com>
>> Cc: tomas@tuxteam.de, Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
>>
>> On Thu, Apr 2, 2009 at 10:56 PM, Lennart Borgman
>> <lennart.borgman@gmail.com> wrote:
>> > An easy way would perhaps be to write a temporary pdf-file and then
>> > call w32-shell-execute on that file with "print" as the operation.
>>
>> Just tested with
>>
>>   (w32-shell-execute "print" "MY-PDF-FILE")
>>
>> This just sends the file MY-PDF-FILE to the printer with Acrobat.
>> Could perhaps someone test with GhostScript?
>
> Test what?

If the above works with GhostScript.

> The Emacs manual already says how to set up Emacs for
> printing with Ghostscript; please see the node "Windows Printing".
> The setup described there worked last time I tested it.
>
>
>




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

* Re: Printing
  2009-04-04  2:44       ` Printing YAMAMOTO Mitsuharu
  2009-04-04  6:54         ` Printing Lennart Borgman
@ 2009-04-04  9:40         ` Leo
  2009-04-04 22:00         ` Printing Richard M Stallman
                           ` (2 subsequent siblings)
  4 siblings, 0 replies; 147+ messages in thread
From: Leo @ 2009-04-04  9:40 UTC (permalink / raw)
  To: emacs-devel

On 2009-04-04 03:44 +0100, YAMAMOTO Mitsuharu wrote:
[...]
> Here's the patch for the Emacs 23.0.92 pretest (not the trunk HEAD).
>
> * No configure support.  The easiest way would be to compile it with
>   the GTK+ support that is already linked with cairo libs.  Add
>   -DUSE_CAIRO to CFLAGS to activate the cairo code.
>
> * With an experimental function (x-export-frame-image FRAME TYPE), you
>   can get the current FRAME screenshot as a unibyte string in TYPE
>   format.  TYPE can be 'pdf, 'ps, 'png, or 'svg if the installed cairo
>   supports their formats.
>
> * Currently, texts, rectangles (filling and stroking), and trapezoids
>   for reliefs are drawn using cairo by hooking the corresponding
>   drawing routine calls in xterm.c.  They use X11 GC (with extension
>   data) for colors and clipping rectangles, but operations on them can
>   easily be ported to non-X11 (e.g., terminal-only) environments just
>   like the Carbon port.
>
> * Images could also be drawn with cairo, but I didn't do that because
>   the image drawing in xterm.c depends on X-specific data structures.
>   As a result, you can't see any images in the exported screenshot as
>   of now.
>
> * Stipples are ignored (both on screen and exported one).
>
> * Exported png images seem to be incorrect in some cases.  I suspect
>   it has something to do with cairo's cluttering the activated FT_Size
>   mentioned in ftcrfont.c, but I'm not sure.
>
> 				     YAMAMOTO Mitsuharu
> 				mituharu@math.s.chiba-u.ac.jp

This is a giant step forward.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.

               www.git-scm.com
    git - the one true version control system





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

* Re: Printing
  2009-04-04  9:22                                       ` Printing Lennart Borgman
@ 2009-04-04  9:49                                         ` Eli Zaretskii
  0 siblings, 0 replies; 147+ messages in thread
From: Eli Zaretskii @ 2009-04-04  9:49 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: tomas, monnier, emacs-devel

> Date: Sat, 4 Apr 2009 11:22:13 +0200
> From: Lennart Borgman <lennart.borgman@gmail.com>
> Cc: tomas@tuxteam.de, monnier@iro.umontreal.ca, emacs-devel@gnu.org
> 
> >> Just tested with
> >>
> >>   (w32-shell-execute "print" "MY-PDF-FILE")
> >>
> >> This just sends the file MY-PDF-FILE to the printer with Acrobat.
> >> Could perhaps someone test with GhostScript?
> >
> > Test what?
> 
> If the above works with GhostScript.

Like I said, how to set printing with Ghostscript is already explained
in the manual.  That setup uses a general Emacs infrastructure, not
the w32-specific w32-shell-execute.






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

* Re: Printing
  2009-04-04  2:44       ` Printing YAMAMOTO Mitsuharu
  2009-04-04  6:54         ` Printing Lennart Borgman
  2009-04-04  9:40         ` Printing Leo
@ 2009-04-04 22:00         ` Richard M Stallman
  2009-04-05  1:07           ` Printing YAMAMOTO Mitsuharu
  2009-04-06  8:03         ` Printing Kenichi Handa
  2009-04-07  9:46         ` Printing YAMAMOTO Mitsuharu
  4 siblings, 1 reply; 147+ messages in thread
From: Richard M Stallman @ 2009-04-04 22:00 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

The code looks fairly clean, but it totally lacks comments.
It needs to have full and clear comments before it is installed.




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

* Re: Printing
  2009-04-04 22:00         ` Printing Richard M Stallman
@ 2009-04-05  1:07           ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-04-05  1:07 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>>>>> On Sat, 04 Apr 2009 18:00:49 -0400, Richard M Stallman <rms@gnu.org> said:

> The code looks fairly clean, but it totally lacks comments.  It
> needs to have full and clear comments before it is installed.

It's not intended as something to be installed at all, but an
experimental one to see if it's worth going forward.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp




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

* Re: Printing
  2009-04-04  2:44       ` Printing YAMAMOTO Mitsuharu
                           ` (2 preceding siblings ...)
  2009-04-04 22:00         ` Printing Richard M Stallman
@ 2009-04-06  8:03         ` Kenichi Handa
  2009-04-06  8:45           ` Printing YAMAMOTO Mitsuharu
  2009-04-07  9:46         ` Printing YAMAMOTO Mitsuharu
  4 siblings, 1 reply; 147+ messages in thread
From: Kenichi Handa @ 2009-04-06  8:03 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

In article <wlab6xuohg.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

> > I tried making a really preliminary proof-of-concept cairo port. :-)
> > It's still rough and has several glitches/limitations, but at least
> > it can generate a "resolution-independent screenshot" PDF as
> > attached.  Maybe I'll clean up the code this weekend and hopefully
> > post a patch.

> Here's the patch for the Emacs 23.0.92 pretest (not the trunk HEAD).

As your patch contains fixes to ftfont.c:

[...]
! 	if (FT_Load_Char (ft_face, i, FT_LOAD_DEFAULT) == 0)
[...]
!       font->underline_thickness = ft_face->underline_thickness * size / upEM;

I've just comitted those changes.  Thank you for finding
them.  Does the patch contain any other fixes?

---
Kenichi Handa
handa@m17n.org




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

* Re: Printing
  2009-04-06  8:03         ` Printing Kenichi Handa
@ 2009-04-06  8:45           ` YAMAMOTO Mitsuharu
  2009-04-06 11:47             ` Printing Kenichi Handa
  0 siblings, 1 reply; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-04-06  8:45 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

>>>>> On Mon, 06 Apr 2009 17:03:18 +0900, Kenichi Handa <handa@m17n.org> said:

> [...]
> ! 	if (FT_Load_Char (ft_face, i, FT_LOAD_DEFAULT) == 0)
> [...]
> !       font->underline_thickness = ft_face->underline_thickness * size / upEM;

> I've just comitted those changes.  Thank you for finding
> them.  Does the patch contain any other fixes?

Not in the patch, but I can find a similar code in xftfont.c for the
latter.  And maybe

  XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
		  x, y - font->ascent, width, y + font->descent);

in ftxfont_draw_backgrond (sic) should be

  XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
		  x, y - FONT_BASE (font), width, FONT_HEIGHT (font));

What do you think about the use of GC extension data in the patch?  It
allows us to extract information about clipping rectangles not from
struct glyph_string but from GC without using a wrapper.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp




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

* Re: Printing
  2009-04-06  8:45           ` Printing YAMAMOTO Mitsuharu
@ 2009-04-06 11:47             ` Kenichi Handa
  2009-04-06 23:47               ` Printing YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 147+ messages in thread
From: Kenichi Handa @ 2009-04-06 11:47 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

In article <wld4bqcgs2.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

> Not in the patch, but I can find a similar code in xftfont.c for the
> latter.  And maybe

>   XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
> 		  x, y - font->ascent, width, y + font->descent);

> in ftxfont_draw_backgrond (sic) should be

>   XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
> 		  x, y - FONT_BASE (font), width, FONT_HEIGHT (font));

Thank you.  I've just fixed them.

> What do you think about the use of GC extension data in the patch?  It
> allows us to extract information about clipping rectangles not from
> struct glyph_string but from GC without using a wrapper.

Sorry but I don't have a time to read your code in detail.
Could you explain why using GC extension data is better than
(struct glyphs_string *)->clip?

---
Kenichi Handa
handa@m17n.org




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

* Re: Printing
  2009-04-06 11:47             ` Printing Kenichi Handa
@ 2009-04-06 23:47               ` YAMAMOTO Mitsuharu
  2009-04-07  1:01                 ` Printing Kenichi Handa
  0 siblings, 1 reply; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-04-06 23:47 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

>>>>> On Mon, 06 Apr 2009 20:47:28 +0900, Kenichi Handa <handa@m17n.org> said:

>> What do you think about the use of GC extension data in the patch?
>> It allows us to extract information about clipping rectangles not
>> from struct glyph_string but from GC without using a wrapper.

> Sorry but I don't have a time to read your code in detail.  Could
> you explain why using GC extension data is better than (struct
> glyphs_string *)->clip?

I guess you introduced the members for clipping rectangles in struct
glyph_string because we can't extract such information, which is
necessary for text drawing, from the raw GC.  In the case of cairo
drawing, such information is also necessary for almost all kinds of
drawing, and the use of GC extension data allows us to extract
clipping rectangles without introducing a wrapper data structure of GC
(though we need a couple of wrapper functions,
x_(re)set_clip_rectangles).  This strategy can also be applied to the
existing text drawing routines.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp




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

* Re: Printing
  2009-04-06 23:47               ` Printing YAMAMOTO Mitsuharu
@ 2009-04-07  1:01                 ` Kenichi Handa
  2009-04-07  1:14                   ` Printing YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 147+ messages in thread
From: Kenichi Handa @ 2009-04-07  1:01 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

In article <wlhc119wf2.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

> > Sorry but I don't have a time to read your code in detail.  Could
> > you explain why using GC extension data is better than (struct
> > glyphs_string *)->clip?

> I guess you introduced the members for clipping rectangles in struct
> glyph_string because we can't extract such information, which is
> necessary for text drawing, from the raw GC.

Yes.

> In the case of cairo
> drawing, such information is also necessary for almost all kinds of
> drawing, and the use of GC extension data allows us to extract
> clipping rectangles without introducing a wrapper data structure of GC
> (though we need a couple of wrapper functions,
> x_(re)set_clip_rectangles).  

That doesn't answer my question.  As I now don't remember
well when and how it is used, just by reading your comment,
I don't understand what is the problem of using (struct
glyphs_string *)->clip, and how using GC extention data
solves it.

---
Kenichi Handa
handa@m17n.org






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

* Re: Printing
  2009-04-07  1:01                 ` Printing Kenichi Handa
@ 2009-04-07  1:14                   ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-04-07  1:14 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

>>>>> On Tue, 07 Apr 2009 10:01:46 +0900, Kenichi Handa <handa@m17n.org> said:

>> In the case of cairo drawing, such information is also necessary
>> for almost all kinds of drawing, and the use of GC extension data
>> allows us to extract clipping rectangles without introducing a
>> wrapper data structure of GC (though we need a couple of wrapper
>> functions, x_(re)set_clip_rectangles).

> That doesn't answer my question.  As I now don't remember well when
> and how it is used, just by reading your comment, I don't understand
> what is the problem of using (struct glyphs_string *)->clip, and how
> using GC extention data solves it.

Not a problem, but just a matter of uniformity.  Even in the current
xterm.c, colors and clipping information is managed by GC for drawings
except texts.  The use of GC extension data enables us to get rid of
this special treatment for text drawings.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp




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

* Re: Printing
  2009-04-04  2:44       ` Printing YAMAMOTO Mitsuharu
                           ` (3 preceding siblings ...)
  2009-04-06  8:03         ` Printing Kenichi Handa
@ 2009-04-07  9:46         ` YAMAMOTO Mitsuharu
  2009-04-08  1:33           ` Printing Kenichi Handa
  2009-04-19 10:21           ` Printing YAMAMOTO Mitsuharu
  4 siblings, 2 replies; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-04-07  9:46 UTC (permalink / raw)
  To: emacs-devel

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

>>>>> On Sat, 04 Apr 2009 11:44:27 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:

>> I tried making a really preliminary proof-of-concept cairo port. :-)
>> It's still rough and has several glitches/limitations, but at least
>> it can generate a "resolution-independent screenshot" PDF as
>> attached.  Maybe I'll clean up the code this weekend and hopefully
>> post a patch.

> Here's the patch for the Emacs 23.0.92 pretest (not the trunk HEAD).

> * Currently, texts, rectangles (filling and stroking), and trapezoids
>   for reliefs are drawn using cairo by hooking the corresponding
>   drawing routine calls in xterm.c.  They use X11 GC (with extension
>   data) for colors and clipping rectangles, but operations on them can
>   easily be ported to non-X11 (e.g., terminal-only) environments just
>   like the Carbon port.

> * Images could also be drawn with cairo, but I didn't do that because
>   the image drawing in xterm.c depends on X-specific data structures.
>   As a result, you can't see any images in the exported screenshot as
>   of now.

I added fringe bitmap drawing with cairo because it can be added
without using X-specific data structures.

Handa-san, could you check if the following change to ftfont.c is
correct?  It is also included in the revised patch below.

*************** ftfont_text_extents (font, code, nglyphs
*** 1255,1261 ****
  		  metrics->lbearing = m->horiBearingX >> 6;
  		  metrics->rbearing = (m->horiBearingX + m->width) >> 6;
  		  metrics->ascent = m->horiBearingY >> 6;
! 		  metrics->descent = (m->horiBearingY + m->height) >> 6;
  		}
  	      first = 0;
  	    }
--- 1255,1261 ----
  		  metrics->lbearing = m->horiBearingX >> 6;
  		  metrics->rbearing = (m->horiBearingX + m->width) >> 6;
  		  metrics->ascent = m->horiBearingY >> 6;
! 		  metrics->descent = (m->height - m->horiBearingY) >> 6;
  		}
  	      first = 0;
  	    }
*************** ftfont_text_extents (font, code, nglyphs
*** 1269,1276 ****
  		  = width + ((m->horiBearingX + m->width) >> 6);
  	      if (metrics->ascent < (m->horiBearingY >> 6))
  		metrics->ascent = m->horiBearingY >> 6;
! 	      if (metrics->descent > ((m->horiBearingY + m->height) >> 6))
! 		metrics->descent = (m->horiBearingY + m->height) >> 6;
  	    }
  	  width += m->horiAdvance >> 6;
  	}
--- 1269,1276 ----
  		  = width + ((m->horiBearingX + m->width) >> 6);
  	      if (metrics->ascent < (m->horiBearingY >> 6))
  		metrics->ascent = m->horiBearingY >> 6;
! 	      if (metrics->descent < ((m->height - m->horiBearingY) >> 6))
! 		metrics->descent = (m->height - m->horiBearingY) >> 6;
  	    }
  	  width += m->horiAdvance >> 6;
  	}

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

[-- Attachment #2: emacs-23.0.92-cairo.patch.gz --]
[-- Type: application/octet-stream, Size: 13784 bytes --]

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

* Re: Printing
  2009-04-07  9:46         ` Printing YAMAMOTO Mitsuharu
@ 2009-04-08  1:33           ` Kenichi Handa
  2009-05-01 23:30             ` Printing YAMAMOTO Mitsuharu
  2009-04-19 10:21           ` Printing YAMAMOTO Mitsuharu
  1 sibling, 1 reply; 147+ messages in thread
From: Kenichi Handa @ 2009-04-08  1:33 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

In article <wl1vs4iyp2.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

> Handa-san, could you check if the following change to ftfont.c is
> correct?  It is also included in the revised patch below.

Thank you.  Those changes are correct.  I've just committed them.

> *************** ftfont_text_extents (font, code, nglyphs
> *** 1255,1261 ****
>   		  metrics->lbearing = m->horiBearingX >> 6;
>   		  metrics->rbearing = (m->horiBearingX + m->width) >> 6;
>   		  metrics->ascent = m->horiBearingY >> 6;
> ! 		  metrics->descent = (m->horiBearingY + m->height) >> 6;
>   		}
>   	      first = 0;
>   	    }
> --- 1255,1261 ----
>   		  metrics->lbearing = m->horiBearingX >> 6;
>   		  metrics->rbearing = (m->horiBearingX + m->width) >> 6;
>   		  metrics->ascent = m->horiBearingY >> 6;
> ! 		  metrics->descent = (m->height - m->horiBearingY) >> 6;
>   		}
>   	      first = 0;
>   	    }
> *************** ftfont_text_extents (font, code, nglyphs
> *** 1269,1276 ****
>   		  = width + ((m->horiBearingX + m->width) >> 6);
>   	      if (metrics->ascent < (m->horiBearingY >> 6))
>   		metrics->ascent = m->horiBearingY >> 6;
> ! 	      if (metrics->descent > ((m->horiBearingY + m->height) >> 6))
> ! 		metrics->descent = (m->horiBearingY + m->height) >> 6;
>   	    }
>   	  width += m->horiAdvance >> 6;
>   	}
> --- 1269,1276 ----
>   		  = width + ((m->horiBearingX + m->width) >> 6);
>   	      if (metrics->ascent < (m->horiBearingY >> 6))
>   		metrics->ascent = m->horiBearingY >> 6;
> ! 	      if (metrics->descent < ((m->height - m->horiBearingY) >> 6))
> ! 		metrics->descent = (m->height - m->horiBearingY) >> 6;
>   	    }
>   	  width += m->horiAdvance >> 6;
>   	}

---
Kenichi Handa
handa@m17n.org




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

* Re: Printing
  2009-04-07  9:46         ` Printing YAMAMOTO Mitsuharu
  2009-04-08  1:33           ` Printing Kenichi Handa
@ 2009-04-19 10:21           ` YAMAMOTO Mitsuharu
  2012-05-05  3:06             ` Printing Stefan Monnier
  1 sibling, 1 reply; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-04-19 10:21 UTC (permalink / raw)
  To: emacs-devel

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

>>>>> On Tue, 07 Apr 2009 18:46:01 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:

>>> I tried making a really preliminary proof-of-concept cairo port. :-)
>>> It's still rough and has several glitches/limitations, but at least
>>> it can generate a "resolution-independent screenshot" PDF as
>>> attached.  Maybe I'll clean up the code this weekend and hopefully
>>> post a patch.

>> Here's the patch for the Emacs 23.0.92 pretest (not the trunk HEAD).

>> * No configure support.  The easiest way would be to compile it with
>>   the GTK+ support that is already linked with cairo libs.  Add
>>   -DUSE_CAIRO to CFLAGS to activate the cairo code.

>> * Currently, texts, rectangles (filling and stroking), and trapezoids
>>  for reliefs are drawn using cairo by hooking the corresponding
>>  drawing routine calls in xterm.c.

This time, I combined the cairo drawing code with GTK+ print dialogs
code, which is actually almost the same as examples in the GTK+
reference.  The added primitives are:

(x-page-setup-dialog): Pop up a page setup dialog.
(x-get-page-setup): Return the value of the current page setup.
  It returns an alist like
  ((orientation . portrait)
   (width . 559.2755905511812) (height . 783.5697637795276)
   (left-margin . 18.0) (right-margin . 18.0)
   (top-margin . 18.0) (bottom-margin . 40.32000000000001))
(x-print-frames-dialog FRAMES): Pop up a print dialog to print the
  current contents of FRAMES.

The last one is intended to be called after some pagination (in Lisp)
that creates a frame per page.  Below is a simple example.

(defun test-print-buffer (buffer-or-name)
  "Paginate and print buffer contents."
  (interactive "bBuffer to export:")
  (with-current-buffer buffer-or-name
    (let* ((buffer (current-buffer))
	   (start-pos (point-min))
	   (end-pos (point-max))
	   (page-setup (if (fboundp 'x-get-page-setup)
			   (x-get-page-setup)
			 '((width . 559.0) (height . 783.0))))
	   (width-in-points (cdr (assq 'width page-setup)))
	   (height-in-points (cdr (assq 'height page-setup)))
	   buffers frames)
      (unwind-protect
	  (progn
	    (with-selected-frame (selected-frame)
	      ;; Paginate and create a frame for each page.
	      (while (< start-pos end-pos)
		(let ((inhibit-quit t))
		  (set-buffer
		   (make-indirect-buffer
		    buffer (generate-new-buffer-name (buffer-name buffer)) t))
		  (push (current-buffer) buffers)
		  (setq kill-buffer-hook nil) ;; XXX
		  (select-frame (make-frame
				 '((internal-border-width . 0)
				   (vertical-scroll-bars . nil)
				   (left-fringe . 0) (right-fringe . 0)
				   (menu-bar-lines . 0) (tool-bar-lines . 0)
				   (line-spacing . 0)
				   (minibuffer . nil) (visibility . nil)
				   (cursor-type . nil)))
				'norecord)
		  (push (selected-frame) frames))
		(set-frame-size (selected-frame)
				(floor (/ width-in-points (frame-char-width)))
				(floor (/ height-in-points (frame-char-height))))
		(setq header-line-format nil)
		(setq mode-line-format nil)
		(set-window-start nil start-pos)
		(goto-char (window-end nil t))
		(while (and (< start-pos (point))
			    (not (pos-visible-in-window-p (1- (point)))))
		  (backward-char))
		(narrow-to-region start-pos (point))
		(setq start-pos (point))))
	    ;; Print the frames.
	    (if (null frames)
		(error "Buffer %s is empty" buffer-or-name)
	      (mapc 'make-frame-visible frames)
	      (if (fboundp 'x-print-frames-dialog)
		  (x-print-frames-dialog (reverse frames))
		;; Dummy stub just to reproduce an intermittent error
		;; in x-print-frames-dialog even without it.
		(dolist (frame frames)
		  (unless (eq (frame-visible-p frame) t)
		    (error "Frames to be printed must be visible.")))
		(redisplay t))))
	;; Clean up
	(mapc 'delete-frame frames)
	(mapc 'kill-buffer buffers)))))

You can try printing with M-x test-print-buffer RET.  Because the
current cairo drawing routines are hooked onto those in xterm.c in
order to minimize the change, you'll see the actual frames on screen.
Moreover, you might get an incorrect printed result because your
window manager may clip the frames to fit in the screen size.
Nevertheless, I think you can get the basic idea with this sample
code.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

[-- Attachment #2: emacs-23.0.92-cairo.patch.gz --]
[-- Type: application/octet-stream, Size: 17848 bytes --]

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

* Re: Printing
  2009-04-08  1:33           ` Printing Kenichi Handa
@ 2009-05-01 23:30             ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-05-01 23:30 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

>>>>> On Wed, 08 Apr 2009 10:33:59 +0900, Kenichi Handa <handa@m17n.org> said:

> In article <wl1vs4iyp2.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:
>> Handa-san, could you check if the following change to ftfont.c is
>> correct?  It is also included in the revised patch below.

> Thank you.  Those changes are correct.  I've just committed them.

I've just found the following part was partially applied.  Could you
check the direction of the inequality in the if-condition?

> *************** ftfont_text_extents (font, code, nglyphs
> *** 1269,1276 ****
>   		  = width + ((m->horiBearingX + m->width) >> 6);
>   	      if (metrics->ascent < (m->horiBearingY >> 6))
>   		metrics->ascent = m->horiBearingY >> 6;
> ! 	      if (metrics->descent > ((m->horiBearingY + m->height) >> 6))
> ! 		metrics->descent = (m->horiBearingY + m->height) >> 6;
>   	    }
>   	  width += m->horiAdvance >> 6;
>   	}
> --- 1269,1276 ----
>   		  = width + ((m->horiBearingX + m->width) >> 6);
>   	      if (metrics->ascent < (m->horiBearingY >> 6))
>   		metrics->ascent = m->horiBearingY >> 6;
> ! 	      if (metrics->descent < ((m->height - m->horiBearingY) >> 6))
> ! 		metrics->descent = (m->height - m->horiBearingY) >> 6;
>   	    }
>   	  width += m->horiAdvance >> 6;
>   	}

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp




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

* Re: Printing
  2009-04-19 10:21           ` Printing YAMAMOTO Mitsuharu
@ 2012-05-05  3:06             ` Stefan Monnier
  2012-05-07  3:38               ` Printing YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 147+ messages in thread
From: Stefan Monnier @ 2012-05-05  3:06 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

Hi,

I'd be interested to see this pushed further.  Maybe you could make
a branch in the bzr repository for it?


        Stefan


>>>>> "YAMAMOTO" == YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

>>>>> On Tue, 07 Apr 2009 18:46:01 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:

>>>> I tried making a really preliminary proof-of-concept cairo port. :-)
>>>> It's still rough and has several glitches/limitations, but at least
>>>> it can generate a "resolution-independent screenshot" PDF as
>>>> attached.  Maybe I'll clean up the code this weekend and hopefully
>>>> post a patch.

>>> Here's the patch for the Emacs 23.0.92 pretest (not the trunk HEAD).

>>> * No configure support.  The easiest way would be to compile it with
>>> the GTK+ support that is already linked with cairo libs.  Add
>>> -DUSE_CAIRO to CFLAGS to activate the cairo code.

>>> * Currently, texts, rectangles (filling and stroking), and trapezoids
>>> for reliefs are drawn using cairo by hooking the corresponding
>>> drawing routine calls in xterm.c.

> This time, I combined the cairo drawing code with GTK+ print dialogs
> code, which is actually almost the same as examples in the GTK+
> reference.  The added primitives are:

> (x-page-setup-dialog): Pop up a page setup dialog.
> (x-get-page-setup): Return the value of the current page setup.
>   It returns an alist like
>   ((orientation . portrait)
>    (width . 559.2755905511812) (height . 783.5697637795276)
>    (left-margin . 18.0) (right-margin . 18.0)
>    (top-margin . 18.0) (bottom-margin . 40.32000000000001))
> (x-print-frames-dialog FRAMES): Pop up a print dialog to print the
>   current contents of FRAMES.

> The last one is intended to be called after some pagination (in Lisp)
> that creates a frame per page.  Below is a simple example.

> (defun test-print-buffer (buffer-or-name)
>   "Paginate and print buffer contents."
>   (interactive "bBuffer to export:")
>   (with-current-buffer buffer-or-name
>     (let* ((buffer (current-buffer))
> 	   (start-pos (point-min))
> 	   (end-pos (point-max))
> 	   (page-setup (if (fboundp 'x-get-page-setup)
> 			   (x-get-page-setup)
> 			 '((width . 559.0) (height . 783.0))))
> 	   (width-in-points (cdr (assq 'width page-setup)))
> 	   (height-in-points (cdr (assq 'height page-setup)))
> 	   buffers frames)
>       (unwind-protect
> 	  (progn
> 	    (with-selected-frame (selected-frame)
> 	      ;; Paginate and create a frame for each page.
> 	      (while (< start-pos end-pos)
> 		(let ((inhibit-quit t))
> 		  (set-buffer
> 		   (make-indirect-buffer
> 		    buffer (generate-new-buffer-name (buffer-name buffer)) t))
> 		  (push (current-buffer) buffers)
> 		  (setq kill-buffer-hook nil) ;; XXX
> 		  (select-frame (make-frame
> 				 '((internal-border-width . 0)
> 				   (vertical-scroll-bars . nil)
> 				   (left-fringe . 0) (right-fringe . 0)
> 				   (menu-bar-lines . 0) (tool-bar-lines . 0)
> 				   (line-spacing . 0)
> 				   (minibuffer . nil) (visibility . nil)
> 				   (cursor-type . nil)))
> 				'norecord)
> 		  (push (selected-frame) frames))
> 		(set-frame-size (selected-frame)
> 				(floor (/ width-in-points (frame-char-width)))
> 				(floor (/ height-in-points (frame-char-height))))
> 		(setq header-line-format nil)
> 		(setq mode-line-format nil)
> 		(set-window-start nil start-pos)
> 		(goto-char (window-end nil t))
> 		(while (and (< start-pos (point))
> 			    (not (pos-visible-in-window-p (1- (point)))))
> 		  (backward-char))
> 		(narrow-to-region start-pos (point))
> 		(setq start-pos (point))))
> 	    ;; Print the frames.
> 	    (if (null frames)
> 		(error "Buffer %s is empty" buffer-or-name)
> 	      (mapc 'make-frame-visible frames)
> 	      (if (fboundp 'x-print-frames-dialog)
> 		  (x-print-frames-dialog (reverse frames))
> 		;; Dummy stub just to reproduce an intermittent error
> 		;; in x-print-frames-dialog even without it.
> 		(dolist (frame frames)
> 		  (unless (eq (frame-visible-p frame) t)
> 		    (error "Frames to be printed must be visible.")))
> 		(redisplay t))))
> 	;; Clean up
> 	(mapc 'delete-frame frames)
> 	(mapc 'kill-buffer buffers)))))

> You can try printing with M-x test-print-buffer RET.  Because the
> current cairo drawing routines are hooked onto those in xterm.c in
> order to minimize the change, you'll see the actual frames on screen.
> Moreover, you might get an incorrect printed result because your
> window manager may clip the frames to fit in the screen size.
> Nevertheless, I think you can get the basic idea with this sample
> code.

> 				     YAMAMOTO Mitsuharu
> 				mituharu@math.s.chiba-u.ac.jp




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

* Re: Printing
  2012-05-05  3:06             ` Printing Stefan Monnier
@ 2012-05-07  3:38               ` YAMAMOTO Mitsuharu
  2012-05-07 11:25                 ` Printing Lennart Borgman
  2012-05-07 12:46                 ` Printing Stefan Monnier
  0 siblings, 2 replies; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2012-05-07  3:38 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

>>>>> On Fri, 04 May 2012 23:06:43 -0400, Stefan Monnier <monnier@iro.umontreal.ca> said:

> Hi, I'd be interested to see this pushed further.  Maybe you could
> make a branch in the bzr repository for it?

Perhaps I'll work a bit locally first, starting with adding a new type
of (output-only) graphical terminal for printing.  The idea is to add
a printing support via cairo without being tied with a particular
window system.

Is anyone already working for supporting multiple types of graphical
terminals simultaneously?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp



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

* Re: Printing
  2012-05-07  3:38               ` Printing YAMAMOTO Mitsuharu
@ 2012-05-07 11:25                 ` Lennart Borgman
  2012-05-08  1:04                   ` Printing YAMAMOTO Mitsuharu
  2012-05-09 14:50                   ` Printing Jason Rumney
  2012-05-07 12:46                 ` Printing Stefan Monnier
  1 sibling, 2 replies; 147+ messages in thread
From: Lennart Borgman @ 2012-05-07 11:25 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: Stefan Monnier, emacs-devel

On Mon, May 7, 2012 at 5:38 AM, YAMAMOTO Mitsuharu
<mituharu@math.s.chiba-u.ac.jp> wrote:
>>>>>> On Fri, 04 May 2012 23:06:43 -0400, Stefan Monnier <monnier@iro.umontreal.ca> said:
>
>> Hi, I'd be interested to see this pushed further.  Maybe you could
>> make a branch in the bzr repository for it?
>
> Perhaps I'll work a bit locally first, starting with adding a new type
> of (output-only) graphical terminal for printing.  The idea is to add
> a printing support via cairo without being tied with a particular
> window system.
>
> Is anyone already working for supporting multiple types of graphical
> terminals simultaneously?

Is Cairo enough to make a general printing system? Should not the
abstraction be on a higher level so that different OS:es can be
supported?



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

* Re: Printing
  2012-05-07  3:38               ` Printing YAMAMOTO Mitsuharu
  2012-05-07 11:25                 ` Printing Lennart Borgman
@ 2012-05-07 12:46                 ` Stefan Monnier
  2012-05-07 13:07                   ` Printing joakim
  2012-05-07 17:20                   ` Printing Simon Leinen
  1 sibling, 2 replies; 147+ messages in thread
From: Stefan Monnier @ 2012-05-07 12:46 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: Simon Leinen, emacs-devel

[ Hi Simon! ]

> Is anyone already working for supporting multiple types of graphical
> terminals simultaneously?

Simon Leinen wanted to work on this a while ago, but I haven't heard
back from him about it, so I expect he was sufficiently busy with other
problems

It would be a great to be able to use a single Emacs that can display on
a w32 display as well as X11 remote displays.


        Stefan



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

* Re: Printing
  2012-05-07 12:46                 ` Printing Stefan Monnier
@ 2012-05-07 13:07                   ` joakim
  2012-05-07 17:20                   ` Printing Simon Leinen
  1 sibling, 0 replies; 147+ messages in thread
From: joakim @ 2012-05-07 13:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Simon Leinen, YAMAMOTO Mitsuharu, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> [ Hi Simon! ]
>
>> Is anyone already working for supporting multiple types of graphical
>> terminals simultaneously?

I'm also interested in this area.

The Emacs Xwidget branch has a proof-of-concept Cairo widget that can be
embedded in an Emacs buffer. There is also a POC Clutter widget. (there
isnt really much of an api to talk to these widgets yet, instead I
focused on the embeddable webkit widget)

Anyhow, a full blown Cairo port would be much more interesting of
course, but perhaps the concepts could be combined. 


>
> Simon Leinen wanted to work on this a while ago, but I haven't heard
> back from him about it, so I expect he was sufficiently busy with other
> problems
>
> It would be a great to be able to use a single Emacs that can display on
> a w32 display as well as X11 remote displays.
>
>
>         Stefan

-- 
Joakim Verona



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

* Re: Printing
  2012-05-07 12:46                 ` Printing Stefan Monnier
  2012-05-07 13:07                   ` Printing joakim
@ 2012-05-07 17:20                   ` Simon Leinen
  2012-05-08  1:11                     ` Printing YAMAMOTO Mitsuharu
  1 sibling, 1 reply; 147+ messages in thread
From: Simon Leinen @ 2012-05-07 17:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: YAMAMOTO Mitsuharu, emacs-devel

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

>
> > Is anyone already working for supporting multiple types of graphical
> > terminals simultaneously?
>
> Simon Leinen wanted to work on this a while ago, but I haven't heard
> back from him about it, so I expect he was sufficiently busy with other
> problems
>

Unfortunately that's exactly true.  I never really got started with it, and
won't get to it in the near or medium future.  However I'm more than
willing to help test this if someone does start implementing this.

It would be a great to be able to use a single Emacs that can display on
> a w32 display as well as X11 remote displays.
>

For me the motivation was similar (except Mac/NextStep instead of w32), but
my current workaround is to just use X11 on the Mac.  Improved
TTY/X11(/...) coexistence could be another benefit.

I allow myself to quote some useful hints from a private mail you sent me
then (almost three years ago):

Stefan> It'd would be a good change, yes.   I don't think anybody has
started
Stefan> working on that (the same holds for w32+X11).
Stefan> IIUC, the work necessary to get it to work is as follows:
Stefan> - handle all the necessary renaming (many C functions have the same
name
Stefan>   in the different backends).  This may require introducing some
Stefan>   additional indirections to dynamically decide which of the backend
Stefan>   functions to use.  We already have such indirections (to choose
betwen
Stefan>   ty and GUI code), so most of the infrastructure should be there
Stefan>   already, but there's most likely still some things missing,
especially
Stefan>   for the features which don't exist under ttys.
Stefan> - change the various #ifdefs so that more than one of each GUI's
code
Stefan>   can be compiled in at the same time.
Stefan> - try and figure out what to do with all the remaining problems
(similar
Stefan>   to what you're saying about the indirect problems introduced by
the
Stefan>   multi-tty code, such as ssh-agent issues).  It'll probably be a
good
Stefan>   time to fix all the mess we still have around the "x-*" functions
Stefan>   (some of which are X11-specific but others aren't).

Best regards,
-- 
Simon.

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

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

* Re: Printing
  2012-05-07 11:25                 ` Printing Lennart Borgman
@ 2012-05-08  1:04                   ` YAMAMOTO Mitsuharu
  2012-05-08  1:25                     ` Printing Lennart Borgman
  2012-05-09 14:50                   ` Printing Jason Rumney
  1 sibling, 1 reply; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2012-05-08  1:04 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Stefan Monnier, emacs-devel

>>>>> On Mon, 7 May 2012 13:25:23 +0200, Lennart Borgman <lennart.borgman@gmail.com> said:

>> Perhaps I'll work a bit locally first, starting with adding a new
>> type of (output-only) graphical terminal for printing.  The idea is
>> to add a printing support via cairo without being tied with a
>> particular window system.
>> 
>> Is anyone already working for supporting multiple types of
>> graphical terminals simultaneously?

> Is Cairo enough to make a general printing system? Should not the
> abstraction be on a higher level so that different OS:es can be
> supported?

Actually, the primary motivation of introducing a cairo terminal was
to support the generation of PDF data from the buffer contents
directly using the Emacs redisplay engine, even from a tty session
(i.e., without X server running), rather than supporting multiple
window systems.  Showing a print dialog, sending the output to a
printer, etc. will need another library or something, perhaps in a
window-system dependent way.

Do you possibly have some idea of "abstraction on a higher level"?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp



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

* Re: Printing
  2012-05-07 17:20                   ` Printing Simon Leinen
@ 2012-05-08  1:11                     ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2012-05-08  1:11 UTC (permalink / raw)
  To: Simon Leinen; +Cc: Stefan Monnier, emacs-devel

>>>>> On Mon, 7 May 2012 19:20:35 +0200, Simon Leinen <simon.leinen@gmail.com> said:

>>> Is anyone already working for supporting multiple types of
>>> graphical terminals simultaneously?

>> Simon Leinen wanted to work on this a while ago, but I haven't
>> heard back from him about it, so I expect he was sufficiently busy
>> with other problems

> Unfortunately that's exactly true.  I never really got started with
> it, and won't get to it in the near or medium future.  However I'm
> more than willing to help test this if someone does start
> implementing this.

>> It would be a great to be able to use a single Emacs that can
>> display on a w32 display as well as X11 remote displays.

> For me the motivation was similar (except Mac/NextStep instead of
> w32), but my current workaround is to just use X11 on the Mac.
> Improved TTY/X11(/...) coexistence could be another benefit.

> I allow myself to quote some useful hints from a private mail you
> sent me then (almost three years ago):

Thanks for the info.  I guess adding a new type of output-only
graphical terminal for printing is much easier than supporting
multiple types of GUI terminals, because we don't have to care about
event handling for the former.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp



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

* Re: Printing
  2012-05-08  1:04                   ` Printing YAMAMOTO Mitsuharu
@ 2012-05-08  1:25                     ` Lennart Borgman
  2012-05-08  2:15                       ` Printing YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 147+ messages in thread
From: Lennart Borgman @ 2012-05-08  1:25 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: Stefan Monnier, emacs-devel

On Tue, May 8, 2012 at 3:04 AM, YAMAMOTO Mitsuharu
<mituharu@math.s.chiba-u.ac.jp> wrote:
>>>>>> On Mon, 7 May 2012 13:25:23 +0200, Lennart Borgman <lennart.borgman@gmail.com> said:
>
>>> Perhaps I'll work a bit locally first, starting with adding a new
>>> type of (output-only) graphical terminal for printing.  The idea is
>>> to add a printing support via cairo without being tied with a
>>> particular window system.
>>>
>>> Is anyone already working for supporting multiple types of
>>> graphical terminals simultaneously?
>
>> Is Cairo enough to make a general printing system? Should not the
>> abstraction be on a higher level so that different OS:es can be
>> supported?
>
> Actually, the primary motivation of introducing a cairo terminal was
> to support the generation of PDF data from the buffer contents
> directly using the Emacs redisplay engine, even from a tty session
> (i.e., without X server running), rather than supporting multiple
> window systems.  Showing a print dialog, sending the output to a
> printer, etc. will need another library or something, perhaps in a
> window-system dependent way.
>
> Do you possibly have some idea of "abstraction on a higher level"?

Ah, I see. Did you consider the printing already available in nXhtml?
This makes html pages from buffers (and also from frames for other
purposes).



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

* Re: Printing
  2012-05-08  1:25                     ` Printing Lennart Borgman
@ 2012-05-08  2:15                       ` YAMAMOTO Mitsuharu
  2012-05-08 10:59                         ` Printing Lennart Borgman
  0 siblings, 1 reply; 147+ messages in thread
From: YAMAMOTO Mitsuharu @ 2012-05-08  2:15 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Stefan Monnier, emacs-devel

>>>>> On Tue, 8 May 2012 03:25:33 +0200, Lennart Borgman <lennart.borgman@gmail.com> said:

>> Actually, the primary motivation of introducing a cairo terminal
>> was to support the generation of PDF data from the buffer contents
>> directly using the Emacs redisplay engine, even from a tty session
>> (i.e., without X server running), rather than supporting multiple
>> window systems.  Showing a print dialog, sending the output to a
>> printer, etc. will need another library or something, perhaps in a
>> window-system dependent way.
>> 
>> Do you possibly have some idea of "abstraction on a higher level"?

> Ah, I see. Did you consider the printing already available in
> nXhtml?  This makes html pages from buffers (and also from frames
> for other purposes).

I've heard of the conversion from a buffer contents to html, but I
didn't know that it also supports the conversion from a frame.

Yes, conversion to html is useful and handy for many purposes.
Although the direct use of the Emacs redisplay engine in printing via
cairo has its strength in reproducibility of some peculiarities such
as compositions in Emacs display features, if people don't need them
in printing so much, then it might be rather overkill.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp




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

* Re: Printing
  2012-05-08  2:15                       ` Printing YAMAMOTO Mitsuharu
@ 2012-05-08 10:59                         ` Lennart Borgman
  0 siblings, 0 replies; 147+ messages in thread
From: Lennart Borgman @ 2012-05-08 10:59 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: Stefan Monnier, emacs-devel

On Tue, May 8, 2012 at 4:15 AM, YAMAMOTO Mitsuharu
<mituharu@math.s.chiba-u.ac.jp> wrote:
>>>>>> On Tue, 8 May 2012 03:25:33 +0200, Lennart Borgman <lennart.borgman@gmail.com> said:
>
>>> Actually, the primary motivation of introducing a cairo terminal
>>> was to support the generation of PDF data from the buffer contents
>>> directly using the Emacs redisplay engine, even from a tty session
>>> (i.e., without X server running), rather than supporting multiple
>>> window systems.  Showing a print dialog, sending the output to a
>>> printer, etc. will need another library or something, perhaps in a
>>> window-system dependent way.
>>>
>>> Do you possibly have some idea of "abstraction on a higher level"?
>
>> Ah, I see. Did you consider the printing already available in
>> nXhtml?  This makes html pages from buffers (and also from frames
>> for other purposes).
>
> I've heard of the conversion from a buffer contents to html, but I
> didn't know that it also supports the conversion from a frame.

That is just a minor convenience thing for those wanting to display
another type of screen shot.

> Yes, conversion to html is useful and handy for many purposes.
> Although the direct use of the Emacs redisplay engine in printing via
> cairo has its strength in reproducibility of some peculiarities such
> as compositions in Emacs display features, if people don't need them
> in printing so much, then it might be rather overkill.

If the goal is to produce a pdf file you can do that by first making a
html file and then display that in a web browser. From the web browser
you can then print or create a pdf.

What you get is just the buffer content (no extra headers or so), but
with colors.



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

* Re: Printing
  2012-05-07 11:25                 ` Printing Lennart Borgman
  2012-05-08  1:04                   ` Printing YAMAMOTO Mitsuharu
@ 2012-05-09 14:50                   ` Jason Rumney
  2012-05-09 14:58                     ` Printing Lennart Borgman
  1 sibling, 1 reply; 147+ messages in thread
From: Jason Rumney @ 2012-05-09 14:50 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Stefan Monnier, YAMAMOTO Mitsuharu, emacs-devel

Lennart Borgman <lennart.borgman@gmail.com> writes:

> Is Cairo enough to make a general printing system? Should not the
> abstraction be on a higher level so that different OS:es can be
> supported?

Cairo is portable to many OS:es.  Are there any in particular which you
are concerned about being left out?




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

* Re: Printing
  2012-05-09 14:50                   ` Printing Jason Rumney
@ 2012-05-09 14:58                     ` Lennart Borgman
  0 siblings, 0 replies; 147+ messages in thread
From: Lennart Borgman @ 2012-05-09 14:58 UTC (permalink / raw)
  To: Jason Rumney; +Cc: Stefan Monnier, YAMAMOTO Mitsuharu, emacs-devel

On Wed, May 9, 2012 at 4:50 PM, Jason Rumney <jasonr@gnu.org> wrote:
> Lennart Borgman <lennart.borgman@gmail.com> writes:
>
>> Is Cairo enough to make a general printing system? Should not the
>> abstraction be on a higher level so that different OS:es can be
>> supported?
>
> Cairo is portable to many OS:es.  Are there any in particular which you
> are concerned about being left out?

Do you mean it is available and in use on w32?



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

* Printing
@ 2016-03-03 14:35 Sharon Kimble
  2016-03-03 20:22 ` Printing tomas
  2016-03-05 13:40 ` Printing Robert Thorpe
  0 siblings, 2 replies; 147+ messages in thread
From: Sharon Kimble @ 2016-03-03 14:35 UTC (permalink / raw)
  To: help-gnu-emacs

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


I have this set in my 'init.org' -

--8<---------------cut here---------------start------------->8---
printing with gtklp
#+begin_src emacs-lisp
(setq lpr-command "gtklp")
(setq ps-lpr-command "gtklp")
#+end_src
[2016-01-13 Wed 11:11]
http://emacs.stackexchange.com/questions/9363/how-to-specify-a-printer
--8<---------------cut here---------------end--------------->8---

But when I print a letter it comes out with a 'raw' look, and a not very
nice typeface.

But if I use 'prettyprint' the typeface looks smaller and more
attractive - but - it also prints a header showing the filename and the
date and time of printing, which is not what I want.

How then can I have a 'prettyprint' typeface but without the file header
of buffer and print date and time please?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.3, fluxbox 1.3.7, emacs 25.0.92

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: Printing
  2016-03-03 14:35 Printing Sharon Kimble
@ 2016-03-03 20:22 ` tomas
  2016-03-05 13:40 ` Printing Robert Thorpe
  1 sibling, 0 replies; 147+ messages in thread
From: tomas @ 2016-03-03 20:22 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Mar 03, 2016 at 02:35:19PM +0000, Sharon Kimble wrote:
> 
> I have this set in my 'init.org' -
> 
> --8<---------------cut here---------------start------------->8---
> printing with gtklp
> #+begin_src emacs-lisp
> (setq lpr-command "gtklp")
> (setq ps-lpr-command "gtklp")
> #+end_src
> [2016-01-13 Wed 11:11]
> http://emacs.stackexchange.com/questions/9363/how-to-specify-a-printer
> --8<---------------cut here---------------end--------------->8---

I don't know very much about gtklp, but you could give

  M-x customize-group RET Lpr RET

a try. There are some options there related to page headers. Perhaps
gtklp understands options in a compatible way to lpr.

hth
- -- tomás 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlbYnQEACgkQBcgs9XrR2kb74QCfTPA29QUj8Dsz7t79DczTaTTt
GnQAmwbJpEckF9QivQZo2g3uAdRgoZE5
=7t8H
-----END PGP SIGNATURE-----



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

* Re: Printing
  2016-03-03 14:35 Printing Sharon Kimble
  2016-03-03 20:22 ` Printing tomas
@ 2016-03-05 13:40 ` Robert Thorpe
  1 sibling, 0 replies; 147+ messages in thread
From: Robert Thorpe @ 2016-03-05 13:40 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: help-gnu-emacs

Sharon Kimble <boudiccas@skimble.plus.com> writes:

> But if I use 'prettyprint' the typeface looks smaller and more
> attractive - but - it also prints a header showing the filename and the
> date and time of printing, which is not what I want.
>
> How then can I have a 'prettyprint' typeface but without the file header
> of buffer and print date and time please?

I have been having problems with pretty-print recently too.  I don't
know very much about how to customize it.  It seems that not many other
people know much about it either because my questions have been
unanswered.

If I find out more I'll tell you.

BR,
Robert Thorpe



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

* wie kann ich Emacs so einstellen, dass ich drucken kann
@ 2022-12-14 16:38 Gottfried
  2022-12-14 17:27 ` Philip Kaludercic
                   ` (2 more replies)
  0 siblings, 3 replies; 147+ messages in thread
From: Gottfried @ 2022-12-14 16:38 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 260 bytes --]

Hallo,
ich wollte einen Puffer ausdrucken (das erste Mal)
und es gab diese Fehlermeldung:

lpr-print-region: Spooling...done: /home/gfp/.guix-profile/bin/lpr: 
Fehler - Kein voreingestelltes Ziel.

Wie kann ich das Ziel einstellen?

danke
Gottfried

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-14 16:38 wie kann ich Emacs so einstellen, dass ich drucken kann Gottfried
@ 2022-12-14 17:27 ` Philip Kaludercic
  2022-12-16 15:27   ` printing Gottfried
  2022-12-14 21:30 ` wie kann ich Emacs so einstellen, dass ich drucken kann Michael Heerdegen
  2022-12-17  9:00 ` Jean Louis
  2 siblings, 1 reply; 147+ messages in thread
From: Philip Kaludercic @ 2022-12-14 17:27 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs@gnu.org

Gottfried <gottfried@posteo.de> writes:

> Hallo,
> ich wollte einen Puffer ausdrucken (das erste Mal)
> und es gab diese Fehlermeldung:
>
> lpr-print-region: Spooling...done: /home/gfp/.guix-profile/bin/lpr:
> Fehler - Kein voreingestelltes Ziel.
>
> Wie kann ich das Ziel einstellen?
>
> danke
> Gottfried

You have to take a look at `lpr-switches', and specifically figure out
what -P<printer name> flag to add, so that the "lpr" command knows where
you want to print.



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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-14 16:38 wie kann ich Emacs so einstellen, dass ich drucken kann Gottfried
  2022-12-14 17:27 ` Philip Kaludercic
@ 2022-12-14 21:30 ` Michael Heerdegen
  2022-12-17  9:00 ` Jean Louis
  2 siblings, 0 replies; 147+ messages in thread
From: Michael Heerdegen @ 2022-12-14 21:30 UTC (permalink / raw)
  To: help-gnu-emacs

Gottfried <gottfried@posteo.de> writes:

> Hallo,
> ich wollte einen Puffer ausdrucken (das erste Mal)

Bitte auch Alternativen in Erwägung ziehen wenn du dich nicht mit
Interna herumschlagen möchtest:

- Emacs kann mit M-x ps-spool-buffer-with-faces den Buffer in Postscript
umwandeln - das Ergebnis ist im neuen Buffer *PostScript*.  Das kann man
dann als Postscript- (.ps) File abspeichern und ebenfalls mit anderen
Programmen drucken (etwa gv oder was auch immer)

- Paket htmlize um einen Buffer in ein html-File zu drucken und mit
einem anderen Programm drucken (Browser, etwa Firefox).  Das macht
Sinn weil Browser heutzutage oft sehr gute Druck-Interfaces haben.

Viele machen das weil das Interface in Emacs zum Drucken sehr
spartanisch ist.  Es gibt auch noch printing.el das versucht ein
besseres Interface für's Drucken zu Verfügung zu stellen um es etwas
leichter zu machen.

Ich persönlich nutze zur Zeit `ps-spool-buffer-with-faces'.

Michael.




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

* printing
  2022-12-14 17:27 ` Philip Kaludercic
@ 2022-12-16 15:27   ` Gottfried
  2022-12-16 22:26     ` printing Michael Heerdegen
  2022-12-17 13:48     ` printing Gottfried
  0 siblings, 2 replies; 147+ messages in thread
From: Gottfried @ 2022-12-16 15:27 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 1116 bytes --]

Hi,

I added this to my init.el file:

;;printer
(setq lpr-switches
       (append '("-P" "HP_Officejet_J4680_All-in-One"
                 "-o" "sides=two-sided-long-edge"
                 "-o" "number-up=2")
               lpr-switches))


But still it does not find my printer.

Where is my mistake?
The two lines after the printer I am not sure if they are right as well,
but probably that has nothing to do with the printer itself.

I have got a "HP Officejet J4680 All-in-One" printer


Kind regards

Gottfried


Am 14.12.22 um 18:27 schrieb Philip Kaludercic:
> Gottfried <gottfried@posteo.de> writes:
> 
>> Hallo,
>> ich wollte einen Puffer ausdrucken (das erste Mal)
>> und es gab diese Fehlermeldung:
>>
>> lpr-print-region: Spooling...done: /home/gfp/.guix-profile/bin/lpr:
>> Fehler - Kein voreingestelltes Ziel.
>>
>> Wie kann ich das Ziel einstellen?
>>
>> danke
>> Gottfried
> 
> You have to take a look at `lpr-switches', and specifically figure out
> what -P<printer name> flag to add, so that the "lpr" command knows where
> you want to print.

-- 



[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: printing
  2022-12-16 15:27   ` printing Gottfried
@ 2022-12-16 22:26     ` Michael Heerdegen
  2022-12-17  6:29       ` printing tomas
  2022-12-17 13:48     ` printing Gottfried
  1 sibling, 1 reply; 147+ messages in thread
From: Michael Heerdegen @ 2022-12-16 22:26 UTC (permalink / raw)
  To: help-gnu-emacs

Gottfried <gottfried@posteo.de> writes:

> I added this to my init.el file:
>
> ;;printer
> (setq lpr-switches
>       (append '("-P" "HP_Officejet_J4680_All-in-One"
>                 "-o" "sides=two-sided-long-edge"
>                 "-o" "number-up=2")
>               lpr-switches))
>
>
> But still it does not find my printer.
>
> Where is my mistake?
> The two lines after the printer I am not sure if they are right as well,
> but probably that has nothing to do with the printer itself.

Does the lpr command print outside of Emacs?

Michael.




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

* Re: printing
  2022-12-16 22:26     ` printing Michael Heerdegen
@ 2022-12-17  6:29       ` tomas
  2022-12-17  7:41         ` printing Emanuel Berg
  0 siblings, 1 reply; 147+ messages in thread
From: tomas @ 2022-12-17  6:29 UTC (permalink / raw)
  To: help-gnu-emacs

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

On Fri, Dec 16, 2022 at 11:26:39PM +0100, Michael Heerdegen wrote:
> Gottfried <gottfried@posteo.de> writes:
> 
> > I added this to my init.el file:
> >
> > ;;printer
> > (setq lpr-switches
> >       (append '("-P" "HP_Officejet_J4680_All-in-One"
> >                 "-o" "sides=two-sided-long-edge"
> >                 "-o" "number-up=2")
> >               lpr-switches))
> >
> >
> > But still it does not find my printer.
> >
> > Where is my mistake?
> > The two lines after the printer I am not sure if they are right as well,
> > but probably that has nothing to do with the printer itself.
> 
> Does the lpr command print outside of Emacs?

This is the first I'd try, yes. In a console, do

  lpq -a

This should show you all the printer queues your
system thinks it has. The printer queue you mention
above ("HP_Officejet_J4680_All-in-One") should show
up in the list.

Then try

  lpr -P HP_Officejet_J4680_All-in-One <some filename>

where <some filename> is the name of some existing (text
or Postscript or PDF) file and see what it happens.

Once you have that running, the Emacs part should be
easy.

Have you printed anything with your computer (outside
of Emacs) yet? How have you done it?

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: printing
  2022-12-17  6:29       ` printing tomas
@ 2022-12-17  7:41         ` Emanuel Berg
  0 siblings, 0 replies; 147+ messages in thread
From: Emanuel Berg @ 2022-12-17  7:41 UTC (permalink / raw)
  To: help-gnu-emacs

tomas wrote:

>> Does the lpr command print outside of Emacs?
>
> This is the first I'd try, yes. In a console, do
>
>   lpq -a

Here are the commands I accumulated during my printing days -
and while I miss those DAYS, it's not because they involved
printing stuff ;)

  https://dataswamp.org/~incal/conf/.zsh/printers
  https://dataswamp.org/~incal/conf/.zsh/printers-print

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-14 16:38 wie kann ich Emacs so einstellen, dass ich drucken kann Gottfried
  2022-12-14 17:27 ` Philip Kaludercic
  2022-12-14 21:30 ` wie kann ich Emacs so einstellen, dass ich drucken kann Michael Heerdegen
@ 2022-12-17  9:00 ` Jean Louis
  2022-12-17  9:29   ` Michael Heerdegen
                     ` (2 more replies)
  2 siblings, 3 replies; 147+ messages in thread
From: Jean Louis @ 2022-12-17  9:00 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs@gnu.org

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

* Gottfried <gottfried@posteo.de> [2022-12-14 19:40]:
> Hallo,
> ich wollte einen Puffer ausdrucken (das erste Mal)
> und es gab diese Fehlermeldung:

So far best tool to print Emacs buffers that I have found is the
command `paps' as it supports correctly Unicode, also emoticons. Thus
you may try by installing `paps' tool from your Operating System
distribution.

Das beste Werkzeug zum Drucken von EMACS-Puffern, die ich gefunden
habe, ist der Befehl "paps", weil es richtig Unicode unterstützt, auch
Emoticons. Daher können Sie es versuchen, indem Sie das "PAPS"-Tool
aus Ihrer Betriebssystemverteilung installieren.

dov/paps: A text to postscript converter through pango:
https://github.com/dov/paps

Ich verwende folgende Funktionen:

(defun rcd-command-output-from-input (program input &rest args)
  "Return output string from PROGRAM with given INPUT string and optional ARGS."
  (let* ((output (with-temp-buffer
		   (insert input)
		   (apply #'call-process-region nil nil program t '(t nil) nil args)
		   (buffer-string))))
    output))

I am too often using landscape, you can adjust it for your needs.

(defun rcd-paps-process (text &optional format title &rest args)
  (let* ((format (or format "pdf"))
	 (title (or title (buffer-name)))
	 (length (length title))
	 (max 45)
	 (title (if (> length max) (substring title 0 max) title)))
    (apply 'rcd-command-output-from-input "paps" text "--format" format "--landscape" "--title" title "--header" args)))

(defun string-to-file-force (string file)
  "Prints string into file, matters not if file exists. Return FILE as file name."
  (with-temp-file file
    (insert string))
  file)

(defun rcd-paps-text-to-pdf (text &optional file-name title)
  (let* ((output (rcd-paps-process text "pdf" title))
	 (file-name (or file-name (concat (file-name-as-directory (getenv "HOME")) (read-string "File name without .pdf extension: ") ".pdf"))))
    (string-to-file-force output file-name)))

(defun rcd-paps-buffer-to-pdf-view ()
  (interactive)
  (let ((output (rcd-paps-process-buffer))
	(file-name (rcd-temp-file-name nil "pdf")))
    (sleep-for 1)
    (start-process "evince" nil "evince" (string-to-file-force output file-name))))

😎

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/

[-- Attachment #2: Saturday-December-17-2022-11-59-20.pdf --]
[-- Type: application/pdf, Size: 24879 bytes --]

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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-17  9:00 ` Jean Louis
@ 2022-12-17  9:29   ` Michael Heerdegen
  2022-12-17  9:41     ` Jean Louis
  2022-12-18  8:04   ` Eduardo Ochs
  2022-12-18 12:06   ` wie kann ich Emacs so einstellen, dass ich drucken kann Gottfried
  2 siblings, 1 reply; 147+ messages in thread
From: Michael Heerdegen @ 2022-12-17  9:29 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis <bugs@gnu.support> writes:

> * Gottfried <gottfried@posteo.de> [2022-12-14 19:40]:
> > Hallo,
> > ich wollte einen Puffer ausdrucken (das erste Mal)
> > und es gab diese Fehlermeldung:

> Das beste Werkzeug zum Drucken von EMACS-Puffern, die ich gefunden
> habe, ist [...]

Wenn es sich allerdings um einen Kartoffelpuffer handelt, ist es mit dem
Drucken tatsächlich nicht so einfach.

Sorry, could not resist.  Puffer...


Michael.




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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-17  9:29   ` Michael Heerdegen
@ 2022-12-17  9:41     ` Jean Louis
  2022-12-17 10:34       ` Michael Heerdegen
  0 siblings, 1 reply; 147+ messages in thread
From: Jean Louis @ 2022-12-17  9:41 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

* Michael Heerdegen <michael_heerdegen@web.de> [2022-12-17 12:31]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > * Gottfried <gottfried@posteo.de> [2022-12-14 19:40]:
> > > Hallo,
> > > ich wollte einen Puffer ausdrucken (das erste Mal)
> > > und es gab diese Fehlermeldung:
> 
> > Das beste Werkzeug zum Drucken von EMACS-Puffern, die ich gefunden
> > habe, ist [...]
> 
> Wenn es sich allerdings um einen Kartoffelpuffer handelt, ist es mit dem
> Drucken tatsächlich nicht so einfach.

Hahhahaha, dann wie sagt man es üblicherweise in Deutschland? Buffer?
How do you say "Buffer" in Germany?

Wie übersetzt man besser Buffer im Kontext von Emacs?
How do you translate "Buffer" in the context of Emacs?

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-17  9:41     ` Jean Louis
@ 2022-12-17 10:34       ` Michael Heerdegen
  2022-12-17 10:39         ` Michael Heerdegen
  0 siblings, 1 reply; 147+ messages in thread
From: Michael Heerdegen @ 2022-12-17 10:34 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis <bugs@gnu.support> writes:

> Wie übersetzt man besser Buffer im Kontext von Emacs?
> How do you translate "Buffer" in the context of Emacs?

"Puffer" is actually ok, but may sound a bit weird.  Most of the time
many people just use the English words, so "buffer" would also be ok.
Using English words in German sentences a lot has its own name:
speaking Denglish.

It depends on who you explain something.  But you also do older
people no favor if you use words that they don't find in texts and the
Internet etc. because they are not common.

In this case "buffer" and "Puffer" are very similar, so I would prefer
"buffer": it's easy to remember even for people not speaking English,
and it's more precise than "Puffer".

Michael.




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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-17 10:34       ` Michael Heerdegen
@ 2022-12-17 10:39         ` Michael Heerdegen
  0 siblings, 0 replies; 147+ messages in thread
From: Michael Heerdegen @ 2022-12-17 10:39 UTC (permalink / raw)
  To: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> It depends on who you explain something.  But you also do older
> people no favor if you use words that they don't find in texts and the
> Internet etc. because they are not common.

When I speak about Emacs with my friends (in German) I only use English
terms: buffer, window, frame, mode-line, narrowing, etc.  If I would try
to translate all this stuff, I would have forgotten what I actually
wanted to say.  And it would be hard to understand.


Michael.




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

* Re: printing
@ 2022-12-17 12:31 Gottfried
  2022-12-17 13:09 ` printing tomas
  0 siblings, 1 reply; 147+ messages in thread
From: Gottfried @ 2022-12-17 12:31 UTC (permalink / raw)
  To: michael_heerdegen, help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 1335 bytes --]

Hi,

My operating system in GNU Guix, it's not a normal linux distro.

> Does the lpr command print outside of Emacs?

I am not sure what you mean and how to do it.

I have cups installed.

I never printed with the terminal, so I don't know.
I tried it briefly with:
sudo cat my-file-to-print.txt > /dev/lp

but it didn't work.

basically my printer is working with cups installed,
and I even managed to print from emacs with my browser by that:

M-x htmlfontify-buffer		
file:///home/gfp/testeev.txt	
browse-url-of-file		


thanks for help

Gottfried



Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: printing
Message-ID: <87a63nq928.fsf@web.de>
Content-Type: text/plain

Gottfried <gottfried@posteo.de> writes:

 > I added this to my init.el file:
 >
 > ;;printer
 > (setq lpr-switches
 >       (append '("-P" "HP_Officejet_J4680_All-in-One"
 >                 "-o" "sides=two-sided-long-edge"
 >                 "-o" "number-up=2")
 >               lpr-switches))
 >
 >
 > But still it does not find my printer.
 >
 > Where is my mistake?
 > The two lines after the printer I am not sure if they are right as well,
 > but probably that has nothing to do with the printer itself.

Does the lpr command print outside of Emacs?

Michael.


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: printing
  2022-12-17 12:31 printing Gottfried
@ 2022-12-17 13:09 ` tomas
  0 siblings, 0 replies; 147+ messages in thread
From: tomas @ 2022-12-17 13:09 UTC (permalink / raw)
  To: help-gnu-emacs

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

On Sat, Dec 17, 2022 at 12:31:25PM +0000, Gottfried wrote:
> Hi,
> 
> My operating system in GNU Guix, it's not a normal linux distro.
> 
> > Does the lpr command print outside of Emacs?
> 
> I am not sure what you mean and how to do it.
> 
> I have cups installed.

There is a compatibility package providing the command `lpr' for
cups. Under Debian, it is called cups-bsd. I don't know how to
find something equivalent under Guix, but the idea is to search
for a package providing an executable named lpr and somehow linked
to cups.

> I never printed with the terminal, so I don't know.
> I tried it briefly with:
> sudo cat my-file-to-print.txt > /dev/lp
> 
> but it didn't work.

Those were the times :)

You have to find an executable named lpr which goes with your cups.

> basically my printer is working with cups installed,
> and I even managed to print from emacs with my browser by that:

These days the operating system is just a driver for the browser,
it seems ;-)

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: printing
  2022-12-16 15:27   ` printing Gottfried
  2022-12-16 22:26     ` printing Michael Heerdegen
@ 2022-12-17 13:48     ` Gottfried
  2022-12-17 16:30       ` printing tomas
  1 sibling, 1 reply; 147+ messages in thread
From: Gottfried @ 2022-12-17 13:48 UTC (permalink / raw)
  To: Philip Kaludercic, michael_heerdegen; +Cc: help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 727 bytes --]

Hi,

I found the mistake why I couldn't print in emacs.


My printer has a different name and I changed it in my init.el file.

HP_Officejet_J4680_series


No I can print within emacs, at the moment with the menu: print

Other options I have to figure out.


Kind regards

  Gottfried



Am 16.12.22 um 16:27 schrieb Gottfried:
> Hi,
> 
> I added this to my init.el file:
> 
> ;;printer
> (setq lpr-switches
>        (append '("-P" "HP_Officejet_J4680_All-in-One"
>                  "-o" "sides=two-sided-long-edge"
>                  "-o" "number-up=2")
>                lpr-switches))
> 
> 
> But still it does not find my printer.
> 

> 

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: printing
  2022-12-17 13:48     ` printing Gottfried
@ 2022-12-17 16:30       ` tomas
  0 siblings, 0 replies; 147+ messages in thread
From: tomas @ 2022-12-17 16:30 UTC (permalink / raw)
  To: help-gnu-emacs

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

On Sat, Dec 17, 2022 at 01:48:02PM +0000, Gottfried wrote:
> Hi,
> 
> I found the mistake why I couldn't print in emacs.
> 
> 
> My printer has a different name and I changed it in my init.el file.
> 
> HP_Officejet_J4680_series

Aha :-)

> No I can print within emacs, at the moment with the menu: print

I think that was meant to be a "Now"? In that case, congrats!

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-17  9:00 ` Jean Louis
  2022-12-17  9:29   ` Michael Heerdegen
@ 2022-12-18  8:04   ` Eduardo Ochs
  2022-12-18 17:18     ` Jean Louis
  2022-12-18 12:06   ` wie kann ich Emacs so einstellen, dass ich drucken kann Gottfried
  2 siblings, 1 reply; 147+ messages in thread
From: Eduardo Ochs @ 2022-12-18  8:04 UTC (permalink / raw)
  To: Gottfried, help-gnu-emacs@gnu.org

On Sat, 17 Dec 2022 at 06:02, Jean Louis <bugs@gnu.support> wrote:
>
> * Gottfried <gottfried@posteo.de> [2022-12-14 19:40]:
> > Hallo,
> > ich wollte einen Puffer ausdrucken (das erste Mal)
> > und es gab diese Fehlermeldung:
>
> So far best tool to print Emacs buffers that I have found is the
> command `paps' as it supports correctly Unicode, also emoticons. Thus
> you may try by installing `paps' tool from your Operating System
> distribution.
>
> Das beste Werkzeug zum Drucken von EMACS-Puffern, die ich gefunden
> habe, ist der Befehl "paps", weil es richtig Unicode unterstützt, auch
> Emoticons. Daher können Sie es versuchen, indem Sie das "PAPS"-Tool
> aus Ihrer Betriebssystemverteilung installieren.
>
> dov/paps: A text to postscript converter through pango:
> https://github.com/dov/paps
>
> Ich verwende folgende Funktionen:
>
> (defun rcd-command-output-from-input (program input &rest args)
>   "Return output string from PROGRAM with given INPUT string and optional ARGS."
>   (let* ((output (with-temp-buffer
>                    (insert input)
>                    (apply #'call-process-region nil nil program t '(t nil) nil args)
>                    (buffer-string))))
>     output))
>
> I am too often using landscape, you can adjust it for your needs.
>
> (defun rcd-paps-process (text &optional format title &rest args)
>   (let* ((format (or format "pdf"))
>          (title (or title (buffer-name)))
>          (length (length title))
>          (max 45)
>          (title (if (> length max) (substring title 0 max) title)))
>     (apply 'rcd-command-output-from-input "paps" text "--format" format "--landscape" "--title" title "--header" args)))
>
> (defun string-to-file-force (string file)
>   "Prints string into file, matters not if file exists. Return FILE as file name."
>   (with-temp-file file
>     (insert string))
>   file)
>
> (defun rcd-paps-text-to-pdf (text &optional file-name title)
>   (let* ((output (rcd-paps-process text "pdf" title))
>          (file-name (or file-name (concat (file-name-as-directory (getenv "HOME")) (read-string "File name without .pdf extension: ") ".pdf"))))
>     (string-to-file-force output file-name)))
>
> (defun rcd-paps-buffer-to-pdf-view ()
>   (interactive)
>   (let ((output (rcd-paps-process-buffer))
>         (file-name (rcd-temp-file-name nil "pdf")))
>     (sleep-for 1)
>     (start-process "evince" nil "evince" (string-to-file-force output file-name))))
>
> 😎

Hi Jean Louis,

What are the definitions of `rcd-paps-process-buffer'
and `rcd-temp-file-name'?

Thanks in advance!
  Eduardo



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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-17  9:00 ` Jean Louis
  2022-12-17  9:29   ` Michael Heerdegen
  2022-12-18  8:04   ` Eduardo Ochs
@ 2022-12-18 12:06   ` Gottfried
  2022-12-18 17:20     ` Jean Louis
  2 siblings, 1 reply; 147+ messages in thread
From: Gottfried @ 2022-12-18 12:06 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 4826 bytes --]

Hi Jean,

I installed paps with my System GNU Guix
and I copied
........................................
(defun rcd-command-output-from-input (program input &rest args)
 >    "Return output string from PROGRAM with given INPUT string and 
optional ARGS."
 >    (let* ((output (with-temp-buffer
 > 		   (insert input)
 > 		   (apply #'call-process-region nil nil program t '(t nil) nil args)
 > 		   (buffer-string))))
 >      output))

(defun rcd-paps-process (text &optional format title &rest args)
 >    (let* ((format (or format "pdf"))
 > 	 (title (or title (buffer-name)))
 > 	 (length (length title))
 > 	 (max 45)
 > 	 (title (if (> length max) (substring title 0 max) title)))
 >      (apply 'rcd-command-output-from-input "paps" text "--format" 
format "--landscape" "--title" title "--header" args)))
 >
 > (defun string-to-file-force (string file)
 >    "Prints string into file, matters not if file exists. Return FILE 
as file name."
 >    (with-temp-file file
 >      (insert string))
 >    file)
 >
 > (defun rcd-paps-text-to-pdf (text &optional file-name title)
 >    (let* ((output (rcd-paps-process text "pdf" title))
 > 	 (file-name (or file-name (concat (file-name-as-directory (getenv 
"HOME")) (read-string "File name without .pdf extension: ") ".pdf"))))
 >      (string-to-file-force output file-name)))
 >
 > (defun rcd-paps-buffer-to-pdf-view ()
 >    (interactive)
 >    (let ((output (rcd-paps-process-buffer))
 > 	(file-name (rcd-temp-file-name nil "pdf")))
 >      (sleep-for 1)
 >      (start-process "evince" nil "evince" (string-to-file-force 
output file-name))))
..........................................
into my init.el file

How does now the program paps find my printer?
because when I wanted to print something it says
"kein voreingestelltes Ziel/No preset destination

What else do I have to do?
Do I have to install pags in emacs?
Do I have to add something in my init.el file to find the printer?

Sorry, but I am learning

thanks for help

Gottfried



Am 17.12.22 um 10:00 schrieb Jean Louis:
> * Gottfried <gottfried@posteo.de> [2022-12-14 19:40]:
>> Hallo,
>> ich wollte einen Puffer ausdrucken (das erste Mal)
>> und es gab diese Fehlermeldung:
> 
> So far best tool to print Emacs buffers that I have found is the
> command `paps' as it supports correctly Unicode, also emoticons. Thus
> you may try by installing `paps' tool from your Operating System
> distribution.
> 
> Das beste Werkzeug zum Drucken von EMACS-Puffern, die ich gefunden
> habe, ist der Befehl "paps", weil es richtig Unicode unterstützt, auch
> Emoticons. Daher können Sie es versuchen, indem Sie das "PAPS"-Tool
> aus Ihrer Betriebssystemverteilung installieren.
> 
> dov/paps: A text to postscript converter through pango:
> https://github.com/dov/paps
> 
> Ich verwende folgende Funktionen:
> 
> (defun rcd-command-output-from-input (program input &rest args)
>    "Return output string from PROGRAM with given INPUT string and optional ARGS."
>    (let* ((output (with-temp-buffer
> 		   (insert input)
> 		   (apply #'call-process-region nil nil program t '(t nil) nil args)
> 		   (buffer-string))))
>      output))
> 
> I am too often using landscape, you can adjust it for your needs.
> 
> (defun rcd-paps-process (text &optional format title &rest args)
>    (let* ((format (or format "pdf"))
> 	 (title (or title (buffer-name)))
> 	 (length (length title))
> 	 (max 45)
> 	 (title (if (> length max) (substring title 0 max) title)))
>      (apply 'rcd-command-output-from-input "paps" text "--format" format "--landscape" "--title" title "--header" args)))
> 
> (defun string-to-file-force (string file)
>    "Prints string into file, matters not if file exists. Return FILE as file name."
>    (with-temp-file file
>      (insert string))
>    file)
> 
> (defun rcd-paps-text-to-pdf (text &optional file-name title)
>    (let* ((output (rcd-paps-process text "pdf" title))
> 	 (file-name (or file-name (concat (file-name-as-directory (getenv "HOME")) (read-string "File name without .pdf extension: ") ".pdf"))))
>      (string-to-file-force output file-name)))
> 
> (defun rcd-paps-buffer-to-pdf-view ()
>    (interactive)
>    (let ((output (rcd-paps-process-buffer))
> 	(file-name (rcd-temp-file-name nil "pdf")))
>      (sleep-for 1)
>      (start-process "evince" nil "evince" (string-to-file-force output file-name))))
> 
> 😎
> 

-- 
Kind regards

Gottfried

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Why is HTML email a security nightmare? See https://useplaintext.email/

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-18  8:04   ` Eduardo Ochs
@ 2022-12-18 17:18     ` Jean Louis
  2022-12-18 22:34       ` rcd-paps.el (was: Re: wie kann ich Emacs...) Eduardo Ochs
  0 siblings, 1 reply; 147+ messages in thread
From: Jean Louis @ 2022-12-18 17:18 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: Gottfried, help-gnu-emacs@gnu.org

* Eduardo Ochs <eduardoochs@gmail.com> [2022-12-18 11:05]:
> Hi Jean Louis,
> 
> What are the definitions of `rcd-paps-process-buffer'
> and `rcd-temp-file-name'?

(defun rcd-paps-process-buffer (&rest args)
  (let ((text (buffer-substring-no-properties (point-min) (point-max))))
    (apply 'rcd-paps-process text args)))

(defcustom rcd-temp-file-directory "~/tmp/"
  "Temporary directory for other temporary files."
  :group 'rcd
  :type 'string)

(defun rcd-temp-file-name (&optional file-name extension)
  "Return temporary file name."
  (concat (file-truename (file-name-as-directory rcd-temp-file-directory))
	  (or file-name (format-time-string "%A-%B-%d-%Y-%H-%M-%S"))
	  "."
	  (or extension "txt")))

I hope you will get it to work, as paps gives quite good
output. Author has recently updated modification of header. My package
`rcd-paps' is not finished, it will be.

dov/paps: A text to postscript converter through pango:
https://github.com/dov/paps

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-18 12:06   ` wie kann ich Emacs so einstellen, dass ich drucken kann Gottfried
@ 2022-12-18 17:20     ` Jean Louis
  2022-12-19 13:49       ` Gottfried
  0 siblings, 1 reply; 147+ messages in thread
From: Jean Louis @ 2022-12-18 17:20 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs@gnu.org

* Gottfried <gottfried@posteo.de> [2022-12-18 15:37]:
> How does now the program paps find my printer?

Once you generate PDF, you may preview PDF files, right?

Then you do in shell

$ lpr Your-File.pdf

or if output is ".ps" then corresponding ps file.

or you print the PDF from PDF viewer.

> Do I have to install pags in emacs?

Did you get PDF preview?

paps is program you install yes, in your system distribution.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* rcd-paps.el (was: Re: wie kann ich Emacs...)
  2022-12-18 17:18     ` Jean Louis
@ 2022-12-18 22:34       ` Eduardo Ochs
  2022-12-19 12:50         ` rcd-paps.el Jean Louis
  0 siblings, 1 reply; 147+ messages in thread
From: Eduardo Ochs @ 2022-12-18 22:34 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org, Jean Louis

On Sun, 18 Dec 2022 at 14:19, Jean Louis <bugs@gnu.support> wrote:
>
> I hope you will get it to work, as paps gives quite good
> output. Author has recently updated modification of header. My package
> `rcd-paps' is not finished, it will be.

Hi Jean Louis,
I changed the subject.
This is an answer to:

  https://lists.gnu.org/archive/html/help-gnu-emacs/2022-12/msg00575.html

I am getting errors.
When I run it in my default system I get this error in evince:

  Unable to open document
“file:///home/edrx/tmp/Sunday-December-18-2022-19-08-23.pdf”.
  File type empty document (application/x-zerosize) is not supported.

and when I run it in an emacs -Q I get this lisp error:

  Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  call-process-region(nil nil "paps" t (t nil) nil "--format" "pdf"
                      "--landscape" "--title" "rcd-paps.el" "--header")
  apply(call-process-region nil nil "paps" t (t nil) nil ("--format" "pdf"
        "--landscape" "--title" "rcd-paps.el" "--header"))

where to "run it" means to run this:

                    http://angg.twu.net/elisp/rcd-paps.el
  (find-wget-elisp "http://angg.twu.net/elisp/rcd-paps.el")

Thanks in advance!
  Eduardo Ochs
  http://angg.twu.net/eepitch.html



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

* Re: rcd-paps.el
  2022-12-18 22:34       ` rcd-paps.el (was: Re: wie kann ich Emacs...) Eduardo Ochs
@ 2022-12-19 12:50         ` Jean Louis
  0 siblings, 0 replies; 147+ messages in thread
From: Jean Louis @ 2022-12-19 12:50 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: help-gnu-emacs@gnu.org

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

This package is not finished, find it attached if you wish to modify
or suggest things.

I use it in peculiar way:

M-x rcd-paps-buffer-to-pdf and

M-x rcd-paps-buffer-to-pdf-view 

which anyway generates PDF file, and then I send PDF file for
printing.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/

[-- Attachment #2: rcd-paps.el --]
[-- Type: text/plain, Size: 6962 bytes --]

;;; rcd-paps.el --- RCD PAPS Emacs Bindings to PAPS printing utilities

;; Copyright (C) 2021-2022 by Jean Louis

;; Author: Jean Louis <bugs@gnu.support>
;; Version: 0.1
;; Package-Requires: (rcd-utilities)
;; Keywords: tools
;; URL: 

;; This file is not part of GNU Emacs.

;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;;; Change Log:

;;; Code:

(require 'rcd-utilities)

(defcustom rcd-paps-orientation nil
  "Page orientation. By default it is portrait, if TRUE, it will
be landscape"
  :group 'rcd-paps
  :type 'boolean)

(defcustom rcd-paps-columns 1
  "Number of columns output"
  :group 'rcd-paps
  :type 'integer)

(defcustom rcd-paps-pdf-viewer "evince"
  "PDF Viewer"
  :group 'rcd-paps
  :type 'string)

;; (defcustom rcd-paps-paper "evince"
;;   "PDF Viewer"
;;   :group 'rcd-paps
;;   :type 'string)

(defcustom rcd-paps-output-directory (file-name-as-directory (getenv "HOME"))
  "Default PAPS output directory."
  :group 'rcd-paps
  :type 'string)

;; Application Options:
;;   --landscape                       Landscape output. (Default: portrait)
;;   --columns=NUM                     Number of columns output. (Default: 1)
;;   --font=DESC                       Set font. (Default: Monospace 12)
;;   -o, --output=DESC                 Output file. (Default: stdout)
;;   -v, --version                     Current version.
;;   --rtl                             Do right-to-left text layout.
;;   --justify                         Justify the layout.
;;   --hyphens                         Show hyphens when wrapping.
;;   --wrap=WRAP                       Text wrapping mode [word, char, word-char]. (Default: word-char)
;;   --show-wrap                       Show characters for wrapping.
;;   --paper=PAPER                     Set paper size [legal, letter, a3, a4]. (Default: a4)
;;   --gravity=GRAVITY                 Base glyph rotation [south, west, north, east, auto]. (Defaut: auto)
;;   --gravity-hint=HINT               Base glyph orientation [natural, strong, line]. (Default: natural)
;;   --format=FORMAT                   Set output format [pdf, svg, ps]. (Default: ps)
;;   --bottom-margin=NUM               Set bottom margin in postscript point units (1/72 inch). (Default: 36)
;;   --top-margin=NUM                  Set top margin. (Default: 36)
;;   --right-margin=NUM                Set right margin. (Default: 36)
;;   --left-margin=NUM                 Set left margin. (Default: 36)
;;   --gutter-width=NUM                Set gutter width. (Default: 40)
;;   --header                          Draw page header for each page.
;;   --footer                          Draw page footer for each page.
;;   --title=TITLE                     Title string for page header (Default: filename/stdin).
;;   --header-left=HEADER_LEFT         Left side of the header. Default is localized date.
;;   --header-center=HEADER_CENTER     Center side of the header. Default is localized date.
;;   --header-right=HEADER_RIGHT       Right side of the header. Default is localized date.
;;   --markup                          Interpret input text as pango markup.
;;   --encoding=ENCODING               Assume encoding of input text. (Default: UTF-8)
;;   --lpi=REAL                        Set the amount of lines per inch.
;;   --cpi=REAL                        Set the amount of characters per inch.
;;   --g-fatal-warnings=REAL           Make all glib warnings fatal.

(defun rcd-paps-process (text &optional format title &rest args)
  (let* ((format (or format "pdf"))
	 (title (cond (title title)
		      (current-prefix-arg (rcd-ask-get "Title: "))
		      (t (buffer-name))))
	 (length (length title))
	 (orientation (cond (rcd-paps-orientation "--landscape")
			    (current-prefix-arg (when (y-or-n-p "Do you wish to use landscape? ")
						  "--landscape"))))
	 (max 45)
	 (title (if (> length max) (substring title 0 max) title)))
    (apply 'rcd-command-output-from-input "paps" text "--format" format "--title" title "--header"
	   (format "--columns=%d"
		   (cond (current-prefix-arg (rcd-ask-number "Columns: "))
			 (t rcd-paps-columns)))
	   (cond (orientation (append (list "--landscape") args))
		 (t args)))))

(defun rcd-paps-text-to-pdf (text &optional file-name title)
  (let* ((output (rcd-paps-process text "pdf" title))
	 (file-name (or file-name (concat (file-name-as-directory (getenv "HOME")) (rcd-ask "File name without .pdf extension: ") ".pdf"))))
    (string-to-file-force output  file-name)))

(defun rcd-paps-buffer-to-pdf ()
  (interactive)
  (let ((output (rcd-paps-process-buffer))
	(file-name (rcd-temp-file-name nil "pdf")))
    (prog1
	(string-to-file-force output file-name)
	(rcd-message "PDF: %s" file-name))))

(defun rcd-paps-buffer-to-pdf-view ()
  (interactive)
  (start-process rcd-paps-pdf-viewer rcd-paps-pdf-viewer rcd-paps-pdf-viewer (rcd-paps-buffer-to-pdf)))

(defun rcd-paps-region-to-pdf ()
  (interactive)
  (let ((output (rcd-paps-process-region))
	(file-name (rcd-temp-file-name nil "pdf")))
    (prog1
	(string-to-file-force output file-name)
	(rcd-message "PDF: %s" file-name))))

(defun rcd-paps-region-to-pdf-view ()
  (interactive)
  (start-process rcd-paps-pdf-viewer rcd-paps-pdf-viewer rcd-paps-pdf-viewer (rcd-paps-region-to-pdf)))

(defun rcd-paps-process-region (&rest args)
  (let ((text (rcd-region-string)))
    (when text
      (apply 'rcd-paps-process text args))))

(defun rcd-paps-process-buffer (&rest args)
  (let ((text (buffer-substring-no-properties (point-min) (point-max))))
    (apply 'rcd-paps-process text args)))

(defun rcd-paps-print-buffer ()
  (interactive)
  (let* ((file-name (concat (buffer-name) ".pdf"))
	 (file (read-file-name "File name: " rcd-paps-output-directory nil nil file-name))
	 (output (rcd-paps-process-buffer)))
    (string-to-file-force output file)
    (message "Buffer printed to `%s'" file)))

(defun rcd-export-pdf ()
  (interactive)
  (let* ((type "pdf")
	 (file (concat rcd-paps-output-directory (buffer-name) "." type))
	 (output (x-export-frames nil (intern type))))
    (string-to-file-force output file)
    (message "Buffer printed to `%s'" file)))

(defun rcd-paps-config-paper ()
  (interactive)
  (let ((paper (rcd-choose '("legal" "letter" "a3" "a4") "Configure `paps' paper size: " nil "a4")))
    (customize-set-value rcd-paps-paper paper)))

(provide 'rcd-paps)

;;; rcd-paps.el ends here

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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-18 17:20     ` Jean Louis
@ 2022-12-19 13:49       ` Gottfried
  2022-12-19 17:19         ` Jean Louis
  0 siblings, 1 reply; 147+ messages in thread
From: Gottfried @ 2022-12-19 13:49 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 844 bytes --]

Hi Jean,

how can I generate PDF?

I installed pdf-tools, but I don't know how to use it.
It said I should use

C-c C-c  to change to this mode.

When I do C-c C-c it says:


undetermined keybinding.

So I don't know how to get into pdf-tools and how to generate a pdf.


Kind regards

Gottfried


Am 18.12.22 um 18:20 schrieb Jean Louis:
> * Gottfried <gottfried@posteo.de> [2022-12-18 15:37]:
>> How does now the program paps find my printer?
> 
> Once you generate PDF, you may preview PDF files, right?
> 
> Then you do in shell
> 
> $ lpr Your-File.pdf
> 
> or if output is ".ps" then corresponding ps file.
> 
> or you print the PDF from PDF viewer.
> 
>> Do I have to install pags in emacs?
> 
> Did you get PDF preview?
> 
> paps is program you install yes, in your system distribution.
> 



[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann
  2022-12-19 13:49       ` Gottfried
@ 2022-12-19 17:19         ` Jean Louis
  2022-12-27 16:10           ` wie kann ich Emacs so einstellen, dass ich drucken kann (printing in Emacs) Gottfried
  2022-12-27 16:39           ` wie kann ich Emacs so einstellen, dass ich drucken kann (printing with paps) Gottfried
  0 siblings, 2 replies; 147+ messages in thread
From: Jean Louis @ 2022-12-19 17:19 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs@gnu.org


* Gottfried <gottfried@posteo.de> [2022-12-19 16:51]:
> Hi Jean,
> 
> how can I generate PDF?

With my package you have to use also:

GNU Emacs package: rcd-utilities.el :
https://gnu.support/gnu-emacs/packages/rcd-utilities-el.html

which is pretty personal utilities.

Then you do preview with rcd-paps.el by using:

M-x rcd-paps-buffer-to-pdf-view or just to generate PDF:

M-x rcd-paps-buffer-to-pdf

or C-u M-x rcd-paps-buffer-to-pdf as with prefix C-u you will be asked
for title, orientation and columns.

> I installed pdf-tools, but I don't know how to use it.
> It said I should use
> 
> C-c C-c  to change to this mode.

I do not know about pdf-tools.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann (printing in Emacs)
  2022-12-19 17:19         ` Jean Louis
@ 2022-12-27 16:10           ` Gottfried
  2022-12-27 17:35             ` Jean Louis
  2022-12-27 16:39           ` wie kann ich Emacs so einstellen, dass ich drucken kann (printing with paps) Gottfried
  1 sibling, 1 reply; 147+ messages in thread
From: Gottfried @ 2022-12-27 16:10 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 1116 bytes --]

Hi Jean,

I downloaded

rcd-utilities.el

and put it im my emacs directory in a sub-folder

after running

M-x rcd-paps-buffer-to-pdf-view
or
M-x rcd-paps-buffer-to-pdf

it said:

symbol’s function definition is void: rcd-paps-process-buffer

Where is my mistake?

Kind regards

Gottfried



Am 19.12.22 um 18:19 schrieb Jean Louis:
> 
> * Gottfried <gottfried@posteo.de> [2022-12-19 16:51]:
>> Hi Jean,
>>
>> how can I generate PDF?
> 
> With my package you have to use also:
> 
> GNU Emacs package: rcd-utilities.el :
> https://gnu.support/gnu-emacs/packages/rcd-utilities-el.html
> 
> which is pretty personal utilities.
> 
> Then you do preview with rcd-paps.el by using:
> 
> M-x rcd-paps-buffer-to-pdf-view or just to generate PDF:
> 
> M-x rcd-paps-buffer-to-pdf
> 
> or C-u M-x rcd-paps-buffer-to-pdf as with prefix C-u you will be asked
> for title, orientation and columns.
> 
>> I installed pdf-tools, but I don't know how to use it.
>> It said I should use
>>
>> C-c C-c  to change to this mode.
> 
> I do not know about pdf-tools.
> 

-- 



[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann (printing with paps)
  2022-12-19 17:19         ` Jean Louis
  2022-12-27 16:10           ` wie kann ich Emacs so einstellen, dass ich drucken kann (printing in Emacs) Gottfried
@ 2022-12-27 16:39           ` Gottfried
  2022-12-27 16:47             ` Gottfried
  1 sibling, 1 reply; 147+ messages in thread
From: Gottfried @ 2022-12-27 16:39 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org, Jean Louis


[-- Attachment #1.1.1: Type: text/plain, Size: 1748 bytes --]

Hi Jean,

I tried to install rcd-utilities.el
with
M-x package-install-file RET rcd-utilities.el RET

I got this message

Leaving directory ‘/home/gfp/.config/emacs/elpa/rcd-utilities-2.10’
\f
Compiling file 
/home/gfp/.config/emacs/elpa/rcd-utilities-2.10/rcd-utilities.el at Tue 
Dec 27 17:33:43 2022
Entering directory ‘/home/gfp/.config/emacs/elpa/rcd-utilities-2.10/’
rcd-utilities.el:108:44: Warning: file-directory-p called with 2 arguments,
     but accepts only 1

In rcd-sql-current-weekday:
rcd-utilities.el:1073:60: Warning: reference to free variable ‘cf-db’

In read-from-buffer:
rcd-utilities.el:1180:27: Warning: Unused lexical variable
     `my-buffer-kill-hook'

In rcd-uuid-p:
rcd-utilities.el:2692:37: Warning: reference to free variable
     ‘thing-at-point-uuid-regexp’
rcd-utilities.el:2707:1: Error: Symbol’s function definition is void: 
rcd-my-home


Kind regards

Gottfried


Am 19.12.22 um 18:19 schrieb Jean Louis:
> 
> * Gottfried <gottfried@posteo.de> [2022-12-19 16:51]:
>> Hi Jean,
>>
>> how can I generate PDF?
> 
> With my package you have to use also:
> 
> GNU Emacs package: rcd-utilities.el :
> https://gnu.support/gnu-emacs/packages/rcd-utilities-el.html
> 
> which is pretty personal utilities.
> 
> Then you do preview with rcd-paps.el by using:
> 
> M-x rcd-paps-buffer-to-pdf-view or just to generate PDF:
> 
> M-x rcd-paps-buffer-to-pdf
> 
> or C-u M-x rcd-paps-buffer-to-pdf as with prefix C-u you will be asked
> for title, orientation and columns.
> 
>> I installed pdf-tools, but I don't know how to use it.
>> It said I should use
>>
>> C-c C-c  to change to this mode.
> 
> I do not know about pdf-tools.
> 

-- 

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann (printing with paps)
  2022-12-27 16:39           ` wie kann ich Emacs so einstellen, dass ich drucken kann (printing with paps) Gottfried
@ 2022-12-27 16:47             ` Gottfried
  2022-12-27 17:37               ` Jean Louis
  0 siblings, 1 reply; 147+ messages in thread
From: Gottfried @ 2022-12-27 16:47 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org, Jean Louis


[-- Attachment #1.1.1: Type: text/plain, Size: 2143 bytes --]

Hi Jean,

> Error: Symbol’s function definition is void: 
>> rcd-my-home


This is in rcd-my-home:

(defun rcd-my-home ()
   "Return my home directory."
   (file-name-as-directory (getenv "HOME")))


Kind regards

Gottfried



Am 27.12.22 um 17:39 schrieb Gottfried:
> Hi Jean,
> 
> I tried to install rcd-utilities.el
> with
> M-x package-install-file RET rcd-utilities.el RET
> 
> I got this message
> 
> Leaving directory ‘/home/gfp/.config/emacs/elpa/rcd-utilities-2.10’
> \f
> Compiling file 
> /home/gfp/.config/emacs/elpa/rcd-utilities-2.10/rcd-utilities.el at Tue 
> Dec 27 17:33:43 2022
> Entering directory ‘/home/gfp/.config/emacs/elpa/rcd-utilities-2.10/’
> rcd-utilities.el:108:44: Warning: file-directory-p called with 2 arguments,
>      but accepts only 1
> 
> In rcd-sql-current-weekday:
> rcd-utilities.el:1073:60: Warning: reference to free variable ‘cf-db’
> 
> In read-from-buffer:
> rcd-utilities.el:1180:27: Warning: Unused lexical variable
>      `my-buffer-kill-hook'
> 
> In rcd-uuid-p:
> rcd-utilities.el:2692:37: Warning: reference to free variable
>      ‘thing-at-point-uuid-regexp’
> rcd-utilities.el:2707:1: Error: Symbol’s function definition is void: 
> rcd-my-home
> 
> 
> Kind regards
> 
> Gottfried
> 
> 
> Am 19.12.22 um 18:19 schrieb Jean Louis:
>>
>> * Gottfried <gottfried@posteo.de> [2022-12-19 16:51]:
>>> Hi Jean,
>>>
>>> how can I generate PDF?
>>
>> With my package you have to use also:
>>
>> GNU Emacs package: rcd-utilities.el :
>> https://gnu.support/gnu-emacs/packages/rcd-utilities-el.html
>>
>> which is pretty personal utilities.
>>
>> Then you do preview with rcd-paps.el by using:
>>
>> M-x rcd-paps-buffer-to-pdf-view or just to generate PDF:
>>
>> M-x rcd-paps-buffer-to-pdf
>>
>> or C-u M-x rcd-paps-buffer-to-pdf as with prefix C-u you will be asked
>> for title, orientation and columns.
>>
>>> I installed pdf-tools, but I don't know how to use it.
>>> It said I should use
>>>
>>> C-c C-c  to change to this mode.
>>
>> I do not know about pdf-tools.
>>
> 

-- 

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann (printing in Emacs)
  2022-12-27 16:10           ` wie kann ich Emacs so einstellen, dass ich drucken kann (printing in Emacs) Gottfried
@ 2022-12-27 17:35             ` Jean Louis
  0 siblings, 0 replies; 147+ messages in thread
From: Jean Louis @ 2022-12-27 17:35 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs@gnu.org

* Gottfried <gottfried@posteo.de> [2022-12-27 19:12]:
> Hi Jean,
> 
> I downloaded
> 
> rcd-utilities.el
> 
> and put it im my emacs directory in a sub-folder

After downloading it, you install it by:

M-x package-install-file 

then you get rcd-paps.el

and install:

M-x package-install-file

See video:

https://gnu.support/files/emacs/packages/rcd-paps/2022-12-27-20:31:29.ogv


References:

GNU Emacs package: rcd-utilities.el :
https://gnu.support/gnu-emacs/packages/rcd-utilities-el.html

RCD Paps:
https://gnu.support/files/emacs/packages/rcd-paps/rcd-paps.el

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: wie kann ich Emacs so einstellen, dass ich drucken kann (printing with paps)
  2022-12-27 16:47             ` Gottfried
@ 2022-12-27 17:37               ` Jean Louis
  2022-12-28 16:31                 ` printing with paps Gottfried
  0 siblings, 1 reply; 147+ messages in thread
From: Jean Louis @ 2022-12-27 17:37 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs@gnu.org

* Gottfried <gottfried@posteo.de> [2022-12-27 19:48]:
> Hi Jean,
> 
> > Error: Symbol’s function definition is void:
> > > rcd-my-home
> 
> 
> This is in rcd-my-home:
> 
> (defun rcd-my-home ()
>   "Return my home directory."
>   (file-name-as-directory (getenv "HOME")))

Download latest version:

https://gnu.support/files/emacs/packages/rcd-utilities.el

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: printing with paps
  2022-12-27 17:37               ` Jean Louis
@ 2022-12-28 16:31                 ` Gottfried
  2022-12-30 14:26                   ` Jean Louis
  0 siblings, 1 reply; 147+ messages in thread
From: Gottfried @ 2022-12-28 16:31 UTC (permalink / raw)
  To: Jean Louis, help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 1219 bytes --]

Hi Jean,
I downloaded the latest version of rcd-utilities
from

> https://gnu.support/files/emacs/packages/rcd-utilities.el

and after installing:
M-x package-install-file
I got the same message, but less mistakes as earlier

\f
Compiling file 
/home/gfp/.config/emacs/elpa/rcd-utilities-2.10/rcd-utilities.el at Wed 
Dec 28 17:16:54 2022
Entering directory ‘/home/gfp/.config/emacs/elpa/rcd-utilities-2.10/’

In rcd-sql-current-weekday:
rcd-utilities.el:1086:60: Warning: reference to free variable ‘cf-db’

In rcd-uuid-p:
rcd-utilities.el:2704:37: Warning: reference to free variable
     ‘thing-at-point-uuid-regexp’
rcd-utilities.el:2719:1: Error: Symbol’s function definition is void: 
rcd-my-home

Kind regards

Gottfried



Am 27.12.22 um 18:37 schrieb Jean Louis:
> * Gottfried <gottfried@posteo.de> [2022-12-27 19:48]:
>> Hi Jean,
>>
>>> Error: Symbol’s function definition is void:
>>>> rcd-my-home
>>
>>
>> This is in rcd-my-home:
>>
>> (defun rcd-my-home ()
>>    "Return my home directory."
>>    (file-name-as-directory (getenv "HOME")))
> 
> Download latest version:
> 
> https://gnu.support/files/emacs/packages/rcd-utilities.el
> 

-- 

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: printing with paps
  2022-12-28 16:31                 ` printing with paps Gottfried
@ 2022-12-30 14:26                   ` Jean Louis
  2022-12-31 12:09                     ` Gottfried
  0 siblings, 1 reply; 147+ messages in thread
From: Jean Louis @ 2022-12-30 14:26 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs@gnu.org

Hello,

Here is the improved package and you may do your own customizations
for it.

GNU Emacs package: rcd-paps.el:
https://gnu.support/gnu-emacs/packages/GNU-Emacs-package-rcd-paps-el-76862.html

1. Download new rcd-utilities.el from
   https://gnu.support/files/emacs/packages/rcd-utilities.el

2. Install with M-x package-install-file

3. Download rcd-paps.el from https://gnu.support/files/emacs/packages/rcd-paps/rcd-paps.el

4. Install with M-x package-install-file

Then you can do following:

{M-x rcd-paps-buffer-to-pdf-view RET} to get instant preview of
buffer.

and setup your options by {M-x customize-group RET rcd-paps RET}

It will improve in future.

`paps` utility is excellent for reason that it will produce PDF, PS,
SVG and that it will incldue Unicode characters correctly together
with emoji. ☺️

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/


P.S. When you see something like {M-x help} in curly brackets that is
GNU Hyperbole hyperlink that you may activate by M-RET provided you
installed GNU Hyperbole.



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

* Re: printing with paps
  2022-12-30 14:26                   ` Jean Louis
@ 2022-12-31 12:09                     ` Gottfried
  2022-12-31 22:53                       ` Jean Louis
  0 siblings, 1 reply; 147+ messages in thread
From: Gottfried @ 2022-12-31 12:09 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 1879 bytes --]

Hi Jean,

thanks very much for your help.

When I downloaded the new rcd-utilities.el
and I tried to install it
it gave me less mistakes
but didn’t install it.

here the message:
...................................................
Leaving directory ‘/home/gfp/.config/emacs/elpa/rcd-utilities-2.11’
\f
Compiling file 
/home/gfp/.config/emacs/elpa/rcd-utilities-2.11/rcd-utilities.el at Sat 
Dec 31 12:50:45 2022
Entering directory ‘/home/gfp/.config/emacs/elpa/rcd-utilities-2.11/’

In rcd-sql-current-weekday:
rcd-utilities.el:1087:60: Warning: reference to free variable ‘cf-db’
rcd-utilities.el:2720:1: Error: Symbol’s function definition is void: 
rcd-my-home
...........................................................

after that I installed rcd-paps.el
and there were no messages of mistakes

This means that I can't use it yet.

Kind regards

Gottfried



Am 30.12.22 um 15:26 schrieb Jean Louis:
> Hello,
> 
> Here is the improved package and you may do your own customizations
> for it.
> 
> GNU Emacs package: rcd-paps.el:
> https://gnu.support/gnu-emacs/packages/GNU-Emacs-package-rcd-paps-el-76862.html
> 
> 1. Download new rcd-utilities.el from
>     https://gnu.support/files/emacs/packages/rcd-utilities.el
> 
> 2. Install with M-x package-install-file
> 
> 3. Download rcd-paps.el from https://gnu.support/files/emacs/packages/rcd-paps/rcd-paps.el
> 
> 4. Install with M-x package-install-file
> 
> Then you can do following:
> 
> {M-x rcd-paps-buffer-to-pdf-view RET} to get instant preview of
> buffer.
> 
> and setup your options by {M-x customize-group RET rcd-paps RET}
> 
> It will improve in future.
> 
> `paps` utility is excellent for reason that it will produce PDF, PS,
> SVG and that it will incldue Unicode characters correctly together
> with emoji. ☺️
> 

-- 

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: printing with paps
  2022-12-31 12:09                     ` Gottfried
@ 2022-12-31 22:53                       ` Jean Louis
  2022-12-31 23:46                         ` Jean Louis
  0 siblings, 1 reply; 147+ messages in thread
From: Jean Louis @ 2022-12-31 22:53 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs@gnu.org

* Gottfried <gottfried@posteo.de> [2022-12-31 15:11]:
> Hi Jean,
> 
> thanks very much for your help.
> 
> When I downloaded the new rcd-utilities.el
> and I tried to install it
> it gave me less mistakes
> but didn’t install it.
> 
> here the message:
> ...................................................
> Leaving directory ‘/home/gfp/.config/emacs/elpa/rcd-utilities-2.11’
> \f
> Compiling file
> /home/gfp/.config/emacs/elpa/rcd-utilities-2.11/rcd-utilities.el at Sat Dec
> 31 12:50:45 2022
> Entering directory ‘/home/gfp/.config/emacs/elpa/rcd-utilities-2.11/’
> 
> In rcd-sql-current-weekday:
> rcd-utilities.el:1087:60: Warning: reference to free variable ‘cf-db’
> rcd-utilities.el:2720:1: Error: Symbol’s function definition is void:
> rcd-my-home
> ...........................................................

I have removed it the stuff that bothered, now it should work.

And I really hope you will start producing beautiful PDFs.

Frohes neues Jahr

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: printing with paps
  2022-12-31 22:53                       ` Jean Louis
@ 2022-12-31 23:46                         ` Jean Louis
  2023-01-01 14:24                           ` Gottfried
  0 siblings, 1 reply; 147+ messages in thread
From: Jean Louis @ 2022-12-31 23:46 UTC (permalink / raw)
  To: Gottfried, help-gnu-emacs@gnu.org

Look at GNU/Emacs TUTORIAL generated by using RCD Paps package as PDF file:
https://gnu.support/files/emacs/packages/rcd-paps/2023-01-01-02:42:51.pdf

Here are instructions how to customize headers and footer:
https://github.com/dov/paps/issues/30

They all take a string that is based on python f-strings. I have
defined the following variable that may be used in the definitions of
the headers:

    path - The complete path of the file being printed
    filename - The basename (without directory) of the file being printed
    mtime - The file's modification time
    now - The current time
    num_pages - The total number of pages in the document
    page_idx - The current page being printed

Here is an example of how it may be used:

paps --header-left="{now:%Y-%m-%d %H:%M}" --header-center="{filename}" --header-right="Page {page_idx:02d}/{num_pages:02d}" --header -o hello.pdf paps.cc

I will work on easier customization of header and footer.

It is so important to be able to generate PDF files for even simple text.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: printing with paps
  2022-12-31 23:46                         ` Jean Louis
@ 2023-01-01 14:24                           ` Gottfried
  2023-01-01 14:53                             ` Jean Louis
  0 siblings, 1 reply; 147+ messages in thread
From: Gottfried @ 2023-01-01 14:24 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org, Jean Louis


[-- Attachment #1.1.1: Type: text/plain, Size: 1706 bytes --]


Hi Jean,

thanks for help
I installed the new version 2.11 and deleted the version 2.10

I opened a text file
and wanted to print it
with
M-x rcd-paps-buffer-to-pdf-view RET

it gave me the answer

Symbol’s function definition is void: rcd-paps-process-buffer

and in the menu until now there is no change. The new more detailed 
options for printing (AFAIU) did never appear.

I don't know where the problem lies???

So I didn't to the point of customizing rcd-utilities yet.

Kind regards

Gottfried



Am 01.01.23 um 00:46 schrieb Jean Louis:
> Look at GNU/Emacs TUTORIAL generated by using RCD Paps package as PDF file:
> https://gnu.support/files/emacs/packages/rcd-paps/2023-01-01-02:42:51.pdf
> 
> Here are instructions how to customize headers and footer:
> https://github.com/dov/paps/issues/30
> 
> They all take a string that is based on python f-strings. I have
> defined the following variable that may be used in the definitions of
> the headers:
> 
>      path - The complete path of the file being printed
>      filename - The basename (without directory) of the file being printed
>      mtime - The file's modification time
>      now - The current time
>      num_pages - The total number of pages in the document
>      page_idx - The current page being printed
> 
> Here is an example of how it may be used:
> 
> paps --header-left="{now:%Y-%m-%d %H:%M}" --header-center="{filename}" --header-right="Page {page_idx:02d}/{num_pages:02d}" --header -o hello.pdf paps.cc
> 
> I will work on easier customization of header and footer.
> 
> It is so important to be able to generate PDF files for even simple text.
> 
> 

-- 



[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: printing with paps
  2023-01-01 14:24                           ` Gottfried
@ 2023-01-01 14:53                             ` Jean Louis
  0 siblings, 0 replies; 147+ messages in thread
From: Jean Louis @ 2023-01-01 14:53 UTC (permalink / raw)
  To: Gottfried; +Cc: help-gnu-emacs@gnu.org

* Gottfried <gottfried@posteo.de> [2023-01-01 17:24]:
> I installed the new version 2.11 and deleted the version 2.10
> 
> I opened a text file
> and wanted to print it
> with
> M-x rcd-paps-buffer-to-pdf-view RET
> 
> it gave me the answer
> 
> Symbol’s function definition is void: rcd-paps-process-buffer

OK, I have polished it, and tested it with Emacs -Q:

Download latest RCD Utilities 2.12:

https://gnu.support/files/emacs/packages/rcd-utilities.el

Download latest RCD paps 0.3:

https://gnu.support/files/emacs/packages/rcd-paps/rcd-paps.el

and I hope it will work.

New settings I did is for header and footer to have it easier, there
is completion choice, for:

header -- left, center, right
and
footer -- left, center, right

there will be completion choices like:

- current full file name

- current file name without directory

- EMPTY -- if you wish one of those fields to be empty, choose EMPTY,
  so "EMPTY" as word cannot be part of header and footer.

- Page {page_idx:02d}/{num_pages:02d} -- you can customize this to be
  for example "Seite {page_idx:02d} von {num_pages:02d}"

- Modified time and date {mtime:%Y-%m-%d %H:%M} -- but now I remember
  I did not program it, must program it to detect modified time
  through Emacs.

- Current time and date: {now:%Y-%m-%d %H:%M}, which you may customize
  how you wish and want.

- Number of pages: {num_pages:02d}

- Page number: {page_idx:02d}

And you can customize it yourself. If you happen to have problem to
insert space, use C-q SPC to insert it.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

end of thread, other threads:[~2023-01-01 14:53 UTC | newest]

Thread overview: 147+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14 16:38 wie kann ich Emacs so einstellen, dass ich drucken kann Gottfried
2022-12-14 17:27 ` Philip Kaludercic
2022-12-16 15:27   ` printing Gottfried
2022-12-16 22:26     ` printing Michael Heerdegen
2022-12-17  6:29       ` printing tomas
2022-12-17  7:41         ` printing Emanuel Berg
2022-12-17 13:48     ` printing Gottfried
2022-12-17 16:30       ` printing tomas
2022-12-14 21:30 ` wie kann ich Emacs so einstellen, dass ich drucken kann Michael Heerdegen
2022-12-17  9:00 ` Jean Louis
2022-12-17  9:29   ` Michael Heerdegen
2022-12-17  9:41     ` Jean Louis
2022-12-17 10:34       ` Michael Heerdegen
2022-12-17 10:39         ` Michael Heerdegen
2022-12-18  8:04   ` Eduardo Ochs
2022-12-18 17:18     ` Jean Louis
2022-12-18 22:34       ` rcd-paps.el (was: Re: wie kann ich Emacs...) Eduardo Ochs
2022-12-19 12:50         ` rcd-paps.el Jean Louis
2022-12-18 12:06   ` wie kann ich Emacs so einstellen, dass ich drucken kann Gottfried
2022-12-18 17:20     ` Jean Louis
2022-12-19 13:49       ` Gottfried
2022-12-19 17:19         ` Jean Louis
2022-12-27 16:10           ` wie kann ich Emacs so einstellen, dass ich drucken kann (printing in Emacs) Gottfried
2022-12-27 17:35             ` Jean Louis
2022-12-27 16:39           ` wie kann ich Emacs so einstellen, dass ich drucken kann (printing with paps) Gottfried
2022-12-27 16:47             ` Gottfried
2022-12-27 17:37               ` Jean Louis
2022-12-28 16:31                 ` printing with paps Gottfried
2022-12-30 14:26                   ` Jean Louis
2022-12-31 12:09                     ` Gottfried
2022-12-31 22:53                       ` Jean Louis
2022-12-31 23:46                         ` Jean Louis
2023-01-01 14:24                           ` Gottfried
2023-01-01 14:53                             ` Jean Louis
  -- strict thread matches above, loose matches on Subject: below --
2022-12-17 12:31 printing Gottfried
2022-12-17 13:09 ` printing tomas
2016-03-03 14:35 Printing Sharon Kimble
2016-03-03 20:22 ` Printing tomas
2016-03-05 13:40 ` Printing Robert Thorpe
2009-04-01 17:22 Printing grischka
2009-04-01 18:55 ` Printing David De La Harpe Golden
2009-04-01 18:58   ` Printing David De La Harpe Golden
2009-04-01 20:51   ` Printing grischka
2009-04-01 21:19   ` Printing Lennart Borgman
2009-04-02  0:09   ` Printing David De La Harpe Golden
2009-04-01 23:32 ` Printing Stefan Monnier
2009-04-02  2:33   ` Printing grischka
2009-04-02  3:05     ` Printing Samuel Bronson
2009-04-02 13:41       ` Printing grischka
2009-04-02 13:31     ` Printing Stefan Monnier
2009-04-02 18:39       ` Printing grischka
2009-04-02 18:53         ` Printing Stefan Monnier
2009-03-28 10:31 Printing Андрей Парамонов
2009-03-28 14:56 ` Printing Jan Djärv
2009-03-31  2:13   ` Printing YAMAMOTO Mitsuharu
2009-04-02  9:39     ` Printing YAMAMOTO Mitsuharu
2009-04-04  2:44       ` Printing YAMAMOTO Mitsuharu
2009-04-04  6:54         ` Printing Lennart Borgman
2009-04-04  7:25           ` Printing YAMAMOTO Mitsuharu
2009-04-04  9:40         ` Printing Leo
2009-04-04 22:00         ` Printing Richard M Stallman
2009-04-05  1:07           ` Printing YAMAMOTO Mitsuharu
2009-04-06  8:03         ` Printing Kenichi Handa
2009-04-06  8:45           ` Printing YAMAMOTO Mitsuharu
2009-04-06 11:47             ` Printing Kenichi Handa
2009-04-06 23:47               ` Printing YAMAMOTO Mitsuharu
2009-04-07  1:01                 ` Printing Kenichi Handa
2009-04-07  1:14                   ` Printing YAMAMOTO Mitsuharu
2009-04-07  9:46         ` Printing YAMAMOTO Mitsuharu
2009-04-08  1:33           ` Printing Kenichi Handa
2009-05-01 23:30             ` Printing YAMAMOTO Mitsuharu
2009-04-19 10:21           ` Printing YAMAMOTO Mitsuharu
2012-05-05  3:06             ` Printing Stefan Monnier
2012-05-07  3:38               ` Printing YAMAMOTO Mitsuharu
2012-05-07 11:25                 ` Printing Lennart Borgman
2012-05-08  1:04                   ` Printing YAMAMOTO Mitsuharu
2012-05-08  1:25                     ` Printing Lennart Borgman
2012-05-08  2:15                       ` Printing YAMAMOTO Mitsuharu
2012-05-08 10:59                         ` Printing Lennart Borgman
2012-05-09 14:50                   ` Printing Jason Rumney
2012-05-09 14:58                     ` Printing Lennart Borgman
2012-05-07 12:46                 ` Printing Stefan Monnier
2012-05-07 13:07                   ` Printing joakim
2012-05-07 17:20                   ` Printing Simon Leinen
2012-05-08  1:11                     ` Printing YAMAMOTO Mitsuharu
2009-03-28 15:46 ` Printing Michael Ekstrand
2009-03-28 18:37 ` Printing Stefan Monnier
2009-03-28 20:52   ` Printing Андрей Парамонов
2009-03-30 13:06     ` Printing Michael Ekstrand
2009-03-30 15:24       ` Printing Stefan Monnier
2009-03-30 18:38         ` Printing Eli Zaretskii
2009-03-31  1:56           ` Printing Stefan Monnier
2009-03-31  3:15             ` Printing Eli Zaretskii
2009-04-01  0:52               ` Printing Stefan Monnier
2009-04-01  3:14                 ` Printing Eli Zaretskii
2009-04-01  4:17                   ` Printing Miles Bader
2009-04-01 17:53                     ` Printing Eli Zaretskii
2009-04-01  4:24                   ` Printing Jason Rumney
2009-04-01 17:56                     ` Printing Eli Zaretskii
2009-04-01  8:11                   ` Printing Stephen J. Turnbull
2009-04-01 14:36                   ` Printing Stefan Monnier
2009-04-01 18:16                     ` Printing Eli Zaretskii
2009-04-01 23:42                       ` Printing Stefan Monnier
2009-04-02 13:02                       ` Printing Richard M Stallman
2009-04-02 19:37                         ` Printing Eli Zaretskii
2009-04-02 10:08                   ` Printing tomas
2009-04-02 10:52                     ` Printing Lennart Borgman
2009-04-02 11:51                       ` Printing tomas
2009-04-02 11:49                         ` Printing Lennart Borgman
2009-04-02 13:37                           ` Printing Stefan Monnier
2009-04-02 13:47                             ` Printing Óscar Fuentes
2009-04-02 13:55                               ` Printing Samuel Bronson
2009-04-02 14:24                                 ` Printing Óscar Fuentes
2009-04-02 14:34                                   ` Printing Lennart Borgman
2009-04-02 14:00                             ` Printing Lennart Borgman
2009-04-02 16:15                               ` Printing Stefan Monnier
2009-04-02 16:47                                 ` Printing Reiner Steib
2009-04-02 19:44                                 ` Printing Eli Zaretskii
2009-04-03  0:43                                   ` Printing Stefan Monnier
2009-04-02 20:56                                 ` Printing Lennart Borgman
2009-04-04  0:00                                   ` Printing Lennart Borgman
2009-04-04  0:36                                     ` Printing Stefan Monnier
2009-04-04  0:45                                       ` Printing Lennart Borgman
2009-04-04  1:05                                         ` Printing Óscar Fuentes
2009-04-04  6:52                                           ` Printing Lennart Borgman
2009-04-04  8:57                                     ` Printing Eli Zaretskii
2009-04-04  9:22                                       ` Printing Lennart Borgman
2009-04-04  9:49                                         ` Printing Eli Zaretskii
2009-03-28 20:30 ` Printing James Cloos
2009-03-29  2:15 ` Printing Richard M Stallman
2009-03-29  3:20   ` Printing Eli Zaretskii
2009-03-30  1:17     ` Printing Richard M Stallman
2009-03-30  3:10       ` Printing Eli Zaretskii
2009-03-30  6:36         ` Printing Lennart Borgman
2009-03-30 18:41           ` Printing Eli Zaretskii
2009-03-30 19:04             ` Printing Lennart Borgman
2009-03-30 20:48               ` Printing Eli Zaretskii
2009-03-30 20:53                 ` Printing Lennart Borgman
2009-03-30 20:59                   ` Printing Eli Zaretskii
2009-03-30 21:27                     ` Printing Lennart Borgman
2009-03-31  3:19                       ` Printing Eli Zaretskii
2009-03-30 21:46                   ` Printing Óscar Fuentes
2009-03-30 21:50         ` Printing Richard M Stallman
2009-03-31  3:18           ` Printing Eli Zaretskii
2009-03-31 19:14             ` Printing Richard M Stallman
2009-03-30 18:03   ` Printing Андрей Парамонов
2003-03-18 21:18 printing Kevin Reeder

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.