Mercurial > emacs
annotate lisp/ps-bdf.el @ 109962:aa3e4f636621
* net/dbus.el: Accept UNIX domain sockets as bus address.
(top): Don't initialize `dbus-registered-objects-table' anymore,
this is done in dbusbind,c.
(dbus-check-event): Adapt test for bus.
(dbus-return-values-table, dbus-unregister-service)
(dbus-event-bus-name, dbus-introspect, dbus-register-property):
Adapt doc string.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Mon, 23 Aug 2010 15:08:54 +0200 |
parents | 1d1d5d9bd884 |
children | 280c8ae2476d 376148b31b5e |
rev | line source |
---|---|
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38240
diff
changeset
|
1 ;;; ps-bdf.el --- BDF font file handler for ps-print |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
2 |
100908 | 3 ;; Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
106815 | 4 ;; 2009, 2010 |
74544 | 5 ;; Free Software Foundation, Inc. |
79721 | 6 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
106815 | 7 ;; 2008, 2009, 2010 |
67658 | 8 ;; National Institute of Advanced Industrial Science and Technology (AIST) |
9 ;; Registration Number H14PRO021 | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
10 |
89530 | 11 ;; Copyright (C) 2003 |
12 ;; National Institute of Advanced Industrial Science and Technology (AIST) | |
13 ;; Registration Number H13PRO009 | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
14 |
101081
8c27d59d4504
Comment (add an author based on ack.texi).
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
15 ;; Author: Kenichi Handa <handa@m17n.org> |
8c27d59d4504
Comment (add an author based on ack.texi).
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
16 ;; (according to ack.texi) |
26116 | 17 ;; Keywords: wp, BDF, font, PostScript |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
18 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
19 ;; This file is part of GNU Emacs. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
20 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
21 ;; GNU Emacs is free software: you can redistribute it and/or modify |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
22 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
23 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
24 ;; (at your option) any later version. |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
25 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
26 ;; GNU Emacs is distributed in the hope that it will be useful, |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
27 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
28 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
29 ;; GNU General Public License for more details. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
30 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
31 ;; You should have received a copy of the GNU General Public License |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
32 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
33 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
34 ;;; Commentary: |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
35 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
36 ;; Functions for getting bitmap information from X's BDF font file are |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
37 ;; provided. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
38 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
39 ;;; Code: |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
40 |
37136
422bd2e720f2
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
34313
diff
changeset
|
41 (eval-and-compile |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90735
diff
changeset
|
42 (require 'ps-mule)) |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
43 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
44 ;;;###autoload |
100245
53921407de01
Transform defvar into defcustom.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
94678
diff
changeset
|
45 (defcustom bdf-directory-list |
51875
5488bfe4b6be
copyright line fix & bdf-directory-list init fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49597
diff
changeset
|
46 (if (memq system-type '(ms-dos windows-nt)) |
24450
60d1fad41645
(bdf-directory-list): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
24449
diff
changeset
|
47 (list (expand-file-name "fonts/bdf" installation-directory)) |
24449
2428731823fd
(bdf-directory-list): Different value for ms-dos.
Eli Zaretskii <eliz@gnu.org>
parents:
24416
diff
changeset
|
48 '("/usr/local/share/emacs/fonts/bdf")) |
100245
53921407de01
Transform defvar into defcustom.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
94678
diff
changeset
|
49 "List of directories to search for `BDF' font files. |
53921407de01
Transform defvar into defcustom.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
94678
diff
changeset
|
50 The default value is '(\"/usr/local/share/emacs/fonts/bdf\")." |
53921407de01
Transform defvar into defcustom.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
94678
diff
changeset
|
51 :type '(repeat :tag "BDF font directory list" |
53921407de01
Transform defvar into defcustom.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
94678
diff
changeset
|
52 (directory :tag "BDF font directory")) |
53921407de01
Transform defvar into defcustom.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
94678
diff
changeset
|
53 :group 'ps-print-miscellany) |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
54 |
38236
ec872cb65bc3
(bdf-directory-list): Use the value relative to
Eli Zaretskii <eliz@gnu.org>
parents:
37136
diff
changeset
|
55 ;; MS-DOS and MS-Windows users like to move the binary around after |
ec872cb65bc3
(bdf-directory-list): Use the value relative to
Eli Zaretskii <eliz@gnu.org>
parents:
37136
diff
changeset
|
56 ;; it's built, but the value above is computed at load-up time. |
51875
5488bfe4b6be
copyright line fix & bdf-directory-list init fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49597
diff
changeset
|
57 (and (memq system-type '(ms-dos windows-nt)) |
24450
60d1fad41645
(bdf-directory-list): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
24449
diff
changeset
|
58 (setq bdf-directory-list |
60d1fad41645
(bdf-directory-list): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
24449
diff
changeset
|
59 (list (expand-file-name "fonts/bdf" installation-directory)))) |
60d1fad41645
(bdf-directory-list): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
24449
diff
changeset
|
60 |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
61 (defun bdf-expand-file-name (bdfname) |
37136
422bd2e720f2
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
34313
diff
changeset
|
62 "Return an absolute path name of a `BDF' font file BDFNAME. |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
63 It searches directories listed in the variable `bdf-directory-list' |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
64 for BDFNAME." |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
65 (if (file-name-absolute-p bdfname) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
66 (and (file-readable-p bdfname) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
67 bdfname) |
89530 | 68 (catch 'tag |
69 (dolist (dir bdf-directory-list) | |
70 (let ((absolute-path (expand-file-name bdfname dir))) | |
71 (if (file-readable-p absolute-path) | |
72 (throw 'tag absolute-path))))))) | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
73 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
74 (defsubst bdf-file-mod-time (filename) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
75 "Return modification time of FILENAME. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
76 The value is a list of two integers, the first integer has high-order |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
77 16 bits, the second has low 16 bits." |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
78 (nth 5 (file-attributes filename))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
79 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
80 (defun bdf-file-newer-than-time (filename mod-time) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
81 "Return non-nil if and only if FILENAME is newer than MOD-TIME. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
82 MOD-TIME is a modification time as a list of two integers, the first |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
83 integer has high-order 16 bits, the second has low 16 bits." |
89530 | 84 (let* ((new-mod-time (bdf-file-mod-time filename)) |
85 (new-time (car new-mod-time)) | |
86 (time (car mod-time))) | |
87 (or (> new-time time) | |
88 (and (= new-time time) | |
89 (> (nth 1 new-mod-time) (nth 1 mod-time)))))) | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
90 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
91 (defun bdf-find-file (bdfname) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
92 "Return a buffer visiting a bdf file BDFNAME. |
89530 | 93 BDFNAME must be an absolute file name. |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
94 If BDFNAME doesn't exist, return nil." |
89530 | 95 (and (file-readable-p bdfname) |
96 (let ((buf (generate-new-buffer " *bdf-work*")) | |
97 (coding-system-for-read 'no-conversion)) | |
105994
009383a57ce8
* x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101081
diff
changeset
|
98 (with-current-buffer buf |
89530 | 99 (insert-file-contents bdfname) |
100 buf)))) | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
101 |
39307
9861030de063
(bdf-cache-file) <ms-dos>: Use _bdfcache.el, since
Eli Zaretskii <eliz@gnu.org>
parents:
38436
diff
changeset
|
102 (defvar bdf-cache-file (if (eq system-type 'ms-dos) |
9861030de063
(bdf-cache-file) <ms-dos>: Use _bdfcache.el, since
Eli Zaretskii <eliz@gnu.org>
parents:
38436
diff
changeset
|
103 ;; convert-standard-filename doesn't |
9861030de063
(bdf-cache-file) <ms-dos>: Use _bdfcache.el, since
Eli Zaretskii <eliz@gnu.org>
parents:
38436
diff
changeset
|
104 ;; guarantee that the .el extension will be |
9861030de063
(bdf-cache-file) <ms-dos>: Use _bdfcache.el, since
Eli Zaretskii <eliz@gnu.org>
parents:
38436
diff
changeset
|
105 ;; preserved. |
9861030de063
(bdf-cache-file) <ms-dos>: Use _bdfcache.el, since
Eli Zaretskii <eliz@gnu.org>
parents:
38436
diff
changeset
|
106 "~/_bdfcache.el" |
9861030de063
(bdf-cache-file) <ms-dos>: Use _bdfcache.el, since
Eli Zaretskii <eliz@gnu.org>
parents:
38436
diff
changeset
|
107 (convert-standard-filename "~/.bdfcache.el")) |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
108 "Name of cache file which contains information of `BDF' font files.") |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
109 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
110 (defvar bdf-cache nil |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
111 "Cached information of `BDF' font files. It is a list of FONT-INFO. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
112 FONT-INFO is a list of the following format: |
89530 | 113 (ABSOLUTE-FILE-NAME MOD-TIME SIZE FONT-BOUNDING-BOX |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
114 RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
115 See the documentation of the function `bdf-read-font-info' for more detail.") |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
116 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
117 (defun bdf-read-cache () |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
118 "Return a cached information about `BDF' font files from a cache file. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
119 The variable `bdf-cache-file' holds the cache file name. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
120 If the cache file is not readable, this return nil." |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
121 (setq bdf-cache nil) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
122 (condition-case nil |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
123 (and (file-readable-p bdf-cache-file) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
124 (progn |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
125 (load-file bdf-cache-file) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
126 (if (listp bdf-cache) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
127 bdf-cache |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
128 (setq bdf-cache nil)))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
129 (error nil))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
130 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
131 (defun bdf-write-cache () |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
132 "Write out cached information of `BDF' font file to a file. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
133 The variable `bdf-cache-file' holds the cache file name. |
37136
422bd2e720f2
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
34313
diff
changeset
|
134 The file is written if and only if the file already exists and writable." |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
135 (and bdf-cache |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
136 (file-exists-p bdf-cache-file) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
137 (file-writable-p bdf-cache-file) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
138 (write-region (format "(setq bdf-cache '%S)\n" bdf-cache) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
139 nil bdf-cache-file))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
140 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
141 (defun bdf-set-cache (font-info) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
142 "Cache FONT-INFO as information about one `BDF' font file. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
143 FONT-INFO is a list of the following format: |
89530 | 144 (ABSOLUTE-FILE-NAME MOD-TIME SIZE FONT-BOUNDING-BOX |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
145 RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
146 See the documentation of the function `bdf-read-font-info' for more detail." |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
147 (let ((slot (assoc (car font-info) bdf-cache))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
148 (if slot |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
149 (setcdr slot (cdr font-info)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
150 (setq bdf-cache (cons font-info bdf-cache))))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
151 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
152 (defun bdf-initialize () |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
153 "Initialize `bdf' library." |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
154 (and (bdf-read-cache) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
155 (add-hook 'kill-emacs-hook 'bdf-write-cache))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
156 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
157 (defun bdf-compact-code (code code-range) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
158 (if (or (< code (aref code-range 4)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
159 (> code (aref code-range 5))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
160 (setq code (aref code-range 6))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
161 (+ (* (- (lsh code -8) (aref code-range 0)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
162 (1+ (- (aref code-range 3) (aref code-range 2)))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
163 (- (logand code 255) (aref code-range 2)))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
164 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
165 (defun bdf-expand-code (code code-range) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
166 (let ((code0-range (1+ (- (aref code-range 3) (aref code-range 2))))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
167 (+ (* (+ (/ code code0-range) (aref code-range 0)) 256) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
168 (+ (% code code0-range) (aref code-range 2))))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
169 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
170 (defun bdf-search-and-read (match limit) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
171 (goto-char (point-min)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
172 (and (search-forward match limit t) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
173 (progn |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
174 (goto-char (match-end 0)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
175 (read (current-buffer))))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
176 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
177 (defun bdf-read-font-info (bdfname) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
178 "Read `BDF' font file BDFNAME and return information (FONT-INFO) of the file. |
89530 | 179 BDFNAME must be an absolute file name. |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
180 FONT-INFO is a list of the following format: |
89530 | 181 (BDFFILE MOD-TIME FONT-BOUNDING-BOX |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
182 RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
183 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
184 MOD-TIME is last modification time as a list of two integers, the |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
185 first integer has high-order 16 bits, the second has low 16 bits. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
186 |
89530 | 187 SIZE is a size of the font on 72 dpi device. This value is got |
188 from SIZE record of the font. | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
189 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
190 FONT-BOUNDING-BOX is the font bounding box as a list of four integers, |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
191 BBX-WIDTH, BBX-HEIGHT, BBX-XOFF, and BBX-YOFF. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
192 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
193 RELATIVE-COMPOSE is an integer value of the font's property |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
194 `_MULE_RELATIVE_COMPOSE'. If the font doesn't have this property, the |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
195 value is 0. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
196 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
197 BASELINE-OFFSET is an integer value of the font's property |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
198 `_MULE_BASELINE_OFFSET'. If the font doesn't have this property, the |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
199 value is 0. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
200 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
201 CODE-RANGE is a vector of minimum 1st byte, maximum 1st byte, minimum |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
202 2nd byte, maximum 2nd byte, minimum code, maximum code, and default |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
203 code. For 1-byte fonts, the first two elements are 0. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
204 |
37136
422bd2e720f2
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
34313
diff
changeset
|
205 MAXLEN is a maximum bytes of one glyph information in the font file. |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
206 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
207 OFFSET-VECTOR is a vector of a file position which starts bitmap data |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
208 of the glyph in the font file. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
209 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
210 Nth element of OFFSET-VECTOR is a file position for the glyph of code |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
211 CODE, where N and CODE are in the following relation: |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
212 (bdf-compact-code CODE) => N, (bdf-expand-code N) => CODE" |
89530 | 213 (let* ((buf (bdf-find-file bdfname)) |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
214 (maxlen 0) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
215 (relative-compose 'false) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
216 (baseline-offset 0) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
217 size |
89530 | 218 dpi |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39346
diff
changeset
|
219 font-bounding-box |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
220 default-char |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
221 code-range |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
222 offset-vector) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
223 (if buf |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
224 (message "Reading %s..." bdfname) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
225 (error "BDF file %s doesn't exist" bdfname)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
226 (unwind-protect |
105994
009383a57ce8
* x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101081
diff
changeset
|
227 (with-current-buffer buf |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
228 (goto-char (point-min)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
229 (search-forward "\nFONTBOUNDINGBOX") |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
230 (setq font-bounding-box |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
231 (vector (read (current-buffer)) (read (current-buffer)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
232 (read (current-buffer)) (read (current-buffer)))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
233 ;; The following kludgy code is to avoid bugs of fonts |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
234 ;; jiskan16.bdf and jiskan24.bdf distributed with X. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
235 ;; They contain wrong FONTBOUNDINGBOX. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
236 (and (> (aref font-bounding-box 3) 0) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
237 (string-match "jiskan\\(16\\|24\\)" bdfname) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
238 (aset font-bounding-box 3 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
239 (- (aref font-bounding-box 3)))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
240 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
241 (goto-char (point-min)) |
89530 | 242 (search-forward "\nFONT ") |
243 (if (looking-at "-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*-\\([0-9]+\\)") | |
91429
dca6485ff374
(bdf-read-font-info): Use string-to-number rather than string-to-int.
Glenn Morris <rgm@gnu.org>
parents:
91327
diff
changeset
|
244 (setq size (string-to-number (match-string 1))) |
89530 | 245 (search-forward "\nSIZE ") |
246 (setq size (read (current-buffer))) | |
93559
ab068ffc7048
Fix comment typo.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
91429
diff
changeset
|
247 ;; The following kludgy code is to avoid bugs of several |
89530 | 248 ;; fonts which have wrong SIZE record. |
249 (and (string-match "jiskan" bdfname) | |
250 (<= size (/ (aref font-bounding-box 1) 3)) | |
251 (setq size (aref font-bounding-box 1))) | |
252 (setq dpi (read (current-buffer))) | |
253 (if (and (> dpi 0) (/= dpi 72)) | |
254 (setq size (/ (* size dpi) 72)))) | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
255 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
256 (setq default-char (bdf-search-and-read "\nDEFAULT_CHAR" nil)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
257 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
258 (search-forward "\nSTARTCHAR") |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
259 (forward-line -1) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
260 (let ((limit (point))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
261 (setq relative-compose |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
262 (or (bdf-search-and-read "\n_MULE_RELATIVE_COMPOSE" limit) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
263 'false) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
264 baseline-offset |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
265 (or (bdf-search-and-read "\n_MULE_BASELINE_OFFSET" limit) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
266 0))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
267 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
268 (let ((min-code0 256) (min-code1 256) (min-code 65536) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
269 (max-code0 0) (max-code1 0) (max-code 0) |
37136
422bd2e720f2
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
34313
diff
changeset
|
270 glyph glyph-list code0 code1 code offset) |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
271 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
272 (while (search-forward "\nSTARTCHAR" nil t) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
273 (setq offset (line-beginning-position)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
274 (search-forward "\nENCODING") |
64645
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
275 (setq code (read (current-buffer))) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
276 (if (< code 0) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
277 (search-forward "ENDCHAR") |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
278 (setq code0 (lsh code -8) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
279 code1 (logand code 255) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
280 min-code (min min-code code) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
281 max-code (max max-code code) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
282 min-code0 (min min-code0 code0) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
283 max-code0 (max max-code0 code0) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
284 min-code1 (min min-code1 code1) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
285 max-code1 (max max-code1 code1)) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
286 (search-forward "ENDCHAR") |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
287 (setq maxlen (max maxlen (- (point) offset)) |
e4b9a37feb33
(bdf-read-font-info): Ignore glyphs whose ENCODING is
Kenichi Handa <handa@m17n.org>
parents:
64091
diff
changeset
|
288 glyph-list (cons (cons code offset) glyph-list)))) |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
289 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
290 (setq code-range |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
291 (vector min-code0 max-code0 min-code1 max-code1 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
292 min-code max-code (or default-char min-code)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
293 offset-vector |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
294 (make-vector (1+ (bdf-compact-code max-code code-range)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
295 nil)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
296 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
297 (while glyph-list |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
298 (setq glyph (car glyph-list) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
299 glyph-list (cdr glyph-list)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
300 (aset offset-vector |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
301 (bdf-compact-code (car glyph) code-range) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
302 (cdr glyph))))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
303 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
304 (kill-buffer buf)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
305 (message "Reading %s...done" bdfname) |
89530 | 306 (list bdfname (bdf-file-mod-time bdfname) |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
307 size font-bounding-box relative-compose baseline-offset |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
308 code-range maxlen offset-vector))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
309 |
89530 | 310 (defsubst bdf-info-absolute-path (font-info) (nth 0 font-info)) |
311 (defsubst bdf-info-mod-time (font-info) (nth 1 font-info)) | |
312 (defsubst bdf-info-size (font-info) (nth 2 font-info)) | |
313 (defsubst bdf-info-font-bounding-box (font-info) (nth 3 font-info)) | |
314 (defsubst bdf-info-relative-compose (font-info) (nth 4 font-info)) | |
315 (defsubst bdf-info-baseline-offset (font-info) (nth 5 font-info)) | |
316 (defsubst bdf-info-code-range (font-info) (nth 6 font-info)) | |
317 (defsubst bdf-info-maxlen (font-info) (nth 7 font-info)) | |
318 (defsubst bdf-info-offset-vector (font-info) (nth 8 font-info)) | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
319 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
320 (defun bdf-get-font-info (bdfname) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
321 "Return information about `BDF' font file BDFNAME. |
89530 | 322 BDFNAME must be an absolute file name. |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
323 The value FONT-INFO is a list of the following format: |
89530 | 324 (BDFNAME MOD-TIME SIZE FONT-BOUNDING-BOX |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
325 RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
326 See the documentation of the function `bdf-read-font-info' for more detail." |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
327 (or bdf-cache |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
328 (bdf-read-cache)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
329 (let ((font-info (assoc bdfname bdf-cache))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
330 (if (or (not font-info) |
89530 | 331 (not (file-readable-p bdfname)) |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
332 (bdf-file-newer-than-time bdfname (bdf-info-mod-time font-info))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
333 (progn |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
334 (setq font-info (bdf-read-font-info bdfname)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
335 (bdf-set-cache font-info))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
336 font-info)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
337 |
89530 | 338 (defun bdf-read-bitmap (bdfname offset maxlen relative-compose) |
37136
422bd2e720f2
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
34313
diff
changeset
|
339 "Read `BDF' font file BDFNAME to get bitmap data at file position OFFSET. |
422bd2e720f2
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
34313
diff
changeset
|
340 BDFNAME is an absolute path name of the font file. |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
341 MAXLEN specifies how many bytes we should read at least. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
342 The value is a list of DWIDTH, BBX, and BITMAP-STRING. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
343 DWIDTH is a pixel width of a glyph. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
344 BBX is a bounding box of the glyph. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
345 BITMAP-STRING is a string representing bits by hexadecimal digits." |
39346
aa9501b93334
(bdf-read-bitmap): Initialize returned values to
Gerd Moellmann <gerd@gnu.org>
parents:
39307
diff
changeset
|
346 (let* ((coding-system-for-read 'no-conversion) |
89530 | 347 (bbx (bdf-info-font-bounding-box (bdf-get-font-info bdfname))) |
39346
aa9501b93334
(bdf-read-bitmap): Initialize returned values to
Gerd Moellmann <gerd@gnu.org>
parents:
39307
diff
changeset
|
348 (dwidth (elt bbx 0)) |
aa9501b93334
(bdf-read-bitmap): Initialize returned values to
Gerd Moellmann <gerd@gnu.org>
parents:
39307
diff
changeset
|
349 (bitmap-string "") |
aa9501b93334
(bdf-read-bitmap): Initialize returned values to
Gerd Moellmann <gerd@gnu.org>
parents:
39307
diff
changeset
|
350 height yoff) |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
351 (condition-case nil |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
352 (with-temp-buffer |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
353 (insert-file-contents bdfname nil offset (+ offset maxlen)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
354 (goto-char (point-min)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
355 (search-forward "\nDWIDTH") |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
356 (setq dwidth (read (current-buffer))) |
89530 | 357 (if (= dwidth 0) |
358 (setq dwidth 0.1)) | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
359 (goto-char (point-min)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
360 (search-forward "\nBBX") |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
361 (setq bbx (vector (read (current-buffer)) (read (current-buffer)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
362 (read (current-buffer)) (read (current-buffer))) |
37136
422bd2e720f2
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
34313
diff
changeset
|
363 height (aref bbx 1) |
422bd2e720f2
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
34313
diff
changeset
|
364 yoff (aref bbx 3)) |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
365 (search-forward "\nBITMAP") |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
366 (forward-line 1) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
367 (delete-region (point-min) (point)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
368 (and (looking-at "\\(0+\n\\)+") |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
369 (progn |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
370 (setq height (- height (count-lines (point) (match-end 0)))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
371 (delete-region (point) (match-end 0)))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
372 (or (looking-at "ENDCHAR") |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
373 (progn |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
374 (search-forward "ENDCHAR" nil 'move) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
375 (forward-line -1) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
376 (while (looking-at "0+$") |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
377 (setq yoff (1+ yoff) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
378 height (1- height)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
379 (forward-line -1)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
380 (forward-line 1))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
381 (aset bbx 1 height) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
382 (aset bbx 3 yoff) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
383 (delete-region (point) (point-max)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
384 (goto-char (point-min)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
385 (while (not (eobp)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
386 (end-of-line) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
387 (delete-char 1)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
388 (setq bitmap-string (buffer-string))) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
389 (error nil)) |
89530 | 390 (vector dwidth (aref bbx 0) (aref bbx 1) (aref bbx 2) (aref bbx 3) |
391 (concat "<" bitmap-string ">") | |
392 (or relative-compose 'false)))) | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
393 |
89530 | 394 (defun bdf-get-bitmap (bdfname code) |
395 "Return bitmap information of glyph of CODE in `BDF' font file BDFNAME. | |
396 CODE is an encoding number of glyph in the file. | |
397 The value is a list (DWIDTH BBX BITMAP-STRING). | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
398 DWIDTH is a pixel width of a glyph. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
399 BBX is a bounding box of the glyph. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
400 BITMAP-STRING is a string representing bits by hexadecimal digits." |
89530 | 401 (let* ((info (bdf-get-font-info bdfname)) |
402 (maxlen (bdf-info-maxlen info)) | |
403 (code-range (bdf-info-code-range info)) | |
404 (offset-vector (bdf-info-offset-vector info))) | |
405 (bdf-read-bitmap bdfname | |
406 (aref offset-vector (bdf-compact-code code code-range)) | |
407 maxlen (bdf-info-relative-compose info)))) | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
408 |
89530 | 409 ;;; Interface to ps-mule.el |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
410 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
411 ;; Called from ps-mule-init-external-library. |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
412 (defun bdf-generate-prologue () |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
413 (or bdf-cache |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
414 (bdf-initialize)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
415 (ps-mule-generate-bitmap-prologue)) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
416 |
89530 | 417 ;; Called from ps-mule-check-font. |
418 (defun bdf-check-font (font-spec) | |
419 (let ((font-name-list (ps-mule-font-spec-name font-spec))) | |
420 (ps-mule-font-spec-set-name | |
421 font-spec | |
422 (if (stringp font-name-list) | |
423 (bdf-expand-file-name font-name-list) | |
424 (catch 'tag | |
425 (dolist (font-name font-name-list) | |
426 (setq font-name (bdf-expand-file-name font-name)) | |
427 (if font-name | |
428 (throw 'tag font-name)))))))) | |
429 | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
430 ;; Called from ps-mule-generate-font. |
89530 | 431 (defun bdf-generate-font (font-spec) |
432 (let ((info (bdf-get-font-info (ps-mule-font-spec-name font-spec)))) | |
433 (ps-mule-font-spec-set-extra | |
434 font-spec (bdf-info-absolute-path info)) | |
435 (ps-mule-generate-bitmap-font font-spec | |
436 (bdf-info-size info) | |
437 (bdf-info-relative-compose info) | |
438 (bdf-info-baseline-offset info) | |
439 (bdf-info-font-bounding-box info)))) | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
440 |
89530 | 441 ;; Called from ps-mule-generate-glyph. |
442 (defun bdf-generate-glyph (font-spec char) | |
443 (let ((font-name (ps-mule-font-spec-extra font-spec)) | |
444 (code (ps-mule-encode-char char font-spec))) | |
445 (ps-mule-generate-bitmap-glyph font-spec char code | |
446 (bdf-get-bitmap font-name code)))) | |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
447 |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
448 (provide 'ps-bdf) |
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
449 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93559
diff
changeset
|
450 ;; arch-tag: 9b875ba8-565a-4ecf-acaa-30cee732c898 |
23896
c0c441b28347
File name changed from bdf.el. Provide ps-bdf
Kenichi Handa <handa@m17n.org>
parents:
23895
diff
changeset
|
451 ;;; ps-bdf.el ends here |