2001-07-16 12:23:00 +00:00
|
|
|
;;; ps-bdf.el --- BDF font file handler for ps-print
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
2018-01-01 08:21:42 +00:00
|
|
|
;; Copyright (C) 1998-1999, 2001-2018 Free Software Foundation, Inc.
|
2008-01-07 02:45:14 +00:00
|
|
|
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
2011-01-02 23:50:46 +00:00
|
|
|
;; 2008, 2009, 2010, 2011
|
2005-12-19 07:04:44 +00:00
|
|
|
;; National Institute of Advanced Industrial Science and Technology (AIST)
|
|
|
|
;; Registration Number H14PRO021
|
2003-09-26 11:42:33 +00:00
|
|
|
;; Copyright (C) 2003
|
|
|
|
;; National Institute of Advanced Industrial Science and Technology (AIST)
|
|
|
|
;; Registration Number H13PRO009
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
2009-01-10 21:56:18 +00:00
|
|
|
;; Author: Kenichi Handa <handa@m17n.org>
|
|
|
|
;; (according to ack.texi)
|
1999-10-20 01:08:36 +00:00
|
|
|
;; Keywords: wp, BDF, font, PostScript
|
2010-08-29 16:17:13 +00:00
|
|
|
;; Package: ps-print
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; Functions for getting bitmap information from X's BDF font file are
|
|
|
|
;; provided.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2011-02-03 07:21:56 +00:00
|
|
|
(require 'ps-mule)
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
2008-12-05 14:56:18 +00:00
|
|
|
(defcustom bdf-directory-list
|
2003-07-12 00:20:38 +00:00
|
|
|
(if (memq system-type '(ms-dos windows-nt))
|
1999-03-07 14:12:35 +00:00
|
|
|
(list (expand-file-name "fonts/bdf" installation-directory))
|
1999-03-07 13:31:58 +00:00
|
|
|
'("/usr/local/share/emacs/fonts/bdf"))
|
2008-12-05 14:56:18 +00:00
|
|
|
"List of directories to search for `BDF' font files.
|
2015-11-17 23:28:50 +00:00
|
|
|
The default value is (\"/usr/local/share/emacs/fonts/bdf\")."
|
2008-12-05 14:56:18 +00:00
|
|
|
:type '(repeat :tag "BDF font directory list"
|
|
|
|
(directory :tag "BDF font directory"))
|
|
|
|
:group 'ps-print-miscellany)
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
2001-06-29 17:50:27 +00:00
|
|
|
;; 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.
|
2003-07-12 00:20:38 +00:00
|
|
|
(and (memq system-type '(ms-dos windows-nt))
|
1999-03-07 14:12:35 +00:00
|
|
|
(setq bdf-directory-list
|
|
|
|
(list (expand-file-name "fonts/bdf" installation-directory))))
|
|
|
|
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
(defun bdf-expand-file-name (bdfname)
|
2001-04-02 10:35:44 +00:00
|
|
|
"Return an absolute path name of a `BDF' font file BDFNAME.
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
It searches directories listed in the variable `bdf-directory-list'
|
|
|
|
for BDFNAME."
|
|
|
|
(if (file-name-absolute-p bdfname)
|
|
|
|
(and (file-readable-p bdfname)
|
|
|
|
bdfname)
|
2003-09-26 11:42:33 +00:00
|
|
|
(catch 'tag
|
|
|
|
(dolist (dir bdf-directory-list)
|
|
|
|
(let ((absolute-path (expand-file-name bdfname dir)))
|
|
|
|
(if (file-readable-p absolute-path)
|
|
|
|
(throw 'tag absolute-path)))))))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
(defsubst bdf-file-mod-time (filename)
|
|
|
|
"Return modification time of FILENAME.
|
2012-11-18 02:13:19 +00:00
|
|
|
The value is a list of integers in the same format as `current-time'."
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
(nth 5 (file-attributes filename)))
|
|
|
|
|
|
|
|
(defun bdf-file-newer-than-time (filename mod-time)
|
|
|
|
"Return non-nil if and only if FILENAME is newer than MOD-TIME.
|
2012-11-18 02:13:19 +00:00
|
|
|
MOD-TIME is a modification time as a list of integers in the same
|
|
|
|
format as `current-time'."
|
|
|
|
(let ((new-mod-time (bdf-file-mod-time filename)))
|
|
|
|
(time-less-p mod-time new-mod-time)))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
(defun bdf-find-file (bdfname)
|
|
|
|
"Return a buffer visiting a bdf file BDFNAME.
|
2003-09-26 11:42:33 +00:00
|
|
|
BDFNAME must be an absolute file name.
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
If BDFNAME doesn't exist, return nil."
|
2003-09-26 11:42:33 +00:00
|
|
|
(and (file-readable-p bdfname)
|
|
|
|
(let ((buf (generate-new-buffer " *bdf-work*"))
|
|
|
|
(coding-system-for-read 'no-conversion))
|
* x-dnd.el (x-dnd-maybe-call-test-function):
* window.el (split-window-vertically):
* whitespace.el (whitespace-help-on):
* vc-rcs.el (vc-rcs-consult-headers):
* userlock.el (ask-user-about-lock-help)
(ask-user-about-supersession-help):
* type-break.el (type-break-force-mode-line-update):
* time-stamp.el (time-stamp-conv-warn):
* terminal.el (te-set-output-log, te-more-break, te-filter)
(te-sentinel,terminal-emulator):
* term.el (make-term, term-exec, term-sentinel, term-read-input-ring)
(term-write-input-ring, term-check-source, term-start-output-log):
(term-display-buffer-line, term-dynamic-list-completions):
(term-ansi-make-term, serial-term):
* subr.el (selective-display):
* strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer)
(strokes-encode-buffer, strokes-xpm-for-compressed-string):
* speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info)
(speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support)
(speedbar-remove-localized-speedbar-support)
(speedbar-set-mode-line-format, speedbar-create-tag-hierarchy)
(speedbar-update-special-contents, speedbar-buffer-buttons-engine)
(speedbar-buffers-line-directory):
* simple.el (shell-command-on-region, append-to-buffer)
(prepend-to-buffer):
* shadowfile.el (shadow-save-todo-file):
* scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1)
(scroll-bar-maybe-set-window-start):
* sb-image.el (speedbar-image-dump):
* saveplace.el (save-place-alist-to-file, save-places-to-alist)
(load-save-place-alist-from-file):
* ps-samp.el (ps-print-message-from-summary):
* ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox)
(ps-background-image, ps-begin-job, ps-do-despool):
* ps-bdf.el (bdf-find-file, bdf-read-font-info):
* printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting)
(pr-ps-message-from-summary, pr-lpr-message-from-summary):
(pr-call-process, pr-file-list, pr-interface-save):
* novice.el (disabled-command-function)
(enable-command, disable-command):
* mouse.el (mouse-buffer-menu-alist):
* mouse-copy.el (mouse-kill-preserving-secondary):
* macros.el (kbd-macro-query):
* ledit.el (ledit-go-to-lisp, ledit-go-to-liszt):
* informat.el (batch-info-validate):
* ido.el (ido-copy-current-word, ido-initiate-auto-merge):
* hippie-exp.el (try-expand-dabbrev-visible):
* help-mode.el (help-make-xrefs):
* help-fns.el (describe-variable):
* generic-x.el (bat-generic-mode-run-as-comint):
* finder.el (finder-mouse-select):
* find-dired.el (find-dired-sentinel):
* filesets.el (filesets-file-close):
* files.el (list-directory):
* faces.el (list-faces-display, describe-face):
* facemenu.el (list-colors-display):
* ezimage.el (ezimage-image-association-dump, ezimage-image-dump):
* epg.el (epg--process-filter, epg-cancel):
* epa.el (epa--marked-keys, epa--select-keys, epa-display-info)
(epa--read-signature-type):
* emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B)
(emerge-file-names):
* ehelp.el (electric-helpify):
* ediff.el (ediff-regions-wordwise, ediff-regions-linewise):
* ediff-vers.el (rcs-ediff-view-revision):
* ediff-util.el (ediff-setup):
* ediff-mult.el (ediff-append-custom-diff):
* ediff-diff.el (ediff-exec-process, ediff-process-sentinel)
(ediff-wordify):
* echistory.el (Electric-command-history-redo-expression):
* dos-w32.el (find-file-not-found-set-buffer-file-coding-system):
* disp-table.el (describe-display-table):
* dired.el (dired-find-buffer-nocreate):
* dired-aux.el (dired-rename-subdir, dired-dwim-target-directory):
* dabbrev.el (dabbrev--same-major-mode-p):
* chistory.el (list-command-history):
* apropos.el (apropos-documentation):
* allout.el (allout-obtain-passphrase):
(allout-copy-exposed-to-buffer):
(allout-verify-passphrase): Use with-current-buffer.
2009-11-13 22:19:45 +00:00
|
|
|
(with-current-buffer buf
|
2003-09-26 11:42:33 +00:00
|
|
|
(insert-file-contents bdfname)
|
|
|
|
buf))))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
2013-03-12 02:08:21 +00:00
|
|
|
(defvar bdf-cache-file (locate-user-emacs-file "bdfcache.el" ".bdfcache.el")
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
"Name of cache file which contains information of `BDF' font files.")
|
|
|
|
|
|
|
|
(defvar bdf-cache nil
|
|
|
|
"Cached information of `BDF' font files. It is a list of FONT-INFO.
|
|
|
|
FONT-INFO is a list of the following format:
|
2003-09-26 11:42:33 +00:00
|
|
|
(ABSOLUTE-FILE-NAME MOD-TIME SIZE FONT-BOUNDING-BOX
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
|
|
|
|
See the documentation of the function `bdf-read-font-info' for more detail.")
|
|
|
|
|
|
|
|
(defun bdf-read-cache ()
|
|
|
|
"Return a cached information about `BDF' font files from a cache file.
|
|
|
|
The variable `bdf-cache-file' holds the cache file name.
|
|
|
|
If the cache file is not readable, this return nil."
|
|
|
|
(setq bdf-cache nil)
|
|
|
|
(condition-case nil
|
|
|
|
(and (file-readable-p bdf-cache-file)
|
|
|
|
(progn
|
|
|
|
(load-file bdf-cache-file)
|
|
|
|
(if (listp bdf-cache)
|
|
|
|
bdf-cache
|
|
|
|
(setq bdf-cache nil))))
|
|
|
|
(error nil)))
|
|
|
|
|
|
|
|
(defun bdf-write-cache ()
|
|
|
|
"Write out cached information of `BDF' font file to a file.
|
|
|
|
The variable `bdf-cache-file' holds the cache file name.
|
2001-04-02 10:35:44 +00:00
|
|
|
The file is written if and only if the file already exists and writable."
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
(and bdf-cache
|
|
|
|
(file-exists-p bdf-cache-file)
|
|
|
|
(file-writable-p bdf-cache-file)
|
|
|
|
(write-region (format "(setq bdf-cache '%S)\n" bdf-cache)
|
|
|
|
nil bdf-cache-file)))
|
|
|
|
|
|
|
|
(defun bdf-set-cache (font-info)
|
|
|
|
"Cache FONT-INFO as information about one `BDF' font file.
|
|
|
|
FONT-INFO is a list of the following format:
|
2003-09-26 11:42:33 +00:00
|
|
|
(ABSOLUTE-FILE-NAME MOD-TIME SIZE FONT-BOUNDING-BOX
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
|
|
|
|
See the documentation of the function `bdf-read-font-info' for more detail."
|
|
|
|
(let ((slot (assoc (car font-info) bdf-cache)))
|
|
|
|
(if slot
|
|
|
|
(setcdr slot (cdr font-info))
|
|
|
|
(setq bdf-cache (cons font-info bdf-cache)))))
|
|
|
|
|
|
|
|
(defun bdf-initialize ()
|
|
|
|
"Initialize `bdf' library."
|
|
|
|
(and (bdf-read-cache)
|
|
|
|
(add-hook 'kill-emacs-hook 'bdf-write-cache)))
|
|
|
|
|
|
|
|
(defun bdf-compact-code (code code-range)
|
|
|
|
(if (or (< code (aref code-range 4))
|
|
|
|
(> code (aref code-range 5)))
|
|
|
|
(setq code (aref code-range 6)))
|
|
|
|
(+ (* (- (lsh code -8) (aref code-range 0))
|
|
|
|
(1+ (- (aref code-range 3) (aref code-range 2))))
|
|
|
|
(- (logand code 255) (aref code-range 2))))
|
|
|
|
|
|
|
|
(defun bdf-expand-code (code code-range)
|
|
|
|
(let ((code0-range (1+ (- (aref code-range 3) (aref code-range 2)))))
|
|
|
|
(+ (* (+ (/ code code0-range) (aref code-range 0)) 256)
|
|
|
|
(+ (% code code0-range) (aref code-range 2)))))
|
|
|
|
|
|
|
|
(defun bdf-search-and-read (match limit)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(and (search-forward match limit t)
|
|
|
|
(progn
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
(read (current-buffer)))))
|
|
|
|
|
|
|
|
(defun bdf-read-font-info (bdfname)
|
|
|
|
"Read `BDF' font file BDFNAME and return information (FONT-INFO) of the file.
|
2003-09-26 11:42:33 +00:00
|
|
|
BDFNAME must be an absolute file name.
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
FONT-INFO is a list of the following format:
|
2003-09-26 11:42:33 +00:00
|
|
|
(BDFFILE MOD-TIME FONT-BOUNDING-BOX
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
|
|
|
|
|
2012-11-18 02:13:19 +00:00
|
|
|
MOD-TIME is last modification time as a list of integers in the
|
|
|
|
same format as `current-time'.
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
2003-09-26 11:42:33 +00:00
|
|
|
SIZE is a size of the font on 72 dpi device. This value is got
|
|
|
|
from SIZE record of the font.
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
FONT-BOUNDING-BOX is the font bounding box as a list of four integers,
|
|
|
|
BBX-WIDTH, BBX-HEIGHT, BBX-XOFF, and BBX-YOFF.
|
|
|
|
|
|
|
|
RELATIVE-COMPOSE is an integer value of the font's property
|
|
|
|
`_MULE_RELATIVE_COMPOSE'. If the font doesn't have this property, the
|
|
|
|
value is 0.
|
|
|
|
|
|
|
|
BASELINE-OFFSET is an integer value of the font's property
|
|
|
|
`_MULE_BASELINE_OFFSET'. If the font doesn't have this property, the
|
|
|
|
value is 0.
|
|
|
|
|
|
|
|
CODE-RANGE is a vector of minimum 1st byte, maximum 1st byte, minimum
|
|
|
|
2nd byte, maximum 2nd byte, minimum code, maximum code, and default
|
|
|
|
code. For 1-byte fonts, the first two elements are 0.
|
|
|
|
|
2001-04-02 10:35:44 +00:00
|
|
|
MAXLEN is a maximum bytes of one glyph information in the font file.
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
OFFSET-VECTOR is a vector of a file position which starts bitmap data
|
|
|
|
of the glyph in the font file.
|
|
|
|
|
|
|
|
Nth element of OFFSET-VECTOR is a file position for the glyph of code
|
|
|
|
CODE, where N and CODE are in the following relation:
|
|
|
|
(bdf-compact-code CODE) => N, (bdf-expand-code N) => CODE"
|
2003-09-26 11:42:33 +00:00
|
|
|
(let* ((buf (bdf-find-file bdfname))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
(maxlen 0)
|
|
|
|
(relative-compose 'false)
|
|
|
|
(baseline-offset 0)
|
|
|
|
size
|
2003-09-26 11:42:33 +00:00
|
|
|
dpi
|
2003-02-04 12:29:42 +00:00
|
|
|
font-bounding-box
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
default-char
|
|
|
|
code-range
|
|
|
|
offset-vector)
|
|
|
|
(if buf
|
|
|
|
(message "Reading %s..." bdfname)
|
|
|
|
(error "BDF file %s doesn't exist" bdfname))
|
|
|
|
(unwind-protect
|
* x-dnd.el (x-dnd-maybe-call-test-function):
* window.el (split-window-vertically):
* whitespace.el (whitespace-help-on):
* vc-rcs.el (vc-rcs-consult-headers):
* userlock.el (ask-user-about-lock-help)
(ask-user-about-supersession-help):
* type-break.el (type-break-force-mode-line-update):
* time-stamp.el (time-stamp-conv-warn):
* terminal.el (te-set-output-log, te-more-break, te-filter)
(te-sentinel,terminal-emulator):
* term.el (make-term, term-exec, term-sentinel, term-read-input-ring)
(term-write-input-ring, term-check-source, term-start-output-log):
(term-display-buffer-line, term-dynamic-list-completions):
(term-ansi-make-term, serial-term):
* subr.el (selective-display):
* strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer)
(strokes-encode-buffer, strokes-xpm-for-compressed-string):
* speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info)
(speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support)
(speedbar-remove-localized-speedbar-support)
(speedbar-set-mode-line-format, speedbar-create-tag-hierarchy)
(speedbar-update-special-contents, speedbar-buffer-buttons-engine)
(speedbar-buffers-line-directory):
* simple.el (shell-command-on-region, append-to-buffer)
(prepend-to-buffer):
* shadowfile.el (shadow-save-todo-file):
* scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1)
(scroll-bar-maybe-set-window-start):
* sb-image.el (speedbar-image-dump):
* saveplace.el (save-place-alist-to-file, save-places-to-alist)
(load-save-place-alist-from-file):
* ps-samp.el (ps-print-message-from-summary):
* ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox)
(ps-background-image, ps-begin-job, ps-do-despool):
* ps-bdf.el (bdf-find-file, bdf-read-font-info):
* printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting)
(pr-ps-message-from-summary, pr-lpr-message-from-summary):
(pr-call-process, pr-file-list, pr-interface-save):
* novice.el (disabled-command-function)
(enable-command, disable-command):
* mouse.el (mouse-buffer-menu-alist):
* mouse-copy.el (mouse-kill-preserving-secondary):
* macros.el (kbd-macro-query):
* ledit.el (ledit-go-to-lisp, ledit-go-to-liszt):
* informat.el (batch-info-validate):
* ido.el (ido-copy-current-word, ido-initiate-auto-merge):
* hippie-exp.el (try-expand-dabbrev-visible):
* help-mode.el (help-make-xrefs):
* help-fns.el (describe-variable):
* generic-x.el (bat-generic-mode-run-as-comint):
* finder.el (finder-mouse-select):
* find-dired.el (find-dired-sentinel):
* filesets.el (filesets-file-close):
* files.el (list-directory):
* faces.el (list-faces-display, describe-face):
* facemenu.el (list-colors-display):
* ezimage.el (ezimage-image-association-dump, ezimage-image-dump):
* epg.el (epg--process-filter, epg-cancel):
* epa.el (epa--marked-keys, epa--select-keys, epa-display-info)
(epa--read-signature-type):
* emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B)
(emerge-file-names):
* ehelp.el (electric-helpify):
* ediff.el (ediff-regions-wordwise, ediff-regions-linewise):
* ediff-vers.el (rcs-ediff-view-revision):
* ediff-util.el (ediff-setup):
* ediff-mult.el (ediff-append-custom-diff):
* ediff-diff.el (ediff-exec-process, ediff-process-sentinel)
(ediff-wordify):
* echistory.el (Electric-command-history-redo-expression):
* dos-w32.el (find-file-not-found-set-buffer-file-coding-system):
* disp-table.el (describe-display-table):
* dired.el (dired-find-buffer-nocreate):
* dired-aux.el (dired-rename-subdir, dired-dwim-target-directory):
* dabbrev.el (dabbrev--same-major-mode-p):
* chistory.el (list-command-history):
* apropos.el (apropos-documentation):
* allout.el (allout-obtain-passphrase):
(allout-copy-exposed-to-buffer):
(allout-verify-passphrase): Use with-current-buffer.
2009-11-13 22:19:45 +00:00
|
|
|
(with-current-buffer buf
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
(goto-char (point-min))
|
|
|
|
(search-forward "\nFONTBOUNDINGBOX")
|
|
|
|
(setq font-bounding-box
|
|
|
|
(vector (read (current-buffer)) (read (current-buffer))
|
|
|
|
(read (current-buffer)) (read (current-buffer))))
|
|
|
|
;; The following kludgy code is to avoid bugs of fonts
|
|
|
|
;; jiskan16.bdf and jiskan24.bdf distributed with X.
|
|
|
|
;; They contain wrong FONTBOUNDINGBOX.
|
|
|
|
(and (> (aref font-bounding-box 3) 0)
|
|
|
|
(string-match "jiskan\\(16\\|24\\)" bdfname)
|
|
|
|
(aset font-bounding-box 3
|
|
|
|
(- (aref font-bounding-box 3))))
|
|
|
|
|
|
|
|
(goto-char (point-min))
|
2003-09-26 11:42:33 +00:00
|
|
|
(search-forward "\nFONT ")
|
|
|
|
(if (looking-at "-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*-\\([0-9]+\\)")
|
2008-02-02 04:15:23 +00:00
|
|
|
(setq size (string-to-number (match-string 1)))
|
2003-09-26 11:42:33 +00:00
|
|
|
(search-forward "\nSIZE ")
|
|
|
|
(setq size (read (current-buffer)))
|
2008-04-02 23:50:11 +00:00
|
|
|
;; The following kludgy code is to avoid bugs of several
|
2003-09-26 11:42:33 +00:00
|
|
|
;; fonts which have wrong SIZE record.
|
|
|
|
(and (string-match "jiskan" bdfname)
|
|
|
|
(<= size (/ (aref font-bounding-box 1) 3))
|
|
|
|
(setq size (aref font-bounding-box 1)))
|
|
|
|
(setq dpi (read (current-buffer)))
|
|
|
|
(if (and (> dpi 0) (/= dpi 72))
|
|
|
|
(setq size (/ (* size dpi) 72))))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
(setq default-char (bdf-search-and-read "\nDEFAULT_CHAR" nil))
|
|
|
|
|
|
|
|
(search-forward "\nSTARTCHAR")
|
|
|
|
(forward-line -1)
|
|
|
|
(let ((limit (point)))
|
|
|
|
(setq relative-compose
|
|
|
|
(or (bdf-search-and-read "\n_MULE_RELATIVE_COMPOSE" limit)
|
|
|
|
'false)
|
|
|
|
baseline-offset
|
|
|
|
(or (bdf-search-and-read "\n_MULE_BASELINE_OFFSET" limit)
|
|
|
|
0)))
|
|
|
|
|
|
|
|
(let ((min-code0 256) (min-code1 256) (min-code 65536)
|
|
|
|
(max-code0 0) (max-code1 0) (max-code 0)
|
2001-04-02 10:35:44 +00:00
|
|
|
glyph glyph-list code0 code1 code offset)
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
(while (search-forward "\nSTARTCHAR" nil t)
|
|
|
|
(setq offset (line-beginning-position))
|
|
|
|
(search-forward "\nENCODING")
|
2005-07-27 08:00:52 +00:00
|
|
|
(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))))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
(setq code-range
|
|
|
|
(vector min-code0 max-code0 min-code1 max-code1
|
|
|
|
min-code max-code (or default-char min-code))
|
|
|
|
offset-vector
|
|
|
|
(make-vector (1+ (bdf-compact-code max-code code-range))
|
|
|
|
nil))
|
|
|
|
|
|
|
|
(while glyph-list
|
|
|
|
(setq glyph (car glyph-list)
|
|
|
|
glyph-list (cdr glyph-list))
|
|
|
|
(aset offset-vector
|
|
|
|
(bdf-compact-code (car glyph) code-range)
|
|
|
|
(cdr glyph)))))
|
|
|
|
|
|
|
|
(kill-buffer buf))
|
|
|
|
(message "Reading %s...done" bdfname)
|
2003-09-26 11:42:33 +00:00
|
|
|
(list bdfname (bdf-file-mod-time bdfname)
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
size font-bounding-box relative-compose baseline-offset
|
|
|
|
code-range maxlen offset-vector)))
|
|
|
|
|
2003-09-26 11:42:33 +00:00
|
|
|
(defsubst bdf-info-absolute-path (font-info) (nth 0 font-info))
|
|
|
|
(defsubst bdf-info-mod-time (font-info) (nth 1 font-info))
|
|
|
|
(defsubst bdf-info-size (font-info) (nth 2 font-info))
|
|
|
|
(defsubst bdf-info-font-bounding-box (font-info) (nth 3 font-info))
|
|
|
|
(defsubst bdf-info-relative-compose (font-info) (nth 4 font-info))
|
|
|
|
(defsubst bdf-info-baseline-offset (font-info) (nth 5 font-info))
|
|
|
|
(defsubst bdf-info-code-range (font-info) (nth 6 font-info))
|
|
|
|
(defsubst bdf-info-maxlen (font-info) (nth 7 font-info))
|
|
|
|
(defsubst bdf-info-offset-vector (font-info) (nth 8 font-info))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
(defun bdf-get-font-info (bdfname)
|
|
|
|
"Return information about `BDF' font file BDFNAME.
|
2003-09-26 11:42:33 +00:00
|
|
|
BDFNAME must be an absolute file name.
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
The value FONT-INFO is a list of the following format:
|
2003-09-26 11:42:33 +00:00
|
|
|
(BDFNAME MOD-TIME SIZE FONT-BOUNDING-BOX
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
|
|
|
|
See the documentation of the function `bdf-read-font-info' for more detail."
|
|
|
|
(or bdf-cache
|
|
|
|
(bdf-read-cache))
|
|
|
|
(let ((font-info (assoc bdfname bdf-cache)))
|
|
|
|
(if (or (not font-info)
|
2003-09-26 11:42:33 +00:00
|
|
|
(not (file-readable-p bdfname))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
(bdf-file-newer-than-time bdfname (bdf-info-mod-time font-info)))
|
|
|
|
(progn
|
|
|
|
(setq font-info (bdf-read-font-info bdfname))
|
|
|
|
(bdf-set-cache font-info)))
|
|
|
|
font-info))
|
|
|
|
|
2003-09-26 11:42:33 +00:00
|
|
|
(defun bdf-read-bitmap (bdfname offset maxlen relative-compose)
|
2001-04-02 10:35:44 +00:00
|
|
|
"Read `BDF' font file BDFNAME to get bitmap data at file position OFFSET.
|
|
|
|
BDFNAME is an absolute path name of the font file.
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
MAXLEN specifies how many bytes we should read at least.
|
|
|
|
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."
|
2001-09-19 09:12:54 +00:00
|
|
|
(let* ((coding-system-for-read 'no-conversion)
|
2003-09-26 11:42:33 +00:00
|
|
|
(bbx (bdf-info-font-bounding-box (bdf-get-font-info bdfname)))
|
2001-09-19 09:12:54 +00:00
|
|
|
(dwidth (elt bbx 0))
|
|
|
|
(bitmap-string "")
|
|
|
|
height yoff)
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
(condition-case nil
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents bdfname nil offset (+ offset maxlen))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(search-forward "\nDWIDTH")
|
|
|
|
(setq dwidth (read (current-buffer)))
|
2003-09-26 11:42:33 +00:00
|
|
|
(if (= dwidth 0)
|
|
|
|
(setq dwidth 0.1))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
(goto-char (point-min))
|
|
|
|
(search-forward "\nBBX")
|
|
|
|
(setq bbx (vector (read (current-buffer)) (read (current-buffer))
|
|
|
|
(read (current-buffer)) (read (current-buffer)))
|
2001-04-02 10:35:44 +00:00
|
|
|
height (aref bbx 1)
|
|
|
|
yoff (aref bbx 3))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
(search-forward "\nBITMAP")
|
|
|
|
(forward-line 1)
|
|
|
|
(delete-region (point-min) (point))
|
|
|
|
(and (looking-at "\\(0+\n\\)+")
|
|
|
|
(progn
|
|
|
|
(setq height (- height (count-lines (point) (match-end 0))))
|
|
|
|
(delete-region (point) (match-end 0))))
|
|
|
|
(or (looking-at "ENDCHAR")
|
|
|
|
(progn
|
|
|
|
(search-forward "ENDCHAR" nil 'move)
|
|
|
|
(forward-line -1)
|
|
|
|
(while (looking-at "0+$")
|
|
|
|
(setq yoff (1+ yoff)
|
|
|
|
height (1- height))
|
|
|
|
(forward-line -1))
|
|
|
|
(forward-line 1)))
|
|
|
|
(aset bbx 1 height)
|
|
|
|
(aset bbx 3 yoff)
|
|
|
|
(delete-region (point) (point-max))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (not (eobp))
|
|
|
|
(end-of-line)
|
|
|
|
(delete-char 1))
|
|
|
|
(setq bitmap-string (buffer-string)))
|
|
|
|
(error nil))
|
2003-09-26 11:42:33 +00:00
|
|
|
(vector dwidth (aref bbx 0) (aref bbx 1) (aref bbx 2) (aref bbx 3)
|
|
|
|
(concat "<" bitmap-string ">")
|
|
|
|
(or relative-compose 'false))))
|
|
|
|
|
|
|
|
(defun bdf-get-bitmap (bdfname code)
|
|
|
|
"Return bitmap information of glyph of CODE in `BDF' font file BDFNAME.
|
|
|
|
CODE is an encoding number of glyph in the file.
|
|
|
|
The value is a list (DWIDTH BBX BITMAP-STRING).
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
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."
|
2003-09-26 11:42:33 +00:00
|
|
|
(let* ((info (bdf-get-font-info bdfname))
|
|
|
|
(maxlen (bdf-info-maxlen info))
|
|
|
|
(code-range (bdf-info-code-range info))
|
|
|
|
(offset-vector (bdf-info-offset-vector info)))
|
|
|
|
(bdf-read-bitmap bdfname
|
|
|
|
(aref offset-vector (bdf-compact-code code code-range))
|
|
|
|
maxlen (bdf-info-relative-compose info))))
|
|
|
|
|
|
|
|
;;; Interface to ps-mule.el
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
;; Called from ps-mule-init-external-library.
|
|
|
|
(defun bdf-generate-prologue ()
|
|
|
|
(or bdf-cache
|
|
|
|
(bdf-initialize))
|
|
|
|
(ps-mule-generate-bitmap-prologue))
|
|
|
|
|
2003-09-26 11:42:33 +00:00
|
|
|
;; Called from ps-mule-check-font.
|
|
|
|
(defun bdf-check-font (font-spec)
|
|
|
|
(let ((font-name-list (ps-mule-font-spec-name font-spec)))
|
|
|
|
(ps-mule-font-spec-set-name
|
|
|
|
font-spec
|
|
|
|
(if (stringp font-name-list)
|
|
|
|
(bdf-expand-file-name font-name-list)
|
|
|
|
(catch 'tag
|
|
|
|
(dolist (font-name font-name-list)
|
|
|
|
(setq font-name (bdf-expand-file-name font-name))
|
|
|
|
(if font-name
|
|
|
|
(throw 'tag font-name))))))))
|
|
|
|
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
;; Called from ps-mule-generate-font.
|
2003-09-26 11:42:33 +00:00
|
|
|
(defun bdf-generate-font (font-spec)
|
|
|
|
(let ((info (bdf-get-font-info (ps-mule-font-spec-name font-spec))))
|
|
|
|
(ps-mule-font-spec-set-extra
|
|
|
|
font-spec (bdf-info-absolute-path info))
|
|
|
|
(ps-mule-generate-bitmap-font font-spec
|
|
|
|
(bdf-info-size info)
|
|
|
|
(bdf-info-relative-compose info)
|
|
|
|
(bdf-info-baseline-offset info)
|
|
|
|
(bdf-info-font-bounding-box info))))
|
|
|
|
|
|
|
|
;; Called from ps-mule-generate-glyph.
|
|
|
|
(defun bdf-generate-glyph (font-spec char)
|
|
|
|
(let ((font-name (ps-mule-font-spec-extra font-spec))
|
|
|
|
(code (ps-mule-encode-char char font-spec)))
|
|
|
|
(ps-mule-generate-bitmap-glyph font-spec char code
|
|
|
|
(bdf-get-bitmap font-name code))))
|
File name changed from bdf.el. Provide ps-bdf
instead of bdf.
Require ps-mule instead of ps-print.
(bdf-directory-list): Add autoload cookie.
Programming uniformization and little code improvement.
(bdf-search-and-read): New fun.
(bdf-write-cache, bdf-initialize, bdf-info-absolute-path)
(bdf-info-mod-time, bdf-info-size, bdf-info-font-bounding-box)
(bdf-info-relative-compose, bdf-info-baseline-offset)
(bdf-info-code-range, bdf-info-maxlen, bdf-info-offset-vector)
(bdf-read-bitmap, bdf-get-bitmaps): Programming uniformization.
(bdf-expand-file-name, bdf-file-newer-than-time, bdf-find-file)
(bdf-read-cache, bdf-read-font-info, bdf-generate-glyphs): Little code
improvement.
1998-12-15 06:39:39 +00:00
|
|
|
|
|
|
|
(provide 'ps-bdf)
|
|
|
|
|
|
|
|
;;; ps-bdf.el ends here
|