don't require grep in vc-git
[bpt/emacs.git] / lisp / ps-mule.el
index 95a982f..21868b0 100644 (file)
@@ -1,7 +1,6 @@
 ;;; ps-mule.el --- provide multi-byte character facility to ps-print
 
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2014 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;;     Kenichi Handa <handa@m17n.org> (multi-byte characters)
@@ -89,8 +88,7 @@
 
 ;;; Code:
 
-(eval-and-compile
-  (require 'ps-print))
+(require 'ps-print)
 
 
 ;;;###autoload
@@ -190,7 +188,32 @@ See also the variable `ps-font-info-database'.")
 (defcustom ps-mule-font-info-database-default
   ps-mule-font-info-database-latin
   "The default setting to use when `ps-multibyte-buffer' is nil."
-  :type '(symbol :tag "Multi-Byte Buffer Database Font Default")
+  :type '(alist :key-type symbol :tag "Charset"
+               :value-type
+               (list (list
+                      (choice :tag "Font type"
+                              (const normal)
+                              (const bold)
+                              (const italic)
+                              (const bold-italic))
+                      (choice :tag "Font source"
+                              (const builtin)
+                              (const bdf)
+                              (const vflib)
+                              (const nil))
+                      ;; My guess as to what the doc is trying to say...
+                      (choice :tag "Font name"
+                              (const nil)
+                              string
+                              (repeat :tag "List" string))
+                      (choice :tag "Encoding"
+                              (const nil)
+                              coding-system
+                              function)
+                      (choice :tag "Bytes"
+                              (const nil)
+                              (const 1)
+                              (const 2)))))
   :group 'ps-print-font)
 
 (defconst ps-mule-font-info-database-ps
@@ -368,7 +391,7 @@ See also `ps-mule-font-info-database-bdf'.")
 ;; character is printed by which FONT-SPEC.  It has one extra slot
 ;; whose value is an alist of the form:
 ;;     (CHARSET . FONT-SPEC)
-;; FONT-SPEC is a vecotr of the form:
+;; FONT-SPEC is a vector of the form:
 ;;     (ID FONT-SRC FONT-NAME ENCODING EXTRA)
 (defvar ps-mule-font-spec-tables nil)
 
@@ -634,7 +657,7 @@ f2, f3, h0, h1, and H0 respectively."
            (ps-output "]"))))))
   (ps-output " ] " (if (nth 3 composition) "RLC" "RBC") "\n"))
 
-(defun ps-mule-plot-string (from to &optional bg-color)
+(defun ps-mule-plot-string (from to &optional _bg-color)
   "Generate PostScript code for plotting characters in the region FROM and TO.
 
 Optional argument BG-COLOR is ignored.
@@ -661,7 +684,7 @@ the sequence."
         width)
     (goto-char from)
     (while (not endpos)
-      (cond ((= (point) stop)
+      (cond ((>= (point) stop)
             (if (= stop to)
                 (setq endpos stop)
               (when (< from stop)
@@ -934,7 +957,7 @@ the sequence."
     (list ps-mule-bitmap-prologue)))
 
 (defun ps-mule-generate-bitmap-font (font-spec size relative-compose
-                                              baselie-offset bbx)
+                                              baseline-offset bbx)
   (let* ((id (ps-mule-font-spec-id font-spec))
         (bytes (ps-mule-font-spec-bytes font-spec))
         output-list)
@@ -943,7 +966,7 @@ the sequence."
              (list (format "/E%02X [ 0 1 255 {pop /.notdef} for ] def\n" id)
                    (format "%%%% %s\n" (ps-mule-font-spec-name font-spec))
                    (format "/F%02X %f %S %d E%02X NBF\n" id size
-                           relative-compose baselie-offset id)))
+                           relative-compose baseline-offset id)))
       (setq output-list
            (list (list (format "/E%02X [ 0 1 255 { pop 0 } for ] def\n" id))
                  (list (format "/V%02X [" id))
@@ -952,7 +975,7 @@ the sequence."
                  (format "/F%02X E%02X V%02X NPF\n" id id id))))
     (aset ps-mule-bitmap-font-record id
          (vector (= bytes 1) output-list
-                 size relative-compose baselie-offset bbx))
+                 size relative-compose baseline-offset bbx))
     (if ps-mule-bitmap-dict-list
        output-list
       (setq ps-mule-bitmap-dict-list (list "/BitmapDict <<\n" ">> def\n"))
@@ -1012,7 +1035,7 @@ the sequence."
          ps-mule-external-libraries))
 
 (defun ps-mule-encode-header-string (string fonttag)
-  "Generate PostScript code for ploting STRING by font FONTTAG.
+  "Generate PostScript code for plotting STRING by font FONTTAG.
 FONTTAG should be a string \"/h0\", \"/h1\", \"/L0\", or \"/H0\".
 Any other value is treated as \"/H0\"."
   (with-temp-buffer
@@ -1035,6 +1058,7 @@ It checks if all multi-byte characters in the region are printable or not."
             (= (skip-chars-forward "\x00-\x7F" to) to)))
       ;; All characters can be printed by normal PostScript fonts.
       (setq ps-basic-plot-string-function 'ps-basic-plot-string
+            ;; FIXME: Doesn't ps-encode-header-string-function take 2 args?
            ps-encode-header-string-function 'identity)
     (setq ps-basic-plot-string-function 'ps-mule-plot-string
          ps-encode-header-string-function 'ps-mule-encode-header-string
@@ -1143,7 +1167,7 @@ It checks if all multi-byte characters in the region are printable or not."
                           (aref ps-mule-font-spec-tables font-type) 0)))
     (ps-output-prologue
      (list (if (ps-mule-font-spec-src (cdr (car font-spec-alist)))
-              ;; We ignore a font specfied in ps-font-info-database.
+              ;; We ignore a font specified in ps-font-info-database.
               (format "/V%s VTOP%d def\n" fonttag font-type)
             (format "/V%s [ VTOP%d aload pop ] def\n
 V%s 0 /%s-latin1 /%s Latin1Encoding put\n"
@@ -1211,5 +1235,4 @@ V%s 0 /%s-latin1 /%s Latin1Encoding put\n"
 ;; generated-autoload-file: "ps-print.el"
 ;; End:
 
-;; arch-tag: bca017b2-66a7-4e59-8584-103e749eadbe
 ;;; ps-mule.el ends here