X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/e62e3e6b5e68bb41e9783c1afad859af6fe816d8..ad9534859721d7d8381d2c0fb73533d3cf7e60cd:/lisp/ps-bdf.el diff --git a/lisp/ps-bdf.el b/lisp/ps-bdf.el index 28ef5ab019..0261ccbf55 100644 --- a/lisp/ps-bdf.el +++ b/lisp/ps-bdf.el @@ -1,11 +1,11 @@ ;;; ps-bdf.el --- BDF font file handler for ps-print. -;; Copyright (C) 1998 Electrotechnical Laboratory, JAPAN. +;; Copyright (C) 1998, 1999 Electrotechnical Laboratory, JAPAN. ;; Licensed to the Free Software Foundation. -;; Keywords: BDF, font, PostScript +;; Keywords: wp, BDF, font, PostScript ;; Maintainer: Kenichi Handa -;; Time-stamp: <98/11/26 15:09:23 kenichi> +;; Time-stamp: <99/02/27 11:14:07 kenichi> ;; This file is part of GNU Emacs. @@ -35,8 +35,17 @@ ;;;###autoload (defvar bdf-directory-list - nil - "*List of directories to search for `BDF' font files.") + (if (eq system-type 'ms-dos) + (list (expand-file-name "fonts/bdf" installation-directory)) + '("/usr/local/share/emacs/fonts/bdf")) + "*List of directories to search for `BDF' font files. +The default value is '(\"/usr/local/share/emacs/fonts/bdf\").") + +;; MS-DOS users like to move the binary around after it's built, but +;; the value above is computed at loadup time. +(and (eq system-type 'ms-dos) + (setq bdf-directory-list + (list (expand-file-name "fonts/bdf" installation-directory)))) (defun bdf-expand-file-name (bdfname) "Return an abosolute path name of a `BDF' font file BDFNAME. @@ -88,7 +97,7 @@ If BDFNAME doesn't exist, return nil." (insert-file-contents file-name) buf))))) -(defvar bdf-cache-file "~/.bdfcache.el" +(defvar bdf-cache-file (convert-standard-filename "~/.bdfcache.el") "Name of cache file which contains information of `BDF' font files.") (defvar bdf-cache nil @@ -313,6 +322,23 @@ See the documentation of the function `bdf-read-font-info' for more detail." (bdf-set-cache font-info))) font-info)) +(defun bdf-find-font-info (bdfnames) + "Return information about `BDF' font file with alternative names BDFNAMES. + +If BDFNAMES is a list of file names, this function finds the first file +in the list which exists and is readable, then calls `bdf-get-font-info' +on that file name." + (let ((fnlist bdfnames) + (fname bdfnames)) + (if (consp fnlist) + (while (and fnlist + (progn + (setq fname (car fnlist)) + (null (bdf-expand-file-name fname)))) + (setq fname nil + fnlist (cdr fnlist)))) + (bdf-get-font-info (or fname (car bdfnames))))) + (defun bdf-read-bitmap (bdfname offset maxlen) "Read `BDF' font file BDFNAME to get bitmap data at file poistion OFFSET. BDFNAME is an abosolute path name of the font file. @@ -368,7 +394,7 @@ The value is a list of CODE, 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* ((font-info (bdf-get-font-info bdfname)) + (let* ((font-info (bdf-find-font-info bdfname)) (absolute-path (bdf-info-absolute-path font-info)) (font-bounding-box (bdf-info-font-bounding-box font-info)) (maxlen (bdf-info-maxlen font-info)) @@ -392,7 +418,8 @@ BITMAP-STRING is a string representing bits by hexadecimal digits." ;; Called from ps-mule-generate-font. (defun bdf-generate-font (charset font-spec) (let* ((font-name (ps-mule-font-spec-name font-spec)) - (font-info (bdf-get-font-info font-name))) + (font-info (bdf-find-font-info font-name)) + (font-name (if (consp font-name) (car font-name) font-name))) (ps-mule-generate-bitmap-font font-name (ps-mule-font-spec-bytes font-spec) (charset-width charset) @@ -405,7 +432,9 @@ BITMAP-STRING is a string representing bits by hexadecimal digits." (defun bdf-generate-glyphs (font-spec code-list bytes) (let ((font-name (ps-mule-font-spec-name font-spec))) (mapcar '(lambda (x) - (apply 'ps-mule-generate-bitmap-glyph font-name x)) + (apply 'ps-mule-generate-bitmap-glyph + (if (consp font-name) (car font-name) font-name) + x)) (bdf-get-bitmaps font-name code-list)))) (provide 'ps-bdf)