diff options
| author | Eli Zaretskii | 1999-01-17 16:34:00 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 1999-01-17 16:34:00 +0000 |
| commit | 6c743efb4066dedee5e2a55b539e850a357ce8cb (patch) | |
| tree | 4c6df0a97397e37f5360085aa7b9821ef7312549 | |
| parent | 5d5bea977f79ac943e523dd0a03d54bb0e214eb1 (diff) | |
| download | emacs-6c743efb4066dedee5e2a55b539e850a357ce8cb.tar.gz emacs-6c743efb4066dedee5e2a55b539e850a357ce8cb.zip | |
(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.
| -rw-r--r-- | lisp/ps-bdf.el | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/lisp/ps-bdf.el b/lisp/ps-bdf.el index 28ef5ab019a..93e716c0ee5 100644 --- a/lisp/ps-bdf.el +++ b/lisp/ps-bdf.el | |||
| @@ -88,7 +88,7 @@ If BDFNAME doesn't exist, return nil." | |||
| 88 | (insert-file-contents file-name) | 88 | (insert-file-contents file-name) |
| 89 | buf))))) | 89 | buf))))) |
| 90 | 90 | ||
| 91 | (defvar bdf-cache-file "~/.bdfcache.el" | 91 | (defvar bdf-cache-file (convert-standard-filename "~/.bdfcache.el") |
| 92 | "Name of cache file which contains information of `BDF' font files.") | 92 | "Name of cache file which contains information of `BDF' font files.") |
| 93 | 93 | ||
| 94 | (defvar bdf-cache nil | 94 | (defvar bdf-cache nil |
| @@ -313,6 +313,23 @@ See the documentation of the function `bdf-read-font-info' for more detail." | |||
| 313 | (bdf-set-cache font-info))) | 313 | (bdf-set-cache font-info))) |
| 314 | font-info)) | 314 | font-info)) |
| 315 | 315 | ||
| 316 | (defun bdf-find-font-info (bdfnames) | ||
| 317 | "Return information about `BDF' font file with alternative names BDFNAMES. | ||
| 318 | |||
| 319 | If BDFNAMES is a list of file names, this function finds the first file | ||
| 320 | in the list which exists and is readable, then calls `bdf-get-font-info' | ||
| 321 | on that file name." | ||
| 322 | (let ((fnlist bdfnames) | ||
| 323 | (fname bdfnames)) | ||
| 324 | (if (consp fnlist) | ||
| 325 | (while (and fnlist | ||
| 326 | (progn | ||
| 327 | (setq fname (car fnlist)) | ||
| 328 | (null (bdf-expand-file-name fname)))) | ||
| 329 | (setq fname nil | ||
| 330 | fnlist (cdr fnlist)))) | ||
| 331 | (bdf-get-font-info (or fname (car bdfnames))))) | ||
| 332 | |||
| 316 | (defun bdf-read-bitmap (bdfname offset maxlen) | 333 | (defun bdf-read-bitmap (bdfname offset maxlen) |
| 317 | "Read `BDF' font file BDFNAME to get bitmap data at file poistion OFFSET. | 334 | "Read `BDF' font file BDFNAME to get bitmap data at file poistion OFFSET. |
| 318 | BDFNAME is an abosolute path name of the font file. | 335 | BDFNAME is an abosolute path name of the font file. |
| @@ -368,7 +385,7 @@ The value is a list of CODE, DWIDTH, BBX, and BITMAP-STRING. | |||
| 368 | DWIDTH is a pixel width of a glyph. | 385 | DWIDTH is a pixel width of a glyph. |
| 369 | BBX is a bounding box of the glyph. | 386 | BBX is a bounding box of the glyph. |
| 370 | BITMAP-STRING is a string representing bits by hexadecimal digits." | 387 | BITMAP-STRING is a string representing bits by hexadecimal digits." |
| 371 | (let* ((font-info (bdf-get-font-info bdfname)) | 388 | (let* ((font-info (bdf-find-font-info bdfname)) |
| 372 | (absolute-path (bdf-info-absolute-path font-info)) | 389 | (absolute-path (bdf-info-absolute-path font-info)) |
| 373 | (font-bounding-box (bdf-info-font-bounding-box font-info)) | 390 | (font-bounding-box (bdf-info-font-bounding-box font-info)) |
| 374 | (maxlen (bdf-info-maxlen font-info)) | 391 | (maxlen (bdf-info-maxlen font-info)) |
| @@ -392,7 +409,8 @@ BITMAP-STRING is a string representing bits by hexadecimal digits." | |||
| 392 | ;; Called from ps-mule-generate-font. | 409 | ;; Called from ps-mule-generate-font. |
| 393 | (defun bdf-generate-font (charset font-spec) | 410 | (defun bdf-generate-font (charset font-spec) |
| 394 | (let* ((font-name (ps-mule-font-spec-name font-spec)) | 411 | (let* ((font-name (ps-mule-font-spec-name font-spec)) |
| 395 | (font-info (bdf-get-font-info font-name))) | 412 | (font-info (bdf-find-font-info font-name)) |
| 413 | (font-name (if (consp font-name) (car font-name) font-name))) | ||
| 396 | (ps-mule-generate-bitmap-font font-name | 414 | (ps-mule-generate-bitmap-font font-name |
| 397 | (ps-mule-font-spec-bytes font-spec) | 415 | (ps-mule-font-spec-bytes font-spec) |
| 398 | (charset-width charset) | 416 | (charset-width charset) |
| @@ -405,7 +423,9 @@ BITMAP-STRING is a string representing bits by hexadecimal digits." | |||
| 405 | (defun bdf-generate-glyphs (font-spec code-list bytes) | 423 | (defun bdf-generate-glyphs (font-spec code-list bytes) |
| 406 | (let ((font-name (ps-mule-font-spec-name font-spec))) | 424 | (let ((font-name (ps-mule-font-spec-name font-spec))) |
| 407 | (mapcar '(lambda (x) | 425 | (mapcar '(lambda (x) |
| 408 | (apply 'ps-mule-generate-bitmap-glyph font-name x)) | 426 | (apply 'ps-mule-generate-bitmap-glyph |
| 427 | (if (consp font-name) (car font-name) font-name) | ||
| 428 | x)) | ||
| 409 | (bdf-get-bitmaps font-name code-list)))) | 429 | (bdf-get-bitmaps font-name code-list)))) |
| 410 | 430 | ||
| 411 | (provide 'ps-bdf) | 431 | (provide 'ps-bdf) |