unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Print eight-bit-* characters with ps-print
@ 2002-05-12 16:31 Eli Zaretskii
  2002-05-13 14:19 ` Richard Stallman
  2002-05-13 14:19 ` Richard Stallman
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2002-05-12 16:31 UTC (permalink / raw)
  Cc: handa, vinicius

I use ps-print a lot, and it annoys me that it whines about
eight-bit-control and eight-bit-graphic characters not having fonts to
print them with.  (These charsets are Emacs's invention, so there's no
chance anyone will ever have a font for them.)

So I came up with the change below.  It doesn't really print the same
glyphs you see on your screen--that's impossible without knowing what
fonts are available to your printer or PostScript interpreter.  But at
least the whining is gone, and for many cases, such as those \222
characters and Latin-1 email messages sent as ``charset=US-ASCII'', it
does DTRT.

Opinions?

(Btw, it looks like iso-safe can safely encode eight-bit-* characters.
If that's true, I think we should update its doc string.  Handa-san,
can you please comment on this?)


2002-05-12  Eli Zaretskii  <eliz@is.elta.co.il>

	* ps-mule.el (ps-mule-font-info-database-ps-eight-bit): New defconst.
	(ps-mule-font-info-database-ps-bdf): Print eight-bit-* characters
	through ps-mule-font-info-database-ps-eight-bit.


*** lisp/ps-mule.e~1	Sun May  5 09:58:10 2002
--- lisp/ps-mule.el	Sun May 12 13:34:00 2002
***************
*** 439,447 ****
  
  See also `ps-mule-font-info-database-ps-bdf'.")
  
  (defconst ps-mule-font-info-database-ps-bdf
!   (cons (car ps-mule-font-info-database-latin)
! 	(cdr (cdr ps-mule-font-info-database-bdf)))
    "Sample setting of the `ps-mule-font-info-database' to use BDF fonts.
  
  Current default value list for BDF fonts is included in `intlfonts-1.2'
--- 439,456 ----
  
  See also `ps-mule-font-info-database-ps-bdf'.")
  
+ (defconst ps-mule-font-info-database-ps-eight-bit
+   '((eight-bit-control
+      (normal nil nil iso-safe))
+     (eight-bit-graphic
+      (normal nil nil iso-safe)))
+   "Sample setting of `ps-mule-font-info-database' for random 8-bit bytes.")
+ 
  (defconst ps-mule-font-info-database-ps-bdf
!   (list (car ps-mule-font-info-database-latin)
! 	(car (cdr (cdr ps-mule-font-info-database-bdf)))
! 	(car ps-mule-font-info-database-ps-eight-bit)
! 	(car (cdr ps-mule-font-info-database-ps-eight-bit)))
    "Sample setting of the `ps-mule-font-info-database' to use BDF fonts.
  
  Current default value list for BDF fonts is included in `intlfonts-1.2'

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

* Re: Print eight-bit-* characters with ps-print
@ 2002-05-13  6:23 Kenichi Handa
  2002-05-17 14:21 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Kenichi Handa @ 2002-05-13  6:23 UTC (permalink / raw)
  Cc: emacs-devel, vinicius

"Eli Zaretskii" <eliz@is.elta.co.il> writes:
> I use ps-print a lot, and it annoys me that it whines about
> eight-bit-control and eight-bit-graphic characters not having fonts to
> print them with.  (These charsets are Emacs's invention, so there's no
> chance anyone will ever have a font for them.)

> So I came up with the change below.  It doesn't really print the same
> glyphs you see on your screen--that's impossible without knowing what
> fonts are available to your printer or PostScript interpreter.  But at
> least the whining is gone, and for many cases, such as those \222
> characters and Latin-1 email messages sent as ``charset=US-ASCII'', it
> does DTRT.

We already have a function ps-control-character that
properly print control codes, eight-bit-control, and
eight-bit-graphic.

So, to just stop whining about eight-bit-*, what we need is
to delete eight-bit-control and eight-bit-graphic from
charsets in this code (in ps-mule-begin-job of ps-mule.el):

       ;; Initialize `ps-mule-charset-list'.  If some characters aren't
       ;; printable, warn it.
       (let ((charsets (find-charset-region from to)))
	 (setq charsets (delq 'ascii (delq 'unknown (delq nil charsets)))
	       ps-mule-charset-list charsets)

Please try to add more delq for eight-bit-* here, and set
ps-print-control-characters to `8-bit' (the default is
`8-bit-control').  Then all eight-bit-* should be printed in
octal form.  Isn't it what you want?

> (Btw, it looks like iso-safe can safely encode eight-bit-* characters.
> If that's true, I think we should update its doc string.  Handa-san,
> can you please comment on this?)

This is a difficult part.  Currently, as far as I remember
all coding-systems encode them as is.  They are treated as
special bytes that should be written out as is.  I'm not
sure whether or not we should make iso-safe as an exception.
Instead, how about documenting clearly that there's a super
rule that any coding system encodes eight-bit-* as is?

---
Ken'ichi HANDA
handa@etl.go.jp

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

* Re: Print eight-bit-* characters with ps-print
  2002-05-12 16:31 Print eight-bit-* characters with ps-print Eli Zaretskii
  2002-05-13 14:19 ` Richard Stallman
@ 2002-05-13 14:19 ` Richard Stallman
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2002-05-13 14:19 UTC (permalink / raw)
  Cc: emacs-devel, handa, vinicius

    So I came up with the change below.  It doesn't really print the same
    glyphs you see on your screen--that's impossible without knowing what
    fonts are available to your printer or PostScript interpreter.  But at
    least the whining is gone, and for many cases, such as those \222
    characters and Latin-1 email messages sent as ``charset=US-ASCII'', it
    does DTRT.

It sounds like a good idea to me.

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

* Re: Print eight-bit-* characters with ps-print
  2002-05-12 16:31 Print eight-bit-* characters with ps-print Eli Zaretskii
@ 2002-05-13 14:19 ` Richard Stallman
  2002-05-13 14:19 ` Richard Stallman
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2002-05-13 14:19 UTC (permalink / raw)
  Cc: emacs-devel, handa, vinicius

    So I came up with the change below.  It doesn't really print the same
    glyphs you see on your screen--that's impossible without knowing what
    fonts are available to your printer or PostScript interpreter.  But at
    least the whining is gone, and for many cases, such as those \222
    characters and Latin-1 email messages sent as ``charset=US-ASCII'', it
    does DTRT.

It sounds like a good idea to me.

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

* Re: Print eight-bit-* characters with ps-print
  2002-05-13  6:23 Kenichi Handa
@ 2002-05-17 14:21 ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2002-05-17 14:21 UTC (permalink / raw)
  Cc: emacs-devel, vinicius

> Date: Mon, 13 May 2002 15:23:29 +0900 (JST)
> From: Kenichi Handa <handa@etl.go.jp>
> 
> Please try to add more delq for eight-bit-* here, and set
> ps-print-control-characters to `8-bit' (the default is
> `8-bit-control').  Then all eight-bit-* should be printed in
> octal form.  Isn't it what you want?

Well, having eight-bit-* characters printed as octal escapes is less
than optimal.  The code I posted does slightly better: it prints them
in the default font built into the PostScript printer (usually
Latin-1).

As I said, this is not 100% correct, but in many cases it matches what
you see on the screen.  And it certainly is nicer than the octal
escapes.

> > (Btw, it looks like iso-safe can safely encode eight-bit-* characters.
> > If that's true, I think we should update its doc string.  Handa-san,
> > can you please comment on this?)
> 
> This is a difficult part.  Currently, as far as I remember
> all coding-systems encode them as is.  They are treated as
> special bytes that should be written out as is.  I'm not
> sure whether or not we should make iso-safe as an exception.
> Instead, how about documenting clearly that there's a super
> rule that any coding system encodes eight-bit-* as is?

I will look for a proper place, thanks.

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

* Re: Print eight-bit-* characters with ps-print
@ 2002-05-20  0:32 Kenichi Handa
  0 siblings, 0 replies; 6+ messages in thread
From: Kenichi Handa @ 2002-05-20  0:32 UTC (permalink / raw)
  Cc: emacs-devel, vinicius

"Eli Zaretskii" <eliz@is.elta.co.il> writes:
>>  Please try to add more delq for eight-bit-* here, and set
>>  ps-print-control-characters to `8-bit' (the default is
>>  `8-bit-control').  Then all eight-bit-* should be printed in
>>  octal form.  Isn't it what you want?

> Well, having eight-bit-* characters printed as octal escapes is less
> than optimal.  The code I posted does slightly better: it prints them
> in the default font built into the PostScript printer (usually
> Latin-1).

> As I said, this is not 100% correct, but in many cases it matches what
> you see on the screen.  And it certainly is nicer than the octal
> escapes.

Ah, I think I see your point.  Printing such a character by
octal or a glyph of the same code of ASCII font should be
controlled by ps-print-control-characters.  But, in the
latter case, the ASCII font should by the builtin font found
in ps-font-info-database, not what specified in
ps-mule-font-info-database (e.g. "lt1-24-etl.bdf" if
ps-multibyte-buffer is bdf-font).  Is that what you mean?

Then, I agree with your change.  But, anyway, we must delete
eight-bit-* from `charset' variable because we should avoid
that unnecessary warning "Font for some characters not
found, ..." even if ps-multibyte-buffer is nil.

>>  > (Btw, it looks like iso-safe can safely encode eight-bit-* characters.
>>  > If that's true, I think we should update its doc string.  Handa-san,
>>  > can you please comment on this?)
>>  
>>  This is a difficult part.  Currently, as far as I remember
>>  all coding-systems encode them as is.  They are treated as
>>  special bytes that should be written out as is.  I'm not
>>  sure whether or not we should make iso-safe as an exception.
>>  Instead, how about documenting clearly that there's a super
>>  rule that any coding system encodes eight-bit-* as is?

> I will look for a proper place, thanks.

Thank you.

---
Ken'ichi HANDA
handa@etl.go.jp

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

end of thread, other threads:[~2002-05-20  0:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-12 16:31 Print eight-bit-* characters with ps-print Eli Zaretskii
2002-05-13 14:19 ` Richard Stallman
2002-05-13 14:19 ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2002-05-13  6:23 Kenichi Handa
2002-05-17 14:21 ` Eli Zaretskii
2002-05-20  0:32 Kenichi Handa

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).