Mercurial > emacs
annotate lisp/ps-mule.el @ 90462:5981c99ef5ba
(x_default_font_parameter): Try also "fixed", and signal
error here if no suitable font was found.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 16 Jun 2006 12:14:37 +0000 |
parents | 05b8b8dd212b |
children | cf83508ee22d |
rev | line source |
---|---|
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37201
diff
changeset
|
1 ;;; ps-mule.el --- provide multi-byte character facility to ps-print |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
2 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64647
diff
changeset
|
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
68651
3bd95f4f2941
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
65748
diff
changeset
|
4 ;; 2005, 2006 Free Software Foundation, Inc. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
5 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37201
diff
changeset
|
6 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> |
38816 | 7 ;; Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
8 ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) | |
9 ;; Vinicius Jose Latorre <vinicius@cpqd.com.br> | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37201
diff
changeset
|
10 ;; Keywords: wp, print, PostScript, multibyte, mule |
51007
c3f9aa88ed68
Avoid unnecessary calls to funs in header and footer variables
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
45899
diff
changeset
|
11 ;; Time-stamp: <2003/05/14 22:19:41 vinicius> |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
12 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
13 ;; This file is part of GNU Emacs. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
14 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
15 ;; GNU Emacs is free software; you can redistribute it and/or modify |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
16 ;; it under the terms of the GNU General Public License as published by |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
17 ;; the Free Software Foundation; either version 2, or (at your option) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
18 ;; any later version. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
19 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
20 ;; GNU Emacs is distributed in the hope that it will be useful, |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
23 ;; GNU General Public License for more details. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
24 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
25 ;; You should have received a copy of the GNU General Public License |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64091 | 27 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
28 ;; Boston, MA 02110-1301, USA. | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
29 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
30 ;;; Commentary: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
31 |
26115
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
32 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
33 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
34 ;; About ps-mule |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
35 ;; ------------- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
36 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
37 ;; This package is used for ps-print to print multi-byte buffer. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
38 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
39 ;; See also ps-print.el. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
40 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
41 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
42 ;; Printing Multi-byte Buffer |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
43 ;; -------------------------- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
44 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
45 ;; The variable `ps-multibyte-buffer' specifies the ps-print multi-byte buffer |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
46 ;; handling. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
47 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
48 ;; Valid values for `ps-multibyte-buffer' are: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
49 ;; |
26115
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
50 ;; nil This is the value to use the default settings which |
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
51 ;; is by default for printing buffer with only ASCII |
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
52 ;; and Latin characters. The default setting can be |
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
53 ;; changed by setting the variable |
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
54 ;; `ps-mule-font-info-database-default' differently. |
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
55 ;; The initial value of this variable is |
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
56 ;; `ps-mule-font-info-database-latin' (see |
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
57 ;; documentation). |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
58 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
59 ;; `non-latin-printer' This is the value to use when you have a japanese |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
60 ;; or korean PostScript printer and want to print |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
61 ;; buffer with ASCII, Latin-1, Japanese (JISX0208 and |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
62 ;; JISX0201-Kana) and Korean characters. At present, |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
63 ;; it was not tested the Korean characters printing. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
64 ;; If you have a korean PostScript printer, please, |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
65 ;; test it. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
66 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
67 ;; `bdf-font' This is the value to use when you want to print |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
68 ;; buffer with BDF fonts. BDF fonts include both latin |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
69 ;; and non-latin fonts. BDF (Bitmap Distribution |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
70 ;; Format) is a format used for distributing X's font |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
71 ;; source file. BDF fonts are included in |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
72 ;; `intlfonts-1.2' which is a collection of X11 fonts |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
73 ;; for all characters supported by Emacs. In order to |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
74 ;; use this value, be sure to have installed |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
75 ;; `intlfonts-1.2' and set the variable |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
76 ;; `bdf-directory-list' appropriately (see ps-bdf.el |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
77 ;; for documentation of this variable). |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
78 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
79 ;; `bdf-font-except-latin' This is like `bdf-font' except that it is used |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
80 ;; PostScript default fonts to print ASCII and Latin-1 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
81 ;; characters. This is convenient when you want or |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
82 ;; need to use both latin and non-latin characters on |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
83 ;; the same buffer. See `ps-font-family', |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
84 ;; `ps-header-font-family' and `ps-font-info-database'. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
85 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
86 ;; Any other value is treated as nil. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
87 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
88 ;; The default is nil. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
89 ;; |
26115
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
90 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
91 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
92 ;;; Code: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
93 |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
94 (eval-and-compile |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
95 (require 'ps-print) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
96 |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
97 ;; to avoid XEmacs compilation gripes |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
98 (defvar leading-code-private-22 157) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
99 (or (fboundp 'charset-bytes) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
100 (defun charset-bytes (charset) 1)) ; ascii |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
101 (or (fboundp 'charset-dimension) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
102 (defun charset-dimension (charset) 1)) ; ascii |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
103 (or (fboundp 'charset-id) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
104 (defun charset-id (charset) 0)) ; ascii |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
105 (or (fboundp 'charset-width) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
106 (defun charset-width (charset) 1)) ; ascii |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
107 (or (fboundp 'find-charset-region) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
108 (defun find-charset-region (beg end &optional table) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
109 (list 'ascii))) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
110 (or (fboundp 'char-width) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
111 (defun char-width (char) 1)) ; ascii |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
112 (or (fboundp 'chars-in-region) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
113 (defun chars-in-region (beg end) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
114 (- (max beg end) (min beg end)))) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
115 (or (fboundp 'forward-point) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
116 (defun forward-point (arg) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
117 (save-excursion |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
118 (let ((count (abs arg)) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
119 (step (if (zerop arg) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
120 0 |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
121 (/ arg arg)))) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
122 (while (and (> count 0) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
123 (< (point-min) (point)) (< (point) (point-max))) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
124 (forward-char step) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
125 (setq count (1- count))) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
126 (+ (point) (* count step)))))) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
127 (or (fboundp 'decompose-composite-char) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
128 (defun decompose-composite-char (char &optional type |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
129 with-composition-rule) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
130 nil)) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
131 (or (fboundp 'encode-coding-string) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
132 (defun encode-coding-string (string coding-system &optional nocopy) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
133 (if nocopy |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
134 string |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
135 (copy-sequence string)))) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
136 (or (fboundp 'coding-system-p) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
137 (defun coding-system-p (obj) nil)) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
138 (or (fboundp 'ccl-execute-on-string) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
139 (defun ccl-execute-on-string (ccl-prog status str |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
140 &optional contin unibyte-p) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
141 str)) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
142 (or (fboundp 'define-ccl-program) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
143 (defmacro define-ccl-program (name ccl-program &optional doc) |
37201
a50c338bd5e7
Eliminate cl package dependence.
Gerd Moellmann <gerd@gnu.org>
parents:
37149
diff
changeset
|
144 `(defconst ,name nil ,doc))) |
a50c338bd5e7
Eliminate cl package dependence.
Gerd Moellmann <gerd@gnu.org>
parents:
37149
diff
changeset
|
145 (or (fboundp 'multibyte-string-p) |
a50c338bd5e7
Eliminate cl package dependence.
Gerd Moellmann <gerd@gnu.org>
parents:
37149
diff
changeset
|
146 (defun multibyte-string-p (str) |
a50c338bd5e7
Eliminate cl package dependence.
Gerd Moellmann <gerd@gnu.org>
parents:
37149
diff
changeset
|
147 (let ((len (length str)) |
a50c338bd5e7
Eliminate cl package dependence.
Gerd Moellmann <gerd@gnu.org>
parents:
37149
diff
changeset
|
148 (i 0) |
a50c338bd5e7
Eliminate cl package dependence.
Gerd Moellmann <gerd@gnu.org>
parents:
37149
diff
changeset
|
149 multibyte) |
a50c338bd5e7
Eliminate cl package dependence.
Gerd Moellmann <gerd@gnu.org>
parents:
37149
diff
changeset
|
150 (while (and (< i len) (not (setq multibyte (> (aref str i) 255)))) |
a50c338bd5e7
Eliminate cl package dependence.
Gerd Moellmann <gerd@gnu.org>
parents:
37149
diff
changeset
|
151 (setq i (1+ i))) |
a50c338bd5e7
Eliminate cl package dependence.
Gerd Moellmann <gerd@gnu.org>
parents:
37149
diff
changeset
|
152 multibyte))) |
a50c338bd5e7
Eliminate cl package dependence.
Gerd Moellmann <gerd@gnu.org>
parents:
37149
diff
changeset
|
153 (or (fboundp 'string-make-multibyte) |
45334
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
154 (defalias 'string-make-multibyte 'copy-sequence)) |
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
155 (or (fboundp 'encode-char) |
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
156 (defun encode-char (ch ccs) |
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
157 ch))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
158 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
159 |
27160
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
160 ;;;###autoload |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
161 (defcustom ps-multibyte-buffer nil |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
162 "*Specifies the multi-byte buffer handling. |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
163 |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
164 Valid values are: |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
165 |
27160
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
166 nil This is the value to use the default settings which |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
167 is by default for printing buffer with only ASCII |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
168 and Latin characters. The default setting can be |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
169 changed by setting the variable |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
170 `ps-mule-font-info-database-default' differently. |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
171 The initial value of this variable is |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
172 `ps-mule-font-info-database-latin' (see |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
173 documentation). |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
174 |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
175 `non-latin-printer' This is the value to use when you have a Japanese |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
176 or Korean PostScript printer and want to print |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
177 buffer with ASCII, Latin-1, Japanese (JISX0208 and |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
178 JISX0201-Kana) and Korean characters. At present, |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
179 it was not tested the Korean characters printing. |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
180 If you have a korean PostScript printer, please, |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
181 test it. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
182 |
27160
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
183 `bdf-font' This is the value to use when you want to print |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
184 buffer with BDF fonts. BDF fonts include both latin |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
185 and non-latin fonts. BDF (Bitmap Distribution |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
186 Format) is a format used for distributing X's font |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
187 source file. BDF fonts are included in |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
188 `intlfonts-1.2' which is a collection of X11 fonts |
27160
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
189 for all characters supported by Emacs. In order to |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
190 use this value, be sure to have installed |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
191 `intlfonts-1.2' and set the variable |
27160
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
192 `bdf-directory-list' appropriately (see ps-bdf.el for |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
193 documentation of this variable). |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
194 |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
195 `bdf-font-except-latin' This is like `bdf-font' except that it is used |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
196 PostScript default fonts to print ASCII and Latin-1 |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
197 characters. This is convenient when you want or |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
198 need to use both latin and non-latin characters on |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
199 the same buffer. See `ps-font-family', |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
200 `ps-header-font-family' and `ps-font-info-database'. |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
201 |
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
202 Any other value is treated as nil." |
28631
5e9674136340
Customization fix, doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
27160
diff
changeset
|
203 :type '(choice (const non-latin-printer) (const bdf-font) |
5e9674136340
Customization fix, doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
27160
diff
changeset
|
204 (const bdf-font-except-latin) (const :tag "nil" nil)) |
27160
1e00f7f6655c
ps-vars eliminated, ps-multibyte-buffer now is
Kenichi Handa <handa@m17n.org>
parents:
26882
diff
changeset
|
205 :group 'ps-print-font) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
206 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
207 (defvar ps-mule-font-info-database |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
208 nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
209 "Alist of charsets with the corresponding font information. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
210 Each element has the form: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
211 |
89530 | 212 (CHARSET (FONT-TYPE FONT-SRC FONT-NAME ENCODING BYTES)) ...) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
213 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
214 Where |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
215 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
216 CHARSET is a charset (symbol) for this font family, |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
217 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
218 FONT-TYPE is a font type: normal, bold, italic, or bold-italic. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
219 |
56679
91074b668126
(ps-mule-font-info-database): Fix docstring.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
220 FONT-SRC is a font source: builtin, bdf, vflib, or nil. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
221 |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
222 If FONT-SRC is builtin, FONT-NAME is a built-in PostScript font name. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
223 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
224 If FONT-SRC is bdf, FONT-NAME is a BDF font file name, or a list of |
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
225 alternative font names. To use this font, the external library `ps-bdf' |
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
226 is required. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
227 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
228 If FONT-SRC is vflib, FONT-NAME is the name of a font that VFlib knows. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
229 To use this font, the external library `vflib' is required. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
230 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
231 If FONT-SRC is nil, a proper ASCII font in the variable |
89530 | 232 `ps-font-info-database' is used, and FONT-NAME is ignored. |
233 This is useful for Latin-1 characters. | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
234 |
89530 | 235 ENCODING is a charset to encode a character of CHARSET to a glyph |
236 code of the specifies font. ENCODING may be a function that does | |
237 this encoding. In this case, the function is called with one | |
238 argument, the character to encode, and it should return an | |
239 encoded code. ENCODING may be nil, in which case CHARSET is used | |
240 to encode a character. | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
241 |
89530 | 242 BYTES specifies how many bytes each character has in the encoded |
243 byte sequence; it should be 1 or 2. If ENCODING is a charset, | |
244 BYTES may be nil, in chich case the dimension of ENCODING is | |
245 used. | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
246 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
247 All multi-byte characters are printed by fonts specified in this database |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
248 regardless of a font family of ASCII characters. The exception is Latin-1 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
249 characters which are printed by the same font as ASCII characters, thus obey |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
250 font family. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
251 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
252 See also the variable `ps-font-info-database'.") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
253 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
254 (defconst ps-mule-font-info-database-latin |
89530 | 255 '((iso-8859-1 |
256 (normal nil nil))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
257 "Sample setting of `ps-mule-font-info-database' to use latin fonts.") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
258 |
26115
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
259 (defcustom ps-mule-font-info-database-default |
24307
6909b106c5c6
(ps-mule-font-info-database-default): Set the initial
Kenichi Handa <handa@m17n.org>
parents:
24306
diff
changeset
|
260 ps-mule-font-info-database-latin |
30561
fb68d65b0fa3
Fix a customization problem on
Gerd Moellmann <gerd@gnu.org>
parents:
29523
diff
changeset
|
261 "*The default setting to use when `ps-multibyte-buffer' is nil." |
fb68d65b0fa3
Fix a customization problem on
Gerd Moellmann <gerd@gnu.org>
parents:
29523
diff
changeset
|
262 :type '(symbol :tag "Multi-Byte Buffer Database Font Default") |
26115
314173e121ee
Doc fix, define functions properly if mule package is
Kenichi Handa <handa@m17n.org>
parents:
25828
diff
changeset
|
263 :group 'ps-print-font) |
24306
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
264 |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
265 (defconst ps-mule-font-info-database-ps |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
266 '((katakana-jisx0201 |
89530 | 267 (normal builtin "Ryumin-Light.Katakana") |
268 (bold builtin "GothicBBB-Medium.Katakana") | |
269 (bold-italic builtin "GothicBBB-Medium.Katakana")) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
270 (latin-jisx0201 |
89530 | 271 (normal builtin "Ryumin-Light.Hankaku") |
272 (bold builtin "GothicBBB-Medium.Hankaku")) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
273 (japanese-jisx0208 |
89530 | 274 (normal builtin "Ryumin-Light-H") |
275 (bold builtin "GothicBBB-Medium-H")) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
276 (korean-ksc5601 |
89530 | 277 (normal builtin "Munhwa-Regular-KSC-EUC-H") |
278 (bold builtin "Munhwa-Bold-KSC-EUC-H")) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
279 ) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
280 "Sample setting of the `ps-mule-font-info-database' to use builtin PS font. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
281 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
282 Currently, data for Japanese and Korean PostScript printers are listed.") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
283 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
284 (defconst ps-mule-font-info-database-bdf |
89530 | 285 '((iso-8859-1 |
286 (normal bdf ("lt1-24-etl.bdf" "etl24-latin1.bdf")) | |
287 (bold bdf ("lt1-16b-etl.bdf" "etl16b-latin1.bdf")) | |
288 (italic bdf ("lt1-16i-etl.bdf" "etl16i-latin1.bdf")) | |
289 (bold-italic bdf ("lt1-16bi-etl.bdf" "etl16bi-latin1.bdf"))) | |
290 (iso-8859-2 | |
291 (normal bdf ("lt2-24-etl.bdf" "etl24-latin2.bdf"))) | |
292 (iso-8859-3 | |
293 (normal bdf ("lt3-24-etl.bdf" "etl24-latin3.bdf"))) | |
294 (iso-8859-4 | |
295 (normal bdf ("lt4-24-etl.bdf" "etl24-latin4.bdf"))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
296 (thai-tis620 |
89530 | 297 (normal bdf ("thai24.bdf" "thai-24.bdf") iso-8859-11)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
298 (greek-iso8859-7 |
89530 | 299 (normal bdf ("grk24-etl.bdf" "etl24-greek.bdf") iso-8859-7)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
300 (hebrew-iso8859-8 |
89530 | 301 (normal bdf ("heb24-etl.bdf" "etl24-hebrew.bdf") iso-8859-8)) |
302 (jisx0201 | |
303 (normal bdf "12x24rk.bdf" jisx0201)) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
304 (cyrillic-iso8859-5 |
89530 | 305 (normal bdf ("cyr24-etl.bdf" "etl24-cyrillic.bdf") iso-8859-5)) |
306 (iso-8859-9 | |
307 (normal bdf ("lt5-24-etl.bdf" "etl24-latin5.bdf") iso-8859-9)) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
308 (chinese-gb2312 |
89530 | 309 (normal bdf "gb24st.bdf")) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
310 (japanese-jisx0208 |
89530 | 311 (normal bdf "jiskan24.bdf")) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
312 (korean-ksc5601 |
89530 | 313 (normal bdf "hanglm24.bdf")) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
314 (japanese-jisx0212 |
89530 | 315 (normal bdf ("jksp40.bdf" "jisksp40.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
316 (chinese-cns11643-1 |
89530 | 317 (normal bdf ("cns1-40.bdf" "cns-1-40.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
318 (chinese-cns11643-2 |
89530 | 319 (normal bdf ("cns2-40.bdf" "cns-2-40.bdf"))) |
320 (big5 | |
321 (normal bdf "taipei24.bdf")) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
322 (chinese-sisheng |
89530 | 323 (normal bdf ("sish24-etl.bdf" "etl24-sisheng.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
324 (ipa |
89530 | 325 (normal bdf ("ipa24-etl.bdf" "etl24-ipa.bdf") ipa)) |
326 (viscii | |
327 (normal bdf ("visc24-etl.bdf" "etl24-viscii.bdf"))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
328 (arabic-digit |
89530 | 329 (normal bdf ("arab24-0-etl.bdf" "etl24-arabic0.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
330 (arabic-1-column |
89530 | 331 (normal bdf ("arab24-1-etl.bdf" "etl24-arabic1.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
332 (lao |
89530 | 333 (normal bdf ("lao24-mule.bdf" "mule-lao-24.bdf") ps-mule-encode-lao 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
334 (arabic-2-column |
89530 | 335 (normal bdf ("arab24-2-etl.bdf" "etl24-arabic2.bdf"))) |
336 (devanagari-cdac | |
337 (normal bdf "dvsr0ntt-32.bdf")) | |
338 (malayalam-cdac | |
339 (normal bdf "mlkr0ntt-32.bdf")) | |
340 (tamil-cdac | |
341 (normal bdf "tmvl0ntt-32.bdf")) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
342 (indian-is13194 |
89530 | 343 (normal bdf ("isci24-mule.bdf" "mule-iscii-24.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
344 (indian-1-column |
89530 | 345 (normal bdf ("ind1c24-mule.bdf" "mule-indian-1col-24.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
346 (ethiopic |
89530 | 347 (normal bdf ("ethio24f-uni.bdf" "ethiomx24f-uni.bdf") unicode-bmp)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
348 (chinese-cns11643-3 |
89530 | 349 (normal bdf ("cns3-40.bdf" "cns-3-40.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
350 (chinese-cns11643-4 |
89530 | 351 (normal bdf ("cns4-40.bdf" "cns-4-40.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
352 (chinese-cns11643-5 |
89530 | 353 (normal bdf ("cns5-40.bdf" "cns-5-40.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
354 (chinese-cns11643-6 |
89530 | 355 (normal bdf ("cns6-40.bdf" "cns-6-40.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
356 (chinese-cns11643-7 |
89530 | 357 (normal bdf ("cns7-40.bdf" "cns-7-40.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
358 (indian-2-column |
89530 | 359 (normal bdf ("ind24-mule.bdf" "mule-indian-24.bdf"))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
360 (tibetan |
89530 | 361 (normal bdf ("tib24p-mule.bdf" "tib24-mule.bdf" "mule-tibmdx-24.bdf"))) |
362 (unicode-bmp | |
363 (normal bdf "etl24-unicode.bdf")) | |
364 ) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
365 "Sample setting of the `ps-mule-font-info-database' to use BDF fonts. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
366 BDF (Bitmap Distribution Format) is a format used for distributing X's font |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
367 source file. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
368 |
45334
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
369 Current default value list for BDF fonts is included in `intlfonts-1.2' |
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
370 which is a collection of X11 fonts for all characters supported by Emacs. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
371 |
45334
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
372 Using this list as default value to `ps-mule-font-info-database', all |
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
373 characters including ASCII and Latin-1 are printed by BDF fonts. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
374 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
375 See also `ps-mule-font-info-database-ps-bdf'.") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
376 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
377 (defconst ps-mule-font-info-database-ps-bdf |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
378 (cons (car ps-mule-font-info-database-latin) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
379 (cdr (cdr ps-mule-font-info-database-bdf))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
380 "Sample setting of the `ps-mule-font-info-database' to use BDF fonts. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
381 |
45334
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
382 Current default value list for BDF fonts is included in `intlfonts-1.2' |
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
383 which is a collection of X11 fonts for all characters supported by Emacs. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
384 |
45334
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
385 Using this list as default value to `ps-mule-font-info-database', all |
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
386 characters except ASCII and Latin-1 characters are printed with BDF fonts. |
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
387 ASCII and Latin-1 characters are printed with PostScript font specified |
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
388 by `ps-font-family' and `ps-header-font-family'. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
389 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
390 See also `ps-mule-font-info-database-bdf'.") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
391 |
89530 | 392 (defvar ps-mule-font-spec-list nil |
393 "Array of FONT-SPEC lists for each font type. | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
394 |
89530 | 395 Elements are for `normal' font, `bold' font, `italic' font, and |
396 `bold-italic' font in this order. | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
397 |
89530 | 398 Each element is a list of FONT-SPEC which has this form: |
399 | |
400 (ID CHARSET (FONT-SRC FONT-NAME ENCODING) EXTRA-DATA) | |
401 | |
402 Where | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
403 |
89530 | 404 ID is a number for this FONT-SPEC and is unique in the list. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
405 |
89530 | 406 CHARSET, FONT-SRC, FONT-NAME, ENCODING are the same as those in |
407 `ps-mule-font-info-database' (which see). | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
408 |
89530 | 409 EXTRA-DATA is a data attached by external libraries. |
45334
695ae1bd8fa4
(eval-and-compile): Add a trivial replacement for a
Eli Zaretskii <eliz@gnu.org>
parents:
39353
diff
changeset
|
410 |
89530 | 411 Each list is ordered by the current charset priorities. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
412 |
89530 | 413 This variable is setup by `ps-mule-begin-job' from |
414 `ps-mule-font-info-database'.") | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
415 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
416 ;; Functions to access each element of FONT-SPEC. |
89530 | 417 (defsubst ps-mule-font-spec-id (font-spec) (aref font-spec 0)) |
418 (defsubst ps-mule-font-spec-charset (font-spec) (aref font-spec 1)) | |
419 (defsubst ps-mule-font-spec-font-id (font-spec) (aref font-spec 2)) | |
420 (defsubst ps-mule-font-spec-src (font-spec) (aref font-spec 3)) | |
421 (defsubst ps-mule-font-spec-name (font-spec) (aref font-spec 4)) | |
422 (defsubst ps-mule-font-spec-set-name (font-spec name) | |
423 (aset font-spec 4 name)) | |
424 (defsubst ps-mule-font-spec-encoding (font-spec) (aref font-spec 5)) | |
425 (defsubst ps-mule-font-spec-bytes (font-spec) (aref font-spec 6)) | |
426 (defsubst ps-mule-font-spec-extra (font-spec) (aref font-spec 7)) | |
427 (defsubst ps-mule-font-spec-set-extra (font-spec extra) | |
428 (aset font-spec 7 extra)) | |
429 | |
430 ;; Functions to encode character into glyph code. | |
431 (defun ps-mule-encode-lao (char) | |
432 (- char #x0DE0)) | |
433 | |
434 (defun ps-mule-encode-char (char font-spec) | |
435 (let ((encoding (ps-mule-font-spec-encoding font-spec))) | |
436 (cond ((charsetp encoding) | |
437 (encode-char char encoding)) | |
438 ((fboundp encoding) | |
439 (funcall encoding char)) | |
440 (t | |
441 char)))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
442 |
89530 | 443 ;; Array of FONT-SPEC-TABLEs; Nth element is for FONT-TYPE N. |
444 ;; | |
445 ;; FONT-TYPE is 0, 1, 2, or 3 representing normal, bold, italic, and | |
446 ;; bold-italic respectively. | |
447 ;; | |
448 ;; FONT-SPEC-TABLE is a char-table of FONT-SPECs. It records which | |
449 ;; character is printed by which FONT-SPEC. It has one extra slot | |
450 ;; whose value is an alist of the form: | |
451 ;; (CHARSET . FONT-SPEC) | |
452 ;; FONT-SPEC is a vecotr of the form: | |
453 ;; (ID FONT-SRC FONT-NAME ENCODING EXTRA) | |
454 (defvar ps-mule-font-spec-tables nil) | |
455 | |
456 ;; Array of FONT-TYPEs; Nth element FONT-NUMBER N. | |
457 ;; | |
458 ;; FONT-NUMBER is 0, 1, 2, 3, 4, 5, 6 representing fonts f0, f1, f2, | |
459 ;; f3, h0, h1, and H0. | |
460 (defconst ps-mule-font-number-to-type [ 0 1 2 3 1 0 0 ]) | |
461 | |
462 (defsubst ps-mule-get-font-spec (char font-spec-table font-spec) | |
463 "Return a font spec for printing CHAR with FONT-SPEC-TABLE. | |
464 | |
465 FONT-SPEC, if non-nil, is a font spec to try at first. | |
466 | |
467 See the documentation of `ps-mule-font-spec-tables' for the | |
468 format of font spec." | |
469 | |
470 (or (aref font-spec-table char) | |
471 (aset font-spec-table char | |
472 (or (and (< char 256) | |
473 (cdr (car (char-table-extra-slot font-spec-table 0)))) | |
474 (and font-spec | |
475 (encode-char char (ps-mule-font-spec-charset font-spec)) | |
476 font-spec) | |
477 (catch 'tag | |
478 (dolist (elt (char-table-extra-slot font-spec-table 0)) | |
479 (and (encode-char char (car elt)) | |
480 (throw 'tag (cdr elt))))) | |
481 ;; Record that no font-spec exist for CHAR. | |
482 t)))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
483 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
484 (defconst ps-mule-external-libraries |
89530 | 485 '((builtin nil nil nil nil nil nil) |
486 (bdf ps-bdf nil bdf-generate-prologue | |
487 bdf-check-font bdf-generate-font bdf-generate-glyph) | |
488 (pcf nil nil pcf-generate-prologue | |
489 pcf-check-font pcf-generate-font pcf-generate-glyph) | |
490 (vflib nil nil vflib-generate-prologue | |
491 vflib-check-font vflib-generate-font vflib-generate-glyphs)) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
492 "Alist of information of external libraries to support PostScript printing. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
493 Each element has the form: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
494 |
89530 | 495 (FONT-SRC FEATURE INITIALIZED-P |
496 PROLOGUE-FUNC CHECK-FUNC FONT-FUNC GLYPH-FUNC) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
497 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
498 FONT-SRC is the font source: builtin, bdf, pcf, or vflib. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
499 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
500 FEATURE is the feature that provide a facility to handle FONT-SRC. Except for |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
501 `builtin' FONT-SRC, this feature is automatically `require'd before handling |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
502 FONT-SRC. Currently, we only have the feature `ps-bdf'. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
503 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
504 INITIALIZED-P indicates if this library is initialized or not. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
505 |
89530 | 506 PROLOGUE-FUNC is a function to generate PostScript code which |
507 define several PostScript procedures that will be called by | |
508 FONT-FUNC and GLYPHS-FUNC. It is called with no argument, and | |
509 should return a list of strings. | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
510 |
89530 | 511 CHECK-FUNC is a function to check if a font is available or not. |
512 It is called with one argument FONT-SPEC, and should return | |
513 non-nil iff the font specified in FONT-SPEC is available. | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
514 |
89530 | 515 FONT-FUNC is a function to generate PostScript code which define |
516 a new font. It is called with one argument FONT-SPEC, and should | |
517 return a list of strings. | |
518 | |
519 GLYPH-FUNC is a function to generate PostScript code which define a glyph of | |
520 characters. It is called with two arguments FONT-SPEC and CODE, | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
521 and should return a list of strings.") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
522 |
89530 | 523 (defsubst ps-mule-exlib-feature (exlib) (nth 1 exlib)) |
524 (defsubst ps-mule-exlib-initialized-p (exlib) (nth 2 exlib)) | |
525 (defsubst ps-mule-exlib-set-initialized-p (exlib val) | |
526 (setcar (nthcdr 2 exlib) val)) | |
527 (defsubst ps-mule-exlib-prologue (exlib) (nth 3 exlib)) | |
528 (defsubst ps-mule-exlib-check (exlib) (nth 4 exlib)) | |
529 (defsubst ps-mule-exlib-font (exlib) (nth 5 exlib)) | |
530 (defsubst ps-mule-exlib-glyph (exlib) (nth 6 exlib)) | |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
531 |
89530 | 532 (defun ps-mule-init-external-library (exlib) |
533 "Initialize external library specified by EXLIB for PostScript printing. | |
534 See the documentation of `ps-mule-external-libraries' for EXLIB's meaning." | |
535 (or (ps-mule-exlib-initialized-p exlib) | |
536 (let ((prologue-func (ps-mule-exlib-prologue exlib))) | |
537 (if prologue-func | |
538 (let ((feature (ps-mule-exlib-feature exlib))) | |
539 (if feature | |
540 (require feature)) | |
541 (ps-output-prologue (funcall prologue-func)))) | |
542 (ps-mule-exlib-set-initialized-p exlib t)))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
543 |
89530 | 544 (defvar ps-mule-output-list nil) |
545 | |
546 (defun ps-mule-check-font (font-spec) | |
547 "Check if a font specified in FONT-SPEC is available or not." | |
548 (let ((font-src (ps-mule-font-spec-src font-spec))) | |
549 (or (not font-src) | |
550 (let ((exlib (assq font-src ps-mule-external-libraries))) | |
551 (ps-mule-init-external-library exlib) | |
552 (or (not (ps-mule-exlib-check exlib)) | |
553 (funcall (ps-mule-exlib-check exlib) font-spec)))))) | |
554 | |
555 (defun ps-mule-prepare-font (font-spec) | |
556 "Generate PostScript codes defining a new font of FONT-TYPE for CHARSET." | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
557 (let* ((font-src (ps-mule-font-spec-src font-spec)) |
89530 | 558 (exlib (assq font-src ps-mule-external-libraries)) |
559 (id (ps-mule-font-spec-id font-spec)) | |
560 (ftag (format "%02X" id)) | |
561 (font-func (ps-mule-exlib-font exlib)) | |
562 output-list) | |
563 (if font-func | |
564 (setq output-list (funcall font-func font-spec)) | |
565 (setq output-list | |
566 (format "/F%s /%s findfont def\n" | |
567 ftag (or (ps-mule-font-spec-name font-spec) "Courier"))) | |
568 (ps-mule-font-spec-set-extra font-spec t)) | |
569 (and output-list | |
570 (nconc ps-mule-output-list (list output-list))))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
571 |
89530 | 572 (defun ps-mule-prepare-glyph (char font-spec) |
573 "Generate PostScript codes to print CHAR by FONT-SPEC. | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
574 |
89530 | 575 If CHAR is a cons (FROM TO), generate codes for characters |
576 specified by the character code range FROM and TO. | |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
577 |
89530 | 578 The generated code is inserted on prologue part." |
579 (if (vectorp font-spec) | |
580 (progn | |
581 (or (ps-mule-font-spec-extra font-spec) | |
582 (ps-mule-prepare-font font-spec)) | |
583 (let ((glyph-func (ps-mule-exlib-glyph | |
584 (assq (ps-mule-font-spec-src font-spec) | |
585 ps-mule-external-libraries)))) | |
586 (if glyph-func | |
587 (let (from to output-list) | |
588 (if (consp char) | |
589 (setq from (car char) to (cdr char)) | |
590 (setq from char to char)) | |
591 (while (<= from to) | |
592 (setq output-list | |
593 (funcall glyph-func font-spec from)) | |
594 (and output-list | |
595 (ps-output-prologue output-list)) | |
596 (setq from (1+ from))))))))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
597 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
598 ;; This is a PostScript code inserted in the header of generated PostScript. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
599 (defconst ps-mule-prologue |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
600 "%%%% Start of Mule Section |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
601 |
89534 | 602 /Latin1Encoding { % newname fontname | font |
603 findfont dup length dict begin | |
604 { 1 index /FID ne { def } { pop pop } ifelse } forall | |
605 /Encoding ISOLatin1Encoding def | |
606 currentdict | |
607 end | |
608 definefont | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
609 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
610 |
89530 | 611 %% Redefine fonts for multiple charsets. |
612 /ReDefFont { % fontname encoding fdepvector size | - | |
613 20 dict begin | |
614 3 index findfont { | |
615 1 index /FID ne 2 index /UniqueID ne and {def} {pop pop} ifelse | |
616 } forall | |
617 /FontType 0 def | |
618 /FMapType 3 def | |
619 /EscChar 0 def | |
620 % FontMatrix ::= [ size 0 0 size 0 0 ] | |
621 /FontMatrix exch [ exch dup 0 exch 0 exch 0 0 ] def | |
622 /FDepVector exch def | |
623 /Encoding exch def | |
624 currentdict | |
625 end % fontname dic | |
626 definefont pop | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
627 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
628 " |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
629 "PostScript code for printing multi-byte characters.") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
630 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
631 (defvar ps-mule-prologue-generated nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
632 |
89530 | 633 ;; EscChar used in generated composite fonts. |
634 (defconst ps-mule-esc-char 0) | |
635 | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
636 (defun ps-mule-prologue-generated () |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
637 (unless ps-mule-prologue-generated |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
638 (ps-output-prologue ps-mule-prologue) |
89530 | 639 (ps-output-prologue (format "/EscChar %d def\n" ps-mule-esc-char)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
640 (setq ps-mule-prologue-generated t))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
641 |
89530 | 642 (defun ps-mule-encode-region (from to font-spec-table) |
643 "Generate PostScript code for plotting characters in the region FROM and TO. | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
644 |
89530 | 645 FONT-NUM is 0, 1, 2, 3, 4, 5, or 6, each represents font tags |
646 f0, f1, f2, f3, h0, h1, and H0 respectively." | |
647 (let* ((font-spec nil) | |
648 (font-id 0) | |
649 (string-list nil) | |
650 ;; At most 4-byte (EscChar FONT-ID CODE1 CODE2) per character. | |
651 (str (make-string (* (- to from) 4) 0)) | |
652 (i 0)) | |
653 (goto-char from) | |
654 (while (< (point) to) | |
655 (let* ((char (following-char)) | |
656 (this-spec (ps-mule-get-font-spec char font-spec-table font-spec)) | |
657 this-id) | |
658 (if (vectorp this-spec) | |
659 (setq this-id (ps-mule-font-spec-font-id this-spec)) | |
660 ;; Can't print CHAR. Replace it with '?'. | |
661 (setq char ?? | |
662 this-spec (ps-mule-get-font-spec char font-spec-table nil) | |
663 this-id (ps-mule-font-spec-font-id this-spec))) | |
664 (or (= font-id this-id) | |
665 (progn | |
666 (if font-spec | |
667 (setq string-list (cons (substring str 0 i) string-list) | |
668 i 0)) | |
669 (setq font-id this-id) | |
670 (or (= font-id 0) | |
671 (progn | |
672 (aset str i ps-mule-esc-char) | |
673 (setq i (1+ i)) | |
674 (aset str i font-id) | |
675 (setq i (1+ i)))))) | |
676 (setq font-spec this-spec) | |
677 (if (< char 128) | |
678 (aset str i char) | |
679 (let* ((code (ps-mule-encode-char char font-spec))) | |
680 (if (= (ps-mule-font-spec-bytes font-spec) 1) | |
90328
05b8b8dd212b
(ps-mule-eight-bit-char): Delete this function.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
681 (aset str i code) |
05b8b8dd212b
(ps-mule-eight-bit-char): Delete this function.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
682 (aset str i (/ code 256)) |
89530 | 683 (setq i (1+ i)) |
90328
05b8b8dd212b
(ps-mule-eight-bit-char): Delete this function.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
684 (aset str i (% code 256))))) |
89530 | 685 (setq i (1+ i)) |
686 (forward-char 1))) | |
687 (nreverse (cons (substring str 0 i) string-list)))) | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
688 |
89530 | 689 (defun ps-mule-plot-composition (composition font-spec-table) |
690 "Generate PostScript code for plotting COMPOSITION with FONT-NUM." | |
691 (ps-output "[") | |
692 (let ((components (copy-sequence (nth 2 composition))) | |
693 (font-spec nil)) | |
694 (dotimes (i (length components)) | |
695 (let ((elt (aref components i)) | |
696 this-spec) | |
697 (if (consp elt) | |
698 ;; ELT is a composition rule. | |
699 (ps-output (format " %d" (encode-composition-rule elt))) | |
700 ;; ELT is a glyph character. | |
701 (setq this-spec | |
702 (ps-mule-get-font-spec elt font-spec-table font-spec)) | |
703 (or (vectorp this-spec) | |
704 ;; Can't print CHAR. Replace it with '?'. | |
705 (setq elt ?? | |
706 this-spec | |
707 (ps-mule-get-font-spec elt font-spec-table font-spec))) | |
708 (setq font-spec this-spec) | |
709 (let* ((bytes (ps-mule-font-spec-bytes font-spec)) | |
710 (code (ps-mule-encode-char elt font-spec)) | |
711 (font-id (ps-mule-font-spec-font-id font-spec)) | |
712 (str (make-string (if (= font-id 0) 1 (+ 2 bytes)) 0))) | |
713 (if (= font-id 0) | |
90328
05b8b8dd212b
(ps-mule-eight-bit-char): Delete this function.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
714 (aset str 0 code) |
89530 | 715 (aset str 0 ps-mule-esc-char) |
90328
05b8b8dd212b
(ps-mule-eight-bit-char): Delete this function.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
716 (aset str 1 font-id) |
89530 | 717 (if (= bytes 1) |
90328
05b8b8dd212b
(ps-mule-eight-bit-char): Delete this function.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
718 (aset str 2 code) |
05b8b8dd212b
(ps-mule-eight-bit-char): Delete this function.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
719 (aset str 2 (/ code 256)) |
05b8b8dd212b
(ps-mule-eight-bit-char): Delete this function.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
720 (aset str 3 (% code 256)))) |
89530 | 721 (ps-output "[") |
722 (ps-output-string str) | |
723 (ps-output (if (eq (ps-mule-font-spec-src font-spec) 'bdf) | |
724 (format "/C%02X-%X" (ps-mule-font-spec-id font-spec) | |
725 elt) | |
726 "false")) | |
727 (ps-output "]")))))) | |
728 (ps-output " ] " (if (nth 3 composition) "RLC" "RBC") "\n")) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
729 |
89530 | 730 (defun ps-mule-plot-string (from to &optional bg-color) |
731 "Generate PostScript code for plotting characters in the region FROM and TO. | |
732 | |
733 Optional argument BG-COLOR is ignored. | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
734 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
735 Returns the value: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
736 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
737 (ENDPOS . RUN-WIDTH) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
738 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
739 Where ENDPOS is the end position of the sequence and RUN-WIDTH is the width of |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
740 the sequence." |
89530 | 741 (let* ((average-width (ps-avg-char-width 'ps-font-for-text)) |
742 (point (point)) | |
743 (composition (find-composition from to nil t)) | |
744 (stop (if composition (car composition) to)) | |
745 (ascii-or-latin-1 "[\000-\377]+") | |
746 (run-width 0) | |
747 (endpos nil) | |
748 (font-spec-table (aref ps-mule-font-spec-tables | |
749 (aref ps-mule-font-number-to-type | |
750 ps-current-font))) | |
751 width) | |
752 (goto-char from) | |
753 (while (not endpos) | |
754 (cond ((= (point) stop) | |
755 (if (= stop to) | |
756 (setq endpos stop) | |
757 (if (< from stop) | |
758 (dolist (l (ps-mule-encode-region from (point) | |
759 font-spec-table)) | |
760 (ps-output-string l) | |
761 (ps-output " S\n"))) | |
762 (setq width (* (nth 5 composition) average-width)) | |
763 (if (< ps-width-remaining (+ run-width width)) | |
764 (setq endpos stop) | |
765 (ps-mule-plot-composition composition font-spec-table) | |
766 (setq run-width (+ run-width width) | |
767 from (nth 1 composition)) | |
768 (goto-char from) | |
769 (setq composition (find-composition (point) to nil t)) | |
770 (setq stop (if composition (car composition) to))))) | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
771 |
89530 | 772 ((looking-at ascii-or-latin-1) |
773 (let ((nchars (- (min (match-end 0) stop) (point)))) | |
774 (setq width (* average-width nchars)) | |
775 (if (< ps-width-remaining (+ run-width width)) | |
776 (setq nchars (truncate (- ps-width-remaining run-width) | |
777 average-width) | |
778 run-width (+ run-width (* nchars average-width)) | |
779 endpos (+ (point) nchars)) | |
780 (setq run-width (+ run-width width)) | |
781 (forward-char nchars)))) | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
782 |
89530 | 783 (t |
784 (while (and (< (point) stop) (not endpos)) | |
785 (setq width (char-width (following-char))) | |
786 (if (< ps-width-remaining (+ run-width width)) | |
787 (setq endpos (point)) | |
788 (setq run-width (+ run-width width)) | |
789 (forward-char 1)))))) | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
790 |
89530 | 791 (if (< from endpos) |
792 (dolist (l (ps-mule-encode-region from endpos font-spec-table)) | |
793 (ps-output-string l) | |
794 (ps-output " S\n"))) | |
795 (goto-char point) | |
796 (cons endpos run-width))) | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
797 |
89530 | 798 ;; Character composition support |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
799 |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
800 (defvar ps-mule-composition-prologue-generated nil) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
801 |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
802 (defconst ps-mule-composition-prologue |
89530 | 803 "%%%% Procedures for character composition. |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
804 /RelativeCompositionSkip 0.4 def |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
805 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
806 %% Get a bounding box (relative to currentpoint) of STR. |
89530 | 807 /GetPathBox { % [ str cname ] | - |
808 dup 1 get dup false ne { | |
809 BitmapDict exch get /bmp exch def | |
810 %% bmp ::= [ DWIDTH WIDTH HEIGHT XOFF YOFF BITMAP RELATIVE-COMPOSE] | |
811 /LLY bmp 4 get def | |
812 /URY LLY bmp 2 get add def | |
813 /RelativeCompose bmp 6 get dup false ne { | |
814 dup LLY le { pop 1 } { URY ge { -1 } { 0 } ifelse } ifelse | |
815 } { | |
816 pop 0 | |
817 } ifelse def | |
818 dup 0 get stringwidth pop dup /WIDTH exch def bmp 0 get div | |
819 dup LLY mul /LLY exch def | |
820 URY mul /URY exch def | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
821 } { |
89530 | 822 pop |
823 dup 0 get stringwidth pop /WIDTH exch def | |
824 gsave 0 0 moveto | |
825 dup 0 get false charpath flattenpath pathbbox | |
826 /URY exch def pop /LLY exch def pop | |
827 grestore | |
828 /RelativeCompose 0 def | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
829 } ifelse |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
830 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
831 |
89530 | 832 %% Apply effects except for shadow and outline to the rectangle |
833 %% specified by TOP BOTTOM LEFT RIGHT. | |
834 /SpecialEffect { % -- | -- | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
835 currentpoint dup TOP add /yy exch def BOTTOM add /YY exch def |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
836 dup LEFT add /xx exch def RIGHT add /XX exch def |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
837 %% Adjust positions for future shadowing. |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
838 Effect 8 and 0 ne { |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
839 /yy yy Yshadow add def |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
840 /XX XX Xshadow add def |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
841 } if |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
842 Effect 1 and 0 ne { UnderlinePosition Hline } if % underline |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
843 Effect 2 and 0 ne { StrikeoutPosition Hline } if % strikeout |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
844 Effect 4 and 0 ne { OverlinePosition Hline } if % overline |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
845 bg { % background |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
846 true |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
847 Effect 16 and 0 ne {SpaceBackground doBox} { xx yy XX YY doRect} ifelse |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
848 } if |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
849 Effect 16 and 0 ne { false 0 doBox } if % box |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
850 } def |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
851 |
89530 | 852 %% Draw COMPONENTS which has the form [ [str0 xoff0 yoff0] ... ] with |
853 %% effects shadow and outline. | |
854 /ShowComponents { % components | - | |
855 gsave | |
856 { gsave aload pop rmoveto | |
857 Effect 8 and 0 ne { dup doShadow } if | |
858 Effect 32 and 0 ne { true doOutline } { show } ifelse | |
859 grestore | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
860 } forall |
89530 | 861 grestore |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
862 RIGHT 0 rmoveto |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
863 } def |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
864 |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
865 %% Show relative composition. |
89530 | 866 /RLC { % [[str0 cname0] [str1 cname1] ... [strN cnameN]] | - |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
867 /components exch def |
89530 | 868 [ % push [str xoff yoff] one by one |
869 [ components 0 get GetPathBox aload pop pop 0 0 ] | |
870 %% Bounding box of overall glyphs. | |
871 /LEFT 0 def | |
872 /RIGHT WIDTH def | |
873 /TOP URY def | |
874 /BOTTOM LLY def | |
875 | |
876 1 1 components length 1 sub { | |
877 components exch get | |
878 [ exch | |
879 GetPathBox | |
880 aload pop pop % str | |
881 0 % xoff | |
882 RelativeCompose 1 eq { % compose on TOP | |
883 TOP LLY sub RelativeCompositionSkip add % yoff | |
884 /TOP TOP URY LLY sub add RelativeCompositionSkip add def | |
885 } { RelativeCompose -1 eq { % compose under BOTTOM | |
886 BOTTOM URY sub RelativeCompositionSkip sub % yoff | |
887 /BOTTOM BOTTOM URY LLY sub sub | |
888 RelativeCompositionSkip sub def | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
889 } { |
89530 | 890 0 % yoff |
891 URY TOP gt { /TOP URY def } if | |
892 LLY BOTTOM lt { /BOTTOM LLY def } if | |
893 } ifelse } ifelse | |
894 ] | |
895 } for | |
896 ] | |
897 SpecialEffect % Reflect special effects. | |
898 ShowComponents % Draw components. | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
899 } def |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
900 |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
901 %% Show rule-base composition. |
89530 | 902 /RBC { % [[str0 cname0] rule1 [str1 cname0] rule2 ... [strN cnameN]] | - |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
903 /components exch def |
89530 | 904 [ % push [str xoff yoff] one by one |
905 [ components 0 get GetPathBox aload pop pop 0 0 ] | |
906 %% Bounding box of overall glyphs. | |
907 /LEFT 0 def | |
908 /RIGHT WIDTH def | |
909 /TOP URY def | |
910 /BOTTOM LLY def | |
911 1 1 components length 1 sub { | |
912 components exch get /elt exch def | |
913 elt type /integertype eq { % rule | |
914 %% Do the same RULE decoding as the macro | |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
915 %% COMPOSITION_DECODE_RULE in emacs/src/composite.h. |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
916 elt 12 idiv dup 3 mod /grefx exch def 3 idiv /grefy exch def |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
917 elt 12 mod dup 3 mod /nrefx exch def 3 idiv /nrefy exch def |
89530 | 918 } { % other strings |
919 [ | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
920 elt GetPathBox |
89530 | 921 aload pop pop |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
922 /height URY LLY sub def |
89530 | 923 /left LEFT [ 0 RIGHT LEFT sub dup 2 div exch ] grefx get add |
924 [ 0 WIDTH 2 div WIDTH ] nrefx get sub def | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
925 /bottom [ TOP 0 BOTTOM TOP BOTTOM add 2 div ] grefy get |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
926 [ height LLY neg 0 height 2 div ] nrefy get sub def |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
927 %% Update bounding box |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
928 left LEFT lt { /LEFT left def } if |
89530 | 929 left WIDTH add RIGHT gt { /RIGHT left WIDTH add def } if |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
930 bottom BOTTOM lt { /BOTTOM bottom def } if |
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
931 bottom height add TOP gt { /TOP bottom height add def } if |
89530 | 932 left bottom LLY sub ] |
933 } ifelse | |
934 } for | |
935 ] | |
38855
db1312628833
(find-composition): Check if (char-after POS)
Gerd Moellmann <gerd@gnu.org>
parents:
38816
diff
changeset
|
936 |
89530 | 937 LEFT 0 lt { % Adjust xoff to the right. |
938 dup { dup 1 get LEFT sub 1 exch put } forall | |
939 /RIGHT RIGHT LEFT sub def | |
940 } if | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
941 |
89530 | 942 SpecialEffect % Reflect special effects. |
943 ShowComponents % Draw components. | |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
944 } def |
89530 | 945 %%%% End of procedures for character composition |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
946 " |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
947 "PostScript code for printing character composition.") |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
948 |
89530 | 949 (defun ps-mule-composition-prologue-generated () |
950 (unless ps-mule-composition-prologue-generated | |
951 (ps-mule-prologue-generated) | |
952 (ps-output-prologue ps-mule-composition-prologue) | |
953 (setq ps-mule-composition-prologue-generated t))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
954 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
955 ;; Bitmap font support |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
956 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
957 (defvar ps-mule-bitmap-prologue-generated nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
958 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
959 (defconst ps-mule-bitmap-prologue |
89530 | 960 "%%%% Procedures for bitmap fonts. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
961 |
89530 | 962 %% Create a base bitmap font. |
963 /NBF { % fontname fontsize relative-compose baseline-offset enc | -- | |
964 11 dict begin | |
965 /FontType 3 def | |
966 /FontMatrix matrix def | |
967 /FontBBox [ 0 0 0 0 ] def | |
968 /Encoding exch def | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
969 /BaselineOffset exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
970 /RelativeCompose exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
971 /FontSize exch def |
89530 | 972 /FontMatrix [ 1 FontSize div 0 0 1 FontSize div 0 0 ] def |
973 /BuildGlyph { % fontdict charname | - | |
974 BitmapDict exch get /bmp exch def pop | |
975 %% bmp ::= [ DWIDTH WIDTH HEIGHT XOFF YOFF BITMAP RELATIVE-COMPOSE ] | |
976 /llx bmp 3 get def | |
977 /lly bmp 4 get def | |
978 /urx llx bmp 1 get add def | |
979 /ury lly bmp 2 get add def | |
980 bmp 0 get 0 llx lly urx ury setcachedevice | |
981 bmp 5 get length 0 gt { | |
982 llx ury translate | |
983 bmp 1 get bmp 2 get | |
984 true [ 1 0 0 -1 0 0 ] { bmp 5 get } imagemask | |
985 } if | |
986 } bind def | |
987 /BuildChar { % fontdict byte | - | |
988 1 index /Encoding get exch get | |
989 1 index /BuildGlyph get exec | |
990 } bind def | |
991 dup currentdict end | |
992 definefont def | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
993 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
994 |
89530 | 995 %% Create a parent font of 8/8 mapping. |
996 /NPF { % fontname encoding fdepvector | - | |
997 8 dict begin | |
998 /FontType 0 def | |
999 /FMapType 2 def | |
1000 /FontMatrix matrix def | |
1001 /FDepVector exch def | |
1002 /Encoding exch def | |
1003 dup currentdict | |
1004 end | |
1005 definefont def | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1006 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1007 |
89530 | 1008 %%%% End of procedures for bitmap fonts. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1009 ") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1010 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1011 ;; External library support. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1012 |
89530 | 1013 (defvar ps-mule-bitmap-dict-list nil) |
89532 | 1014 (defvar ps-mule-bitmap-font-record nil) |
89530 | 1015 |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1016 ;; The following three functions are to be called from external |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1017 ;; libraries which support bitmap fonts (e.g. `bdf') to get |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1018 ;; appropriate PostScript code. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1019 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1020 (defun ps-mule-generate-bitmap-prologue () |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1021 (unless ps-mule-bitmap-prologue-generated |
89530 | 1022 (setq ps-mule-bitmap-prologue-generated t |
1023 ps-mule-bitmap-dict-list nil | |
1024 ps-mule-bitmap-font-record (make-vector 1024 nil)) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1025 (list ps-mule-bitmap-prologue))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1026 |
89530 | 1027 (defun ps-mule-generate-bitmap-font (font-spec size relative-compose |
1028 baselie-offset bbx) | |
1029 (let* ((id (ps-mule-font-spec-id font-spec)) | |
1030 (bytes (ps-mule-font-spec-bytes font-spec)) | |
1031 output-list) | |
1032 (if (= bytes 1) | |
1033 (setq output-list | |
1034 (list (format "/E%02X [ 0 1 255 {pop /.notdef} for ] def\n" id) | |
1035 (format "%%%% %s\n" (ps-mule-font-spec-name font-spec)) | |
1036 (format "/F%02X %f %S %d E%02X NBF\n" id size | |
1037 relative-compose baselie-offset id))) | |
1038 (setq output-list | |
1039 (list (list (format "/E%02X [ 0 1 255 { pop 0 } for ] def\n" id)) | |
1040 (list (format "/V%02X [" id)) | |
1041 " ] def\n" | |
1042 (format "%%%% %s\n" (ps-mule-font-spec-name font-spec)) | |
1043 (format "/F%02X E%02X V%02X NPF\n" id id id)))) | |
1044 (aset ps-mule-bitmap-font-record id | |
1045 (vector (= bytes 1) output-list | |
1046 size relative-compose baselie-offset bbx)) | |
1047 (if ps-mule-bitmap-dict-list | |
1048 output-list | |
1049 (setq ps-mule-bitmap-dict-list (list "/BitmapDict <<\n" ">> def\n")) | |
1050 (cons ps-mule-bitmap-dict-list output-list)))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1051 |
89530 | 1052 (defun ps-mule-generate-bitmap-glyph (font-spec char code bitmap) |
1053 (let* ((id (ps-mule-font-spec-id font-spec)) | |
1054 ;; FONT-RECORD ::= ([(SUBFONT-OUTPUT-LIST ...) | t] | |
1055 ;; BASEFONT-OUTPUT-LIST SIZE REL-COMP B-OFFSET BBX) | |
1056 (font-record (aref ps-mule-bitmap-font-record id)) | |
1057 enc-name | |
1058 output-list) | |
1059 (if (listp (aref font-record 0)) | |
1060 ;; This is a 2-dimensional font. Create a subfont for this | |
1061 ;; glyph if not yet created. | |
1062 (let* ((high (/ code 256)) | |
1063 (id2 (+ (* id 256) high))) | |
1064 (setq output-list (cdr (assq high (aref font-record 0))) | |
1065 code (% code 256)) | |
1066 (or output-list | |
1067 ;; We must create a subfont. | |
1068 (let ((enc-list (car (aref font-record 1))) | |
1069 (fdep-list (nth 1 (aref font-record 1)))) | |
1070 (setq output-list | |
1071 (list | |
1072 (format "/E%04X [ 0 1 255 {pop /.notdef} for ] def\n" | |
1073 id2) | |
1074 (format "/F%04X %f %S %d E%04X NBF\n" | |
1075 id2 (aref font-record 2) (aref font-record 3) | |
1076 (aref font-record 4) id2) | |
1077 (format "E%02X %d %d put\n" | |
1078 id high (1- (length fdep-list))))) | |
1079 (nconc enc-list (list output-list)) | |
1080 (nconc fdep-list (list (format " F%04X" id2))) | |
1081 (aset font-record 0 | |
1082 (cons (cons high output-list) (aref font-record 0))))) | |
1083 (setq enc-name (format "%04X" id2))) | |
1084 (setq output-list (aref font-record 1) | |
1085 enc-name (format "%02X" id))) | |
1086 (setcdr ps-mule-bitmap-dict-list | |
1087 (cons (format "/C%02X-%X %s\n" id char bitmap) | |
1088 (cdr ps-mule-bitmap-dict-list))) | |
1089 (setcdr output-list | |
1090 (cons (format "E%s %d /C%02X-%X put\n" enc-name code id char) | |
1091 (cdr output-list)))) | |
1092 nil) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1093 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1094 ;; Mule specific initializers. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1095 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1096 ;;;###autoload |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1097 (defun ps-mule-initialize () |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1098 "Initialize global data for printing multi-byte characters." |
89530 | 1099 (setq ps-mule-prologue-generated nil |
26882
5b331ff3b477
Define encode-composition-rule and find-composition
Kenichi Handa <handa@m17n.org>
parents:
26512
diff
changeset
|
1100 ps-mule-composition-prologue-generated nil |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1101 ps-mule-bitmap-prologue-generated nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1102 (mapcar `(lambda (x) (setcar (nthcdr 2 x) nil)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1103 ps-mule-external-libraries)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1104 |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
1105 (defun ps-mule-encode-header-string (string fonttag) |
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
1106 "Generate PostScript code for ploting STRING by font FONTTAG. |
89530 | 1107 FONTTAG should be a string \"/h0\", \"/h1\", \"/L0\", or \"/H0\"." |
1108 (with-temp-buffer | |
1109 (insert string) | |
1110 (ps-mule-encode-region (point-min) (point-max) | |
1111 (aref ps-mule-font-spec-tables | |
1112 (aref ps-mule-font-number-to-type | |
1113 (cond ((string= fonttag "/h0") 4) | |
1114 ((string= fonttag "/h1") 5) | |
1115 ((string= fonttag "/L0") 6) | |
1116 (t 0))))))) | |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
1117 |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1118 ;;;###autoload |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1119 (defun ps-mule-begin-job (from to) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1120 "Start printing job for multi-byte chars between FROM and TO. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1121 This checks if all multi-byte characters in the region are printable or not." |
89530 | 1122 (auto-compose-region from to) |
1123 (if (and (not (find-composition from to)) | |
1124 (save-excursion | |
1125 (goto-char from) | |
1126 (= (skip-chars-forward "\x00-\xFF" to) to))) | |
1127 ;; All characters can be printed by normal PostScript fonts. | |
1128 (setq ps-basic-plot-string-function 'ps-basic-plot-string | |
1129 ps-encode-header-string-function 'identity) | |
1130 (setq ps-basic-plot-string-function 'ps-mule-plot-string | |
1131 ps-encode-header-string-function 'ps-mule-encode-header-string | |
1132 ps-mule-font-info-database | |
1133 (cond ((eq ps-multibyte-buffer 'non-latin-printer) | |
1134 ps-mule-font-info-database-ps) | |
1135 ((eq ps-multibyte-buffer 'bdf-font) | |
1136 ps-mule-font-info-database-bdf) | |
1137 ((eq ps-multibyte-buffer 'bdf-font-except-latin) | |
1138 ps-mule-font-info-database-ps-bdf) | |
1139 (t | |
1140 ps-mule-font-info-database-default))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1141 |
89530 | 1142 ;; Be sure to have font information for Latin-1. |
1143 (or (assq 'iso-8859-1 ps-mule-font-info-database) | |
1144 (setq ps-mule-font-info-database | |
89533
2b2e7811f38e
(ps-mule-begin-job): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89532
diff
changeset
|
1145 (cons '(iso-8859-1 (normal nil nil)) |
89530 | 1146 ps-mule-font-info-database))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1147 |
89530 | 1148 ;; Generate ps-mule-font-spec-tables. |
1149 (let ((font-spec-alist (make-vector 4 nil)) | |
1150 (id-max 0) | |
1151 (font-id 0) | |
1152 font-info-list) | |
1153 ;; Generate properly ordered font-info-list from | |
1154 ;; ps-mule-font-info-database. | |
1155 (let ((charset-list | |
1156 (copy-sequence (get-language-info current-language-environment | |
1157 'charset)))) | |
1158 (setq charset-list (cons 'iso-8859-1 (delq 'iso-8859-1 charset-list))) | |
1159 (dolist (charset charset-list) | |
1160 (let ((font-info (assq charset ps-mule-font-info-database))) | |
1161 (and font-info | |
1162 (setq font-info-list (cons font-info font-info-list))))) | |
1163 (dolist (font-info ps-mule-font-info-database) | |
1164 (or (memq (car font-info) charset-list) | |
1165 (setq font-info-list (cons font-info font-info-list)))) | |
1166 (setq font-info-list (nreverse font-info-list))) | |
60201
0d38d6148c13
(ps-mule-header-string-charsets): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
56986
diff
changeset
|
1167 |
89530 | 1168 ;; Store FONT-SPECs in each element of font-spec-alist. |
1169 (dolist (font-info font-info-list) | |
1170 (let ((font-spec-vec (make-vector 4 nil)) | |
1171 (charset (car font-info)) | |
1172 encoding font-spec) | |
1173 (dolist (e (cdr font-info)) | |
1174 (setq encoding (or (nth 3 e) charset) | |
1175 font-spec (vector id-max charset font-id | |
1176 (nth 1 e) (nth 2 e) encoding | |
1177 (or (nth 4 e) (charset-dimension encoding)) | |
1178 nil) | |
1179 id-max (1+ id-max)) | |
1180 (if (ps-mule-check-font font-spec) | |
1181 (aset font-spec-vec | |
1182 (cond ((eq (car e) 'normal) 0) | |
1183 ((eq (car e) 'bold) 1) | |
1184 ((eq (car e) 'italic) 2) | |
1185 (t 3)) font-spec))) | |
1186 (when (aref font-spec-vec 0) | |
1187 (or (aref font-spec-vec 3) | |
1188 (aset font-spec-vec 3 (or (aref font-spec-vec 1) | |
1189 (aref font-spec-vec 2) | |
1190 (aref font-spec-vec 0)))) | |
1191 (or (aref font-spec-vec 1) | |
1192 (aset font-spec-vec 1 (aref font-spec-vec 0))) | |
1193 (or (aref font-spec-vec 2) | |
1194 (aset font-spec-vec 2 (aref font-spec-vec 1))) | |
1195 (dotimes (i 4) | |
1196 (aset font-spec-alist i | |
1197 (nconc (aref font-spec-alist i) | |
1198 (list (cons charset (aref font-spec-vec i)))))) | |
1199 (setq font-id (1+ font-id))))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1200 |
89530 | 1201 ;; Make four FONT-SPEC-TABLEs and set them in |
1202 ;; ps-mule-font-spec-tables. Each char table has one extra slot | |
1203 ;; whose value is an element of font-spec-alist. | |
1204 (setq ps-mule-font-spec-tables (make-vector 4 nil)) | |
1205 (put 'font-spec-table 'char-table-extra-slots 1) | |
1206 (dotimes (i 4) | |
1207 (let ((table (make-char-table 'font-spec-table))) | |
1208 (aset ps-mule-font-spec-tables i table) | |
1209 (set-char-table-extra-slot table 0 (aref font-spec-alist i)) | |
1210 ;; Be sure to have glyphs for "0123456789/" in advance for | |
1211 ;; page numbering. | |
1212 (let ((str " 0123456789/")) | |
1213 (dotimes (i (length str)) | |
1214 (or (vectorp (ps-mule-get-font-spec (aref str i) table nil)) | |
1215 (error "ASCII font not available"))))))) | |
1216 | |
1217 (ps-mule-prologue-generated) | |
1218 (if (find-composition from to) | |
1219 (ps-mule-composition-prologue-generated)))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1220 |
89530 | 1221 (defun ps-mule-restruct-output-list (list tail) |
1222 (dolist (elt list) | |
1223 (if (listp elt) | |
1224 (setq tail (ps-mule-restruct-output-list elt tail)) | |
1225 (setcdr tail (cons elt (cdr tail))) | |
1226 (setq tail (cdr tail)))) | |
1227 tail) | |
37137
b960119b9c18
XEmacs compatibility. Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30561
diff
changeset
|
1228 |
89530 | 1229 (defun ps-mule-redefine-font (font-number fonttag size ps-font) |
1230 (let* ((font-type (aref ps-mule-font-number-to-type font-number)) | |
1231 (font-spec-alist (char-table-extra-slot | |
1232 (aref ps-mule-font-spec-tables font-type) 0))) | |
1233 (ps-output-prologue | |
1234 (list (if (ps-mule-font-spec-src (cdr (car font-spec-alist))) | |
1235 ;; We ignore a font specfied in ps-font-info-database. | |
1236 (format "/V%s VTOP%d def\n" fonttag font-type) | |
89534 | 1237 (format "/V%s [ VTOP%d aload pop ] def\n |
1238 V%s 0 /%s-latin1 /%s Latin1Encoding put\n" | |
1239 fonttag font-type fonttag ps-font ps-font)) | |
89530 | 1240 (format "/%s ETOP%d V%s %f ReDefFont\n" |
1241 fonttag font-type fonttag size))))) | |
1242 | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1243 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1244 ;;;###autoload |
89530 | 1245 (defun ps-mule-end-job () |
1246 "Finish printing job for multi-byte chars." | |
1247 | |
1248 ;; Prepare root and sub fonts while generating glyphs if necessary. | |
1249 (let ((output-head (list t)) | |
1250 (ps-mule-output-list (list t))) | |
1251 (dotimes (i 4) | |
1252 (map-char-table 'ps-mule-prepare-glyph | |
1253 (aref ps-mule-font-spec-tables i))) | |
1254 (ps-mule-restruct-output-list (cdr ps-mule-output-list) output-head) | |
1255 (ps-output-prologue (cdr output-head))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1256 |
89530 | 1257 ;; Prepare top Encoding and templates of FDepVector. |
1258 (dotimes (i 4) | |
1259 (let ((font-spec-alist (char-table-extra-slot | |
1260 (aref ps-mule-font-spec-tables i) 0)) | |
1261 font-list font-spec) | |
1262 (dolist (elt font-spec-alist) | |
1263 (setq font-spec (cdr elt)) | |
1264 (if (ps-mule-font-spec-extra font-spec) | |
1265 (push (cons (ps-mule-font-spec-font-id font-spec) | |
1266 (ps-mule-font-spec-id font-spec)) | |
1267 font-list))) | |
1268 (setq font-list (nreverse font-list)) | |
1269 (ps-output-prologue | |
1270 (list (format "/ETOP%d 256 array def\n" i) | |
1271 (format "0 1 255 { ETOP%d exch 0 put } for\n" i))) | |
1272 (let ((index 0)) | |
1273 (dolist (font font-list) | |
1274 (ps-output-prologue (format "ETOP%d %d %d put\n" i (car font) index)) | |
1275 (setq index (1+ index)))) | |
1276 (ps-output-prologue (format "/VTOP%d [%s] def\n" i | |
1277 (mapconcat #'(lambda (x) | |
1278 (format "F%02X" (cdr x))) | |
1279 font-list " "))))) | |
1280 | |
1281 ;; Redefine fonts f0, f1, f2, f3, h0, h1, H0. | |
1282 (ps-mule-redefine-font 4 "h0" ps-header-title-font-size-internal | |
1283 (ps-font 'ps-font-for-header 'bold)) | |
1284 (ps-mule-redefine-font 5 "h1" ps-header-font-size-internal | |
1285 (ps-font 'ps-font-for-header 'normal)) | |
1286 (ps-mule-redefine-font 6 "H0" ps-footer-font-size-internal | |
1287 (ps-font 'ps-font-for-footer 'normal)) | |
1288 (let ((font (ps-font-alist 'ps-font-for-text)) | |
1289 (i 0)) | |
1290 (while font | |
1291 (ps-mule-redefine-font i (format "f%d" i) | |
1292 ps-font-size-internal | |
1293 (ps-font 'ps-font-for-text (car (car font)))) | |
1294 (setq font (cdr font) | |
1295 i (1+ i))))) | |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1296 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1297 (provide 'ps-mule) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1298 |
52401 | 1299 ;;; arch-tag: bca017b2-66a7-4e59-8584-103e749eadbe |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1300 ;;; ps-mule.el ends here |