suse 7.3 xemacs(mule) printing problem
How to tweak xemacs to print text files (including Japanese text)? My
Suse 7.3 (german, professional) xemacs with Japanese support sends the
text to the apsfilter but a2ps then fails. Sending euc encoded files
directly to a2ps produces bakemoji, so my a2ps seems not to support
Japanese. Is there a simpler solution than replacing a2ps with a
patched version (as in http://www.on.cs.keio.ac.jp/~yasu/jp_a2ps.html)
when I have all Japanese packages from Suse 7.3 (german, professional,
dvd) installed? Also, there seems to be some unrelated encoding
problem (see the end of this memo) that makes a2ps think a shifted-jis
encoded file was sent to it instead of the normal euc encoded one
(that is specified in xemacs).
Printing Japanese html pages from netscape works fine, and gs can
print latex'ed Japanese files fine.
Some details:
# a2ps --version
GNU a2ps 4.13
After the failed printing from xemacs, I get the following mail
From: (STDIN)
Wolfgang Slany
How to tweak xemacs to print text files (including Japanese text)?
I think that doesn't work yet from XEmacs, unfortunately.
My Suse 7.3 (german, professional) xemacs with Japanese support sends the text to the apsfilter but a2ps then fails. Sending euc encoded files directly to a2ps produces bakemoji, so my a2ps seems not to support Japanese. Is there a simpler solution than replacing a2ps with a patched version (as in http://www.on.cs.keio.ac.jp/~yasu/jp_a2ps.html) when I have all Japanese packages from Suse 7.3 (german, professional, dvd) installed?
There is the Perl script a2ps.pl by Kazumasa Utashiro
Printing Japanese html pages from netscape works fine, and gs can print latex'ed Japanese files fine.
Then you will be able to print the files produced by a2ps.pl without problems with lpr, or you can directly pipe the output of a2ps to lpr. [...]
Additionally, lpq -lllll reports (first failure after issuing a M-x ps-print-buffer, second failure after pressing the "Print" button):
user@linux:~> lpq -lllll Printer: lp@linux 'y2prn_lp.upp auto'
[...]
Status: IF filter 'y2prn_lp.upp--auto-lp' filter msg - 'a2ps: unknown encoding `ja_jp.sjis'' at 09:43:49.574
[...]
As mentioned in the beginning, the "unknown encoding `ja_jp.sjis'" is also weird
I don't know where this ja_jp.sjis comes from.
since (I believe) I set xemacs to encode files as euc-jp. I may be wrong, but I copied everything from http://www.suse.de/~mfabian/suse-cjk/emacs-and-xemacs.html to my ~/.xemacs/init.el file.
That file sets the default coding system for new buffers to iso-2022-8:
(when (string-match "XEmacs" emacs-version)
(set-default-buffer-file-coding-system 'iso-2022-8))
See 'M-x describe-variable RET buffer-file-coding-system RET' on why
this is a good choice. Setting this to iso-2022-jp or euc-jp instead
causes problems with international mail in Gnus.
But anyway, the buffer-file-coding-system has nothing to do with
your problem. You wrote that you used 'M-x ps-print-buffer'.
This should produce a correct PostScript file independent
of the buffer-file-coding-system. buffer-file-coding-system is only
relevant for IO to disk.
But converting the buffer contents to PostScript happens within XEmacs
where the internal buffer representation is used (internal mule
encoding). This internal buffer representation has all the information
about the charsets used in the buffer and ps-print.el should be able
to generate a correct PostScript file from that. But the current
implementation of ps-print.el in XEmacs is not multibyte capable and
if you have Japanese characters in the buffer, the resulting
PostScript file is just wrong. You can have a look at the PostScript
file by using
C-u M-x ps-print-buffer RET filename.ps RET
This works much better in GNU Emacs (20.7 or 21.x). GNU Emacs has a
'better' multibyte capable implementation of ps-print.el.
Have a look at the top part of
/usr/share/emacs/20.7/lisp/ps-mule.el
to see how to use it.
For Japanese, use
(setq ps-multibyte-buffer 'non-latin-printer)
then you will get PostScript output which uses the fonts in the
Printer or Ghostscript which look nice.
If you want to print all sorts of languages together, you can install
ftp://ftp.suse.com/pub/suse/i386/7.3/suse/gra2/intlfonts-bdf.rpm
and then use
(setq ps-multibyte-buffer 'bdf-font)
Using that you can even print everything displayed on the 'hello page'
(M-x view-hello-file), but bitmap fonts will be embedded in the
PostScript output which will look quite ugly.
Personally I use mainly XEmacs and when I want to print a buffer
containing Japanese I save it to disk first and use a2ps.pl.
Of course it would be nice to have a better ps-print.el in XEmacs
as well and when I find some time I want to try whether I
can make the ps-print.el from GNU Emacs work with XEmacs.
--
Mike Fabian
On Thu, 18 Apr 2002, Mike Fabian wrote:
Wolfgang Slany
writes: How to tweak xemacs to print text files (including Japanese text)?
I think that doesn't work yet from XEmacs, unfortunately.
[...]
There is the Perl script a2ps.pl by Kazumasa Utashiro
[...]
I'm almost sure that it is already available on the German SuSE Linux 7.3 CDs/DVD. If not it can be downloaded here:
ftp://ftp.suse.com/pub/suse/i386/7.3/suse/j2/a2ps-perl-ja.rpm
The command line options of a2ps.pl are completely different to those of the a2ps. Have a look at the output of 'a2ps -help'.
[...]
This PostScript file can be printed on a Japanese PostScript printer or with Ghostscript which is automatically used by the SuSE print filter system if you have configured your printer as a non-PostScript printer.
a2ps.pl was indeed installed and prints the Japanese files as described. To get xemacs to print from the button, I added the following Perl script to /usr/bin: a2ps-lpr.pl: ============================================================== #!/usr/bin/perl ;# ;# a2ps-lpr.pl: ascii to ps | lpr ;# open F, "| a2ps.pl -p -ns -nh -nt -fx1.5 | lpr"; while (<>) { print F; } close F; =============================================================== Additionally, I added the following lines to /home/user/.xemacs/init.el: =============================================================== ;;---------------------------------------------------------------------- ;; Print Japanese: (when (string-match "XEmacs" emacs-version) (setq lpr-command "a2ps-lpr.pl")) =============================================================== Many thanks and best regards, Wolfgang Wolfgang SLANY mailto:wsi@dbai.tuwien.ac.at
Wolfgang Slany
a2ps.pl was indeed installed and prints the Japanese files as described. To get xemacs to print from the button, I added the following Perl script to /usr/bin:
a2ps-lpr.pl: ============================================================== #!/usr/bin/perl ;# ;# a2ps-lpr.pl: ascii to ps | lpr ;#
open F, "| a2ps.pl -p -ns -nh -nt -fx1.5 | lpr";
while (<>) { print F; }
close F; ===============================================================
Additionally, I added the following lines to /home/user/.xemacs/init.el: ===============================================================
;;---------------------------------------------------------------------- ;; Print Japanese:
(when (string-match "XEmacs" emacs-version) (setq lpr-command "a2ps-lpr.pl")) ===============================================================
Good idea! That's a really convenient workaround.
I wrote that I wanted to try whether the ps-print.el of GNU Emacs can
be made to work with XEmacs. It looks like somebody has already done
this and recent versions of the XEmacs Sumo tarballs already contain a
recent version of ps-print.el taken from GNU Emacs.
I.e. ps-print.el for XEmacs will likely work as soon as I update
XEmacs.
I'll try to do that during the next weeks and upload the new rpms to
the SuSE ftp server.
--
Mike Fabian
When building Magicpoint (mgp.rpm) for SuSE Linux 8.0, a configure
option was forgotten which is necessary to support CJK TrueType
fonts via freetype.
A fixed package which works with CJK TrueType fonts is available here:
ftp://ftp.suse.com/pub/people/mfabian/8.0-i386/mgp.rpm
Description :
MagicPoint is a X11-based presentation tool. It is designed to make
simple presentations easy while to make complicated presentations
possible. Its presentation file (whose suffix is typically .mgp) is
just text so that you can create presentation files quickly with your
favorite editor (e.g. Emacs). The package also includes the tools mgp2html,
mgp2ps and mgp2latex, which convert mgp-Presentations into other file formats.
Authors:
--------
Yoshifumi Nishida
Mike Fabian
I.e. ps-print.el for XEmacs will likely work as soon as I update XEmacs.
I have updated the XEmacs packages for SuSE Linux now.
The core XEmacs is updated to version 21.4.6 and the lisp packages are
updated to the Sumo packages release from 2002-03-29.
The updated packages are available here:
ftp://ftp.suse.com/pub/people/mfabian/8.0-i386/xemacs-21.4.6-3.i386.rpm
ftp://ftp.suse.com/pub/people/mfabian/8.0-i386/xemacs-el-21.4.6-3.i386.rpm
ftp://ftp.suse.com/pub/people/mfabian/8.0-i386/xemacs-info-21.4.6-3.i386.rpm
ftp://ftp.suse.com/pub/people/mfabian/8.0-src/xemacs-21.4.6-3.src.rpm
Using these packages,
M-x ps-print-buffer
and
M-x ps-print-buffer-with-faces
or the 'pretty print' entry in the file menu work for CJK and many
other languages now. When using these functions to print, XEmacs will
generate the PostScript, you don't need any external a2ps converter
[1].
Extract from the comments at the top of
/usr/share/xemacs/xemacs-packages/lisp/ps-print/ps-mule.el
which explains the options to control the font selection for
multilingual printing:
;; Printing Multi-byte Buffer
;; --------------------------
;;
;; The variable `ps-multibyte-buffer' specifies the ps-print multi-byte buffer
;; handling.
;;
;; Valid values for `ps-multibyte-buffer' are:
;;
;; nil This is the value to use the default settings which
;; is by default for printing buffer with only ASCII
;; and Latin characters. The default setting can be
;; changed by setting the variable
;; `ps-mule-font-info-database-default' differently.
;; The initial value of this variable is
;; `ps-mule-font-info-database-latin' (see
;; documentation).
;;
;; `non-latin-printer' This is the value to use when you have a japanese
;; or korean PostScript printer and want to print
;; buffer with ASCII, Latin-1, Japanese (JISX0208 and
;; JISX0201-Kana) and Korean characters. At present,
;; it was not tested the Korean characters printing.
;; If you have a korean PostScript printer, please,
;; test it.
;;
;; `bdf-font' This is the value to use when you want to print
;; buffer with BDF fonts. BDF fonts include both latin
;; and non-latin fonts. BDF (Bitmap Distribution
;; Format) is a format used for distributing X's font
;; source file. BDF fonts are included in
;; `intlfonts-1.2' which is a collection of X11 fonts
;; for all characters supported by Emacs. In order to
;; use this value, be sure to have installed
;; `intlfonts-1.2' and set the variable
;; `bdf-directory-list' appropriately (see ps-bdf.el
;; for documentation of this variable).
;;
;; `bdf-font-except-latin' This is like `bdf-font' except that it is used
;; PostScript default fonts to print ASCII and Latin-1
;; characters. This is convenient when you want or
;; need to use both latin and non-latin characters on
;; the same buffer. See `ps-font-family',
;; `ps-header-font-family' and `ps-font-info-database'.
;;
;; Any other value is treated as nil.
;;
;; The default is nil.
If you want to print only ASCII, Latin-1 and Japanese
(setq ps-multibyte-buffer 'non-latin-printer)
is best because PostScript fonts are used which look nice.
When using bitmap fonts for printing with
(setq ps-multibyte-buffer 'bdf-font)
you can print more different languages (but of course
using low resolution bitmap fonts will look less beautiful,
so this is not a good setting of you want to print only Japanese).
For the printing with bitmap fonts you also need the GNU intlfonts in
bdf format, available here for SuSE Linux 7.3 and 8.0:
ftp://ftp.suse.com/pub/suse/i386/7.3/suse/gra2/intlfonts-bdf.rpm
With these fonts you can print most languages from the HELLO page
M-x view-hello-file
except Amharic, Thai, and Tigrina. These three languages can be
printed with GNU Emacs but not yet with XEmacs.
I had to patch ps-mule.el a little bit to make printing with bdf-fonts
work at all with XEmacs, but I could not yet find out how to make it
work for Amharic, Thai, and Tigrigna.
Therefore, when you want to test bdf-font printing with the hello
file, remove the lines with theses languages, otherwise you will get
an error (or, better, don't remove these lines, find out how to make
it work and tell me :-)).
Footnotes:
[1] for Wolfgang: this means you must remove your
(setq lpr-command "a2ps-lpr.pl")
hack if you want to use these new features.
Otherwise a2ps.pl will do a ASCII -> PostScript conversion
again on the output which is already PostScript.
--
Mike Fabian
participants (2)
-
Mike Fabian
-
Wolfgang Slany