]> code.delx.au - gnu-emacs/blobdiff - lisp/ps-bdf.el
Merge from emacs--rel--22
[gnu-emacs] / lisp / ps-bdf.el
index 4e19eae6b9ee57967f4207966e00e2552856559e..6bf24b3558ced38691bc579434d5f6038ca673b7 100644 (file)
@@ -1,17 +1,20 @@
-;;; ps-bdf.el --- BDF font file handler for ps-print.
+;;; ps-bdf.el --- BDF font file handler for ps-print
 
-;; Copyright (C) 1998,99,2001 Electrotechnical Laboratory, JAPAN.
-;; Licensed to the Free Software Foundation.
+;; Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+;;   Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+;;   2008
+;;   National Institute of Advanced Industrial Science and Technology (AIST)
+;;   Registration Number H14PRO021
 
 ;; Keywords: wp, BDF, font, PostScript
-;; Maintainer: Kenichi Handa <handa@etl.go.jp>
-;; Time-stamp: <2001/03/05 09:04:32 vinicius>
+;; Maintainer: Kenichi Handa <handa@m17n.org>
 
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -21,8 +24,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -40,8 +43,7 @@
 
 ;;;###autoload
 (defvar bdf-directory-list
-  (if (and (memq system-type '(ms-dos windows-nt))
-          (boundp 'installation-directory))
+  (if (memq system-type '(ms-dos windows-nt))
       (list (expand-file-name "fonts/bdf" installation-directory))
     '("/usr/local/share/emacs/fonts/bdf"))
   "*List of directories to search for `BDF' font files.
@@ -49,8 +51,7 @@ The default value is '(\"/usr/local/share/emacs/fonts/bdf\").")
 
 ;; MS-DOS and MS-Windows users like to move the binary around after
 ;; it's built, but the value above is computed at load-up time.
-(and (and (memq system-type '(ms-dos windows-nt))
-         (boundp 'installation-directory))
+(and (memq system-type '(ms-dos windows-nt))
      (setq bdf-directory-list
           (list (expand-file-name "fonts/bdf" installation-directory))))
 
@@ -104,7 +105,12 @@ If BDFNAME doesn't exist, return nil."
             (insert-file-contents file-name)
             buf)))))
 
-(defvar bdf-cache-file (convert-standard-filename "~/.bdfcache.el")
+(defvar bdf-cache-file (if (eq system-type 'ms-dos)
+                          ;; convert-standard-filename doesn't
+                          ;; guarantee that the .el extension will be
+                          ;; preserved.
+                          "~/_bdfcache.el"
+                        (convert-standard-filename "~/.bdfcache.el"))
   "Name of cache file which contains information of `BDF' font files.")
 
 (defvar bdf-cache nil
@@ -219,7 +225,7 @@ CODE, where N and CODE are in the following relation:
         (relative-compose 'false)
         (baseline-offset 0)
         size
-        font-bounding-box 
+        font-bounding-box
         default-char
         code-range
         offset-vector)
@@ -269,18 +275,20 @@ CODE, where N and CODE are in the following relation:
            (while (search-forward "\nSTARTCHAR" nil t)
              (setq offset (line-beginning-position))
              (search-forward "\nENCODING")
-             (setq code (read (current-buffer))
-                   code0 (lsh code -8)
-                   code1 (logand code 255)
-                   min-code (min min-code code)
-                   max-code (max max-code code)
-                   min-code0 (min min-code0 code0)
-                   max-code0 (max max-code0 code0)
-                   min-code1 (min min-code1 code1)
-                   max-code1 (max max-code1 code1))
-             (search-forward "ENDCHAR")
-             (setq maxlen (max maxlen (- (point) offset))
-                   glyph-list (cons (cons code offset) glyph-list)))
+             (setq code (read (current-buffer)))
+             (if (< code 0)
+                 (search-forward "ENDCHAR")
+               (setq code0 (lsh code -8)
+                     code1 (logand code 255)
+                     min-code (min min-code code)
+                     max-code (max max-code code)
+                     min-code0 (min min-code0 code0)
+                     max-code0 (max max-code0 code0)
+                     min-code1 (min min-code1 code1)
+                     max-code1 (max max-code1 code1))
+               (search-forward "ENDCHAR")
+               (setq maxlen (max maxlen (- (point) offset))
+                     glyph-list (cons (cons code offset) glyph-list))))
 
            (setq code-range
                  (vector min-code0 max-code0 min-code1 max-code1
@@ -354,8 +362,11 @@ The value is a list of DWIDTH, BBX, and BITMAP-STRING.
 DWIDTH is a pixel width of a glyph.
 BBX is a bounding box of the glyph.
 BITMAP-STRING is a string representing bits by hexadecimal digits."
-  (let ((coding-system-for-read 'no-conversion)
-       dwidth bbx height yoff bitmap-string)
+  (let* ((coding-system-for-read 'no-conversion)
+        (bbx (elt (bdf-get-font-info bdfname) 4))
+        (dwidth (elt bbx 0))
+        (bitmap-string "")
+        height yoff)
     (condition-case nil
        (with-temp-buffer
          (insert-file-contents bdfname nil offset (+ offset maxlen))
@@ -447,4 +458,5 @@ BITMAP-STRING is a string representing bits by hexadecimal digits."
 
 (provide 'ps-bdf)
 
+;;; arch-tag: 9b875ba8-565a-4ecf-acaa-30cee732c898
 ;;; ps-bdf.el ends here