unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Tobias Bora <tobias.bora@gmail.com>
Cc: 17758@debbugs.gnu.org
Subject: bug#17758: 24.3; The line isn't wrapped during printing if it contains non ascii chars
Date: Sat, 29 May 2021 07:38:15 +0200	[thread overview]
Message-ID: <87v972rtfc.fsf@gnus.org> (raw)
In-Reply-To: <877g4nm9c1.fsf@leo-kub-port.i-did-not-set--mail-host-address--so-tickle-me> (Tobias Bora's message of "Wed, 11 Jun 2014 23:21:02 +0200")

Tobias Bora <tobias.bora@gmail.com> writes:

> I saw a bug (and I'm not the only one to notice it) with printing a
> document with emacs. Indeed when there is a non ascii char in a line
> (for example 'e') the line isn't wrapped in the output .ps file.

(I'm going through old bug reports that unfortunately got little response at
the time.)

This is due to this code:

(defun ps-mule-plot-string (from to &optional _bg-color)
[...]
	 (ascii-or-latin-1 "[\000-\377]+")
[...]
	    ((looking-at ascii-or-latin-1)
	     (let ((nchars (- (min (match-end 0) stop) (point))))
	       (setq width (* average-width nchars))
	       (if (< ps-width-remaining (+ run-width width))
		   (setq nchars (truncate (- ps-width-remaining run-width)
					  average-width)
			 run-width (+ run-width (* nchars average-width))
			 endpos (+ (point) nchars))
		 (setq run-width (+ run-width width))
		 (forward-char nchars))))

	    (t
	     (while (and (< (point) stop) (not endpos))
	       (setq width (char-width (following-char)))
	       (if (< ps-width-remaining (+ run-width width))
		   (setq endpos (point))
		 (setq run-width (+ run-width width))
		 (forward-char 1))))))

This is trying to do word line wrapping if we're looking at ASCII or
Latin-1 text.  (I'm not sure I understand the reasoning behind that, but
perhaps it's because we don't want to wrap (say) Chinese text?  But...
what's so special about Latin-1?  Why not fold Cyrillic?)

Anyway, the regexp is buggy, why is why this doesn't work.  I've now
fixed this in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  parent reply	other threads:[~2021-05-29  5:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 21:21 bug#17758: 24.3; The line isn't wrapped during printing if it contains non ascii chars Tobias Bora
2016-02-13 11:07 ` Marcin Borkowski
2021-05-29  5:38 ` Lars Ingebrigtsen [this message]
2021-05-29  6:38   ` Eli Zaretskii
2021-05-29  6:41     ` Lars Ingebrigtsen
2021-05-29  7:01       ` Eli Zaretskii
2021-05-29  8:19         ` Andreas Schwab
2021-05-29  8:09 ` Mattias Engdegård
2021-05-30  4:04   ` Lars Ingebrigtsen
2021-05-30 10:20     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v972rtfc.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=17758@debbugs.gnu.org \
    --cc=tobias.bora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).