aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2008-02-20 12:18:29 +0000
committerKenichi Handa2008-02-20 12:18:29 +0000
commit91382ad9ec40a416d11d19bad0e5b5ef067fbb23 (patch)
tree4ed69845c18e1709917447e1ae84dd1d77656209
parent31e25350a8293708ce4fa08cfe3ad119bd728fd8 (diff)
downloademacs-91382ad9ec40a416d11d19bad0e5b5ef067fbb23.tar.gz
emacs-91382ad9ec40a416d11d19bad0e5b5ef067fbb23.zip
(ps-mule-encode-region): Return a single string.
(ps-mule-plot-string): Adjusted for the above change. (ps-mule-encode-header-string): Likewise.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/ps-mule.el63
2 files changed, 28 insertions, 39 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2822844a981..150edfbc091 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -13,6 +13,10 @@
13 13
142008-02-20 Kenichi Handa <handa@ni.aist.go.jp> 142008-02-20 Kenichi Handa <handa@ni.aist.go.jp>
15 15
16 * ps-mule.el (ps-mule-encode-region): Return a single string.
17 (ps-mule-plot-string): Adjusted for the above change.
18 (ps-mule-encode-header-string): Likewise.
19
16 * international/latin1-disp.el (latin1-display): Don't use 20 * international/latin1-disp.el (latin1-display): Don't use
17 ucs-mule-8859-to-mule-unicode. Fix the way of resetting 21 ucs-mule-8859-to-mule-unicode. Fix the way of resetting
18 standard-display-table. 22 standard-display-table.
diff --git a/lisp/ps-mule.el b/lisp/ps-mule.el
index 36a359f1a9c..e0bd93070f8 100644
--- a/lisp/ps-mule.el
+++ b/lisp/ps-mule.el
@@ -579,10 +579,7 @@ FONT-SPEC-TABLE is 0, 1, 2, 3, 4, 5, or 6, each represents font tags f0, f1,
579f2, f3, h0, h1, and H0 respectively." 579f2, f3, h0, h1, and H0 respectively."
580 (let* ((font-spec nil) 580 (let* ((font-spec nil)
581 (font-id 0) 581 (font-id 0)
582 (string-list nil) 582 (code-list nil))
583 ;; At most 4-byte (EscChar FONT-ID CODE1 CODE2) per character.
584 (str (make-string (* (- to from) 4) 0))
585 (i 0))
586 (goto-char from) 583 (goto-char from)
587 (while (< (point) to) 584 (while (< (point) to)
588 (let* ((char (following-char)) 585 (let* ((char (following-char))
@@ -594,30 +591,20 @@ f2, f3, h0, h1, and H0 respectively."
594 (setq char ?? 591 (setq char ??
595 this-spec (ps-mule-get-font-spec char font-spec-table nil) 592 this-spec (ps-mule-get-font-spec char font-spec-table nil)
596 this-id (ps-mule-font-spec-font-id this-spec))) 593 this-id (ps-mule-font-spec-font-id this-spec)))
597 (or (= font-id this-id) 594 (unless (= font-id this-id)
598 (progn 595 (setq font-id this-id)
599 (if font-spec 596 (push ps-mule-esc-char code-list)
600 (setq string-list (cons (substring str 0 i) string-list) 597 (push font-id code-list))
601 i 0))
602 (setq font-id this-id)
603 (or (= font-id 0)
604 (progn
605 (aset str i ps-mule-esc-char)
606 (setq i (1+ i))
607 (aset str i font-id)
608 (setq i (1+ i))))))
609 (setq font-spec this-spec) 598 (setq font-spec this-spec)
610 (if (< char 128) 599 (if (< char 128)
611 (aset str i char) 600 (push char code-list)
612 (let* ((code (ps-mule-encode-char char font-spec))) 601 (let* ((code (ps-mule-encode-char char font-spec)))
613 (if (= (ps-mule-font-spec-bytes font-spec) 1) 602 (if (= (ps-mule-font-spec-bytes font-spec) 1)
614 (aset str i code) 603 (push code code-list)
615 (aset str i (/ code 256)) 604 (push (/ code 256) code-list)
616 (setq i (1+ i)) 605 (push (% code 256) code-list))))
617 (aset str i (% code 256)))))
618 (setq i (1+ i))
619 (forward-char 1))) 606 (forward-char 1)))
620 (nreverse (cons (substring str 0 i) string-list)))) 607 (apply 'unibyte-string (nreverse code-list))))
621 608
622(defun ps-mule-plot-composition (composition font-spec-table) 609(defun ps-mule-plot-composition (composition font-spec-table)
623 "Generate PostScript code for plotting COMPOSITION with FONT-SPEC-TABLE." 610 "Generate PostScript code for plotting COMPOSITION with FONT-SPEC-TABLE."
@@ -687,11 +674,10 @@ the sequence."
687 (cond ((= (point) stop) 674 (cond ((= (point) stop)
688 (if (= stop to) 675 (if (= stop to)
689 (setq endpos stop) 676 (setq endpos stop)
690 (if (< from stop) 677 (when (< from stop)
691 (dolist (l (ps-mule-encode-region from (point) 678 (ps-output-string (ps-mule-encode-region from (point)
692 font-spec-table)) 679 font-spec-table))
693 (ps-output-string l) 680 (ps-output " S\n"))
694 (ps-output " S\n")))
695 (setq width (* (nth 5 composition) average-width)) 681 (setq width (* (nth 5 composition) average-width))
696 (if (< ps-width-remaining (+ run-width width)) 682 (if (< ps-width-remaining (+ run-width width))
697 (setq endpos stop) 683 (setq endpos stop)
@@ -721,10 +707,9 @@ the sequence."
721 (setq run-width (+ run-width width)) 707 (setq run-width (+ run-width width))
722 (forward-char 1)))))) 708 (forward-char 1))))))
723 709
724 (if (< from endpos) 710 (when (< from endpos)
725 (dolist (l (ps-mule-encode-region from endpos font-spec-table)) 711 (ps-output-string (ps-mule-encode-region from endpos font-spec-table))
726 (ps-output-string l) 712 (ps-output " S\n"))
727 (ps-output " S\n")))
728 (goto-char point) 713 (goto-char point)
729 (cons endpos run-width))) 714 (cons endpos run-width)))
730 715
@@ -1042,13 +1027,13 @@ FONTTAG should be a string \"/h0\", \"/h1\", \"/L0\", or \"/H0\".
1042Any other value is treated as \"/H0\"." 1027Any other value is treated as \"/H0\"."
1043 (with-temp-buffer 1028 (with-temp-buffer
1044 (insert string) 1029 (insert string)
1045 (ps-mule-encode-region (point-min) (point-max) 1030 (list (ps-mule-encode-region (point-min) (point-max)
1046 (aref ps-mule-font-spec-tables 1031 (aref ps-mule-font-spec-tables
1047 (aref ps-mule-font-number-to-type 1032 (aref ps-mule-font-number-to-type
1048 (cond ((string= fonttag "/h0") 4) 1033 (cond ((string= fonttag "/h0") 4)
1049 ((string= fonttag "/h1") 5) 1034 ((string= fonttag "/h1") 5)
1050 ((string= fonttag "/L0") 6) 1035 ((string= fonttag "/L0") 6)
1051 (t 0))))))) 1036 (t 0))))))))
1052 1037
1053;;;###autoload 1038;;;###autoload
1054(defun ps-mule-begin-job (from to) 1039(defun ps-mule-begin-job (from to)