Mercurial > emacs
changeset 24087:dd3bd06af523
(bdf-cache-file): Use convert-standard-filename.
(bdf-find-font-info): New function, looks for the first readable
file from a list of alternatives.
(bdf-get-bitmaps, bdf-generate-font): Call bdf-find-font-info
instead of bdf-get-font-info.
(bdf-generate-glyphs): If font-name is a cons cell, pass its car
to ps-mule-generate-bitmap-glyph.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sun, 17 Jan 1999 16:34:00 +0000 |
parents | bedce7fcf0f4 |
children | bb95d3d24ff9 |
files | lisp/ps-bdf.el |
diffstat | 1 files changed, 24 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ps-bdf.el Sun Jan 17 16:32:50 1999 +0000 +++ b/lisp/ps-bdf.el Sun Jan 17 16:34:00 1999 +0000 @@ -88,7 +88,7 @@ (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 +313,23 @@ (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 +385,7 @@ 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 +409,8 @@ ;; 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 +423,9 @@ (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)