comparison lisp/ps-mule.el @ 56986:6db2681d2bf6

Fix old function calls (ps-mule-chars-in-string -> length, ps-mule-string-char -> aref, ps-mule-next-index -> 1+, ps-mule-next-point -> 1+).
author Kenichi Handa <handa@m17n.org>
date Wed, 08 Sep 2004 07:22:06 +0000
parents 2cd9221e3d46
children 0d38d6148c13
comparison
equal deleted inserted replaced
56985:5eac7cd6d213 56986:6db2681d2bf6
416 (defun ps-mule-encode-8bit (string) 416 (defun ps-mule-encode-8bit (string)
417 (ps-mule-encode-bit string 128)) 417 (ps-mule-encode-bit string 128))
418 418
419 (defun ps-mule-encode-bit (string delta) 419 (defun ps-mule-encode-bit (string delta)
420 (let* ((dim (charset-dimension (char-charset (string-to-char string)))) 420 (let* ((dim (charset-dimension (char-charset (string-to-char string))))
421 (len (* (ps-mule-chars-in-string string) dim)) 421 (len (* (length string) dim))
422 (str (make-string len 0)) 422 (str (make-string len 0))
423 (i 0) 423 (i 0)
424 (j 0)) 424 (j 0))
425 (if (= dim 1) 425 (if (= dim 1)
426 (while (< j len) 426 (while (< j len)
427 (aset str j 427 (aset str j
428 (+ (nth 1 (split-char (ps-mule-string-char string i))) delta)) 428 (+ (nth 1 (split-char (aref string i))) delta))
429 (setq i (ps-mule-next-index string i) 429 (setq i (1+ i)
430 j (1+ j))) 430 j (1+ j)))
431 (while (< j len) 431 (while (< j len)
432 (let ((split (split-char (ps-mule-string-char string i)))) 432 (let ((split (split-char (aref string i))))
433 (aset str j (+ (nth 1 split) delta)) 433 (aset str j (+ (nth 1 split) delta))
434 (aset str (1+ j) (+ (nth 2 split) delta)) 434 (aset str (1+ j) (+ (nth 2 split) delta))
435 (setq i (ps-mule-next-index string i) 435 (setq i (1+ i)
436 j (+ j 2))))) 436 j (+ j 2)))))
437 str)) 437 str))
438 438
439 ;; Special encoding function for Ethiopic. 439 ;; Special encoding function for Ethiopic.
440 (if (boundp 'mule-version) ; only if mule package is loaded 440 (if (boundp 'mule-version) ; only if mule package is loaded
466 (defun ps-mule-encode-ethiopic (string) 466 (defun ps-mule-encode-ethiopic (string)
467 string)) 467 string))
468 468
469 ;; Special encoding for mule-unicode-* characters. 469 ;; Special encoding for mule-unicode-* characters.
470 (defun ps-mule-encode-ucs2 (string) 470 (defun ps-mule-encode-ucs2 (string)
471 (let* ((len (ps-mule-chars-in-string string)) 471 (let* ((len (length string))
472 (str (make-string (* 2 len) 0)) 472 (str (make-string (* 2 len) 0))
473 (i 0) 473 (i 0)
474 (j 0) 474 (j 0)
475 ch hi lo) 475 ch hi lo)
476 (while (< i len) 476 (while (< i len)
477 (setq ch (encode-char (ps-mule-string-char string i) 'ucs) 477 (setq ch (encode-char (aref string i) 'ucs)
478 hi (lsh ch -8) 478 hi (lsh ch -8)
479 lo (logand ch 255)) 479 lo (logand ch 255))
480 (aset str j hi) 480 (aset str j hi)
481 (aset str (1+ j) lo) 481 (aset str (1+ j) lo)
482 (setq i (1+ i) 482 (setq i (1+ i)
794 (* (char-width (char-after from)) char-width)))) 794 (* (char-width (char-after from)) char-width))))
795 (if (> run-width ps-width-remaining) 795 (if (> run-width ps-width-remaining)
796 (cons from ps-width-remaining) 796 (cons from ps-width-remaining)
797 (cons (if composition 797 (cons (if composition
798 (nth 1 composition) 798 (nth 1 composition)
799 (ps-mule-next-point from)) 799 (1+ from))
800 run-width))) 800 run-width)))
801 ;; We assume that all characters in this range have the same width. 801 ;; We assume that all characters in this range have the same width.
802 (setq char-width (* char-width (charset-width ps-mule-current-charset))) 802 (setq char-width (* char-width (charset-width ps-mule-current-charset)))
803 (let ((run-width (* (abs (- from to)) char-width))) 803 (let ((run-width (* (abs (- from to)) char-width)))
804 (if (> run-width ps-width-remaining) 804 (if (> run-width ps-width-remaining)
847 (ps-output-string (ps-mule-string-ascii string)) 847 (ps-output-string (ps-mule-string-ascii string))
848 (ps-output " S\n")) 848 (ps-output " S\n"))
849 849
850 ;; This case is obsolete for Emacs 21. 850 ;; This case is obsolete for Emacs 21.
851 ((eq ps-mule-current-charset 'composition) 851 ((eq ps-mule-current-charset 'composition)
852 (ps-mule-plot-composition from (ps-mule-next-point from) bg-color)) 852 (ps-mule-plot-composition from (1+ from) bg-color))
853 853
854 (t 854 (t
855 ;; No way to print this charset. Just show a vacant box of an 855 ;; No way to print this charset. Just show a vacant box of an
856 ;; appropriate width. 856 ;; appropriate width.
857 (ps-output (format "%d %d SB\n" 857 (ps-output (format "%d %d SB\n"