Function: ps-mule-encode-region

ps-mule-encode-region is a byte-compiled function defined in ps-mule.el.gz.

Signature

(ps-mule-encode-region FROM TO FONT-SPEC-TABLE)

Documentation

Generate PostScript code for plotting characters in the region FROM and TO.

FONT-SPEC-TABLE is 0, 1, 2, 3, 4, 5, or 6, each represents font tags f0, f1, f2, f3, h0, h1, and H0 respectively.

Source Code

;; Defined in /usr/src/emacs/lisp/ps-mule.el.gz
(defun ps-mule-encode-region (from to font-spec-table)
  "Generate PostScript code for plotting characters in the region FROM and TO.

FONT-SPEC-TABLE is 0, 1, 2, 3, 4, 5, or 6, each represents font tags f0, f1,
f2, f3, h0, h1, and H0 respectively."
  (let* ((font-spec nil)
	 (font-id 0)
	 (code-list nil))
    (goto-char from)
    (while (< (point) to)
      (let* ((char (following-char))
	     (this-spec (ps-mule-get-font-spec char font-spec-table font-spec))
	     this-id)
	(if (vectorp this-spec)
	    (setq this-id (ps-mule-font-spec-font-id this-spec))
	  ;; Can't print CHAR.   Replace it with '?'.
	  (setq char ??
		this-spec (ps-mule-get-font-spec char font-spec-table nil)
		this-id (ps-mule-font-spec-font-id this-spec)))
	(unless (= font-id this-id)
	  (setq font-id this-id)
	  (push ps-mule-esc-char code-list)
	  (push font-id code-list))
	(setq font-spec this-spec)
	(if (< char 128)
	    (push char code-list)
	  (let* ((code (ps-mule-encode-char char font-spec)))
	    (if (= (ps-mule-font-spec-bytes font-spec) 1)
		(push code code-list)
	      (push (/ code 256) code-list)
	      (push (% code 256) code-list))))
	(forward-char 1)))
    (apply #'unibyte-string (nreverse code-list))))