Mercurial > emacs
annotate lisp/ps-mule.el @ 24382:740c8322ca39
(perror_1, fatal_error): Don't compile unless needed.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 22 Feb 1999 20:51:02 +0000 |
parents | 6909b106c5c6 |
children | 48003e436759 |
rev | line source |
---|---|
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1 ;;; ps-mule.el --- Provide multi-byte character facility to ps-print. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
2 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
3 ;; Copyright (C) 1998 Free Software Foundation, Inc. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
4 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
5 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
6 ;; Author: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
7 ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
8 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
9 ;; Keywords: print, PostScript, multibyte, mule |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
10 ;; Time-stamp: <98/12/15 14:04:50 handa> |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
11 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
12 ;; This file is part of GNU Emacs. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
13 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
14 ;; 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
|
15 ;; 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
|
16 ;; 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
|
17 ;; any later version. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
18 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
19 ;; 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
|
20 ;; 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
|
21 ;; 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
|
22 ;; GNU General Public License for more details. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
23 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
24 ;; 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
|
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
27 ;; Boston, MA 02111-1307, USA. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
28 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
29 ;;; Commentary: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
30 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
32 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
33 ;; About ps-mule |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
34 ;; ------------- |
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 ;; 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
|
37 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
38 ;; See also ps-print.el. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
39 ;; |
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 ;; Printing Multi-byte Buffer |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
42 ;; -------------------------- |
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 ;; 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
|
45 ;; handling. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
46 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
47 ;; Valid values for `ps-multibyte-buffer' are: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
48 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
49 ;; nil This is the value to use when you are printing |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
50 ;; buffer with only ASCII and Latin characters. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
51 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
52 ;; `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
|
53 ;; 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
|
54 ;; 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
|
55 ;; JISX0201-Kana) and Korean characters. At present, |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
56 ;; 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
|
57 ;; 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
|
58 ;; test it. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
59 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
60 ;; `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
|
61 ;; 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
|
62 ;; and non-latin fonts. BDF (Bitmap Distribution |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
63 ;; 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
|
64 ;; source file. BDF fonts are included in |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
65 ;; `intlfonts-1.1' which is a collection of X11 fonts |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
66 ;; 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
|
67 ;; use this value, be sure to have installed |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
68 ;; `intlfonts-1.1' and set the variable |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
69 ;; `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
|
70 ;; for documentation of this variable). |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
71 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
72 ;; `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
|
73 ;; 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
|
74 ;; 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
|
75 ;; 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
|
76 ;; the same buffer. See `ps-font-family', |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
77 ;; `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
|
78 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
79 ;; Any other value is treated as nil. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
80 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
81 ;; The default is nil. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
82 ;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
83 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
84 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
85 ;;; Code: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
86 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
87 (eval-and-compile (require 'ps-print)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
88 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
89 ;;;###autoload |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
90 (defcustom ps-multibyte-buffer nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
91 "*Specifies the multi-byte buffer handling. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
92 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
93 Valid values are: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
94 |
24306
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
95 nil This is the value to use the default settings which |
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
96 is by default for printing buffer with only ASCII |
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
97 and Latin characters. The default setting can be |
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
98 changed by setting the variable |
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
99 `ps-mule-font-info-database-default' differently. |
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
100 The initial value of this variable is |
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
101 `ps-mule-font-info-database-latin' (which see). |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
102 |
24306
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
103 `non-latin-printer' This is the value to use when you have a Japanese |
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
104 or Korean PostScript printer and want to print |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
105 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
|
106 JISX0201-Kana) and Korean characters. At present, |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
107 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
|
108 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
|
109 test it. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
110 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
111 `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
|
112 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
|
113 and non-latin fonts. BDF (Bitmap Distribution |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
114 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
|
115 source file. BDF fonts are included in |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
116 `intlfonts-1.1' which is a collection of X11 fonts |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
117 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
|
118 use this value, be sure to have installed |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
119 `intlfonts-1.1' and set the variable |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
120 `bdf-directory-list' appropriately (see ps-bdf.el for |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
121 documentation of this variable). |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
122 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
123 `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
|
124 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
|
125 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
|
126 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
|
127 the same buffer. See `ps-font-family', |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
128 `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
|
129 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
130 Any other value is treated as nil." |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
131 :type '(choice (const non-latin-printer) (const bdf-font) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
132 (const bdf-font-except-latin) (other :tag "nil" nil)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
133 :group 'ps-print-font) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
134 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
135 ;; For Emacs 20.2 and the earlier version. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
136 (eval-and-compile |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
137 (if (not (string< mule-version "4.0")) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
138 (progn |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
139 (defalias 'ps-mule-next-point '1+) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
140 (defalias 'ps-mule-chars-in-string 'length) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
141 (defalias 'ps-mule-string-char 'aref) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
142 (defsubst ps-mule-next-index (str i) (1+ i))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
143 (defun ps-mule-next-point (arg) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
144 (save-excursion (goto-char arg) (forward-char 1) (point))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
145 (defun ps-mule-chars-in-string (string) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
146 (/ (length string) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
147 (charset-bytes (char-charset (string-to-char string))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
148 (defun ps-mule-string-char (string idx) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
149 (string-to-char (substring string idx))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
150 (defun ps-mule-next-index (string i) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
151 (+ i (charset-bytes (char-charset (string-to-char string)))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
152 ) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
153 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
154 (defvar ps-mule-font-info-database |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
155 nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
156 "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
|
157 Each element has the form: |
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 (CHARSET (FONT-TYPE FONT-SRC FONT-NAME ENCODING BYTES) ...) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
160 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
161 Where |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
162 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
163 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
|
164 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
165 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
|
166 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
167 FONT-SRC is a font source: builtin, ps-bdf, vflib, or nil. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
168 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
169 If FONT-SRC is builtin, FONT-NAME is a buitin PostScript font name. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
170 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
171 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
|
172 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
|
173 is required. |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
174 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
175 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
|
176 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
|
177 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
178 If FONT-SRC is nil, a proper ASCII font in the variable |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
179 `ps-font-info-database' is used. This is useful for Latin-1 characters. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
180 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
181 ENCODING is a coding system to encode a string of characters of CHARSET into a |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
182 proper string matching an encoding of the specified font. ENCODING may be a |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
183 function that does this encoding. In this case, the function is called with |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
184 one argument, the string to encode, and it should return an encoded string. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
185 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
186 BYTES specifies how many bytes each character has in the encoded byte |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
187 sequence; it should be 1 or 2. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
188 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
189 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
|
190 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
|
191 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
|
192 font family. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
193 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
194 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
|
195 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
196 (defconst ps-mule-font-info-database-latin |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
197 '((latin-iso8859-1 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
198 (normal nil nil iso-latin-1))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
199 "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
|
200 |
24306
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
201 (defvar 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
|
202 ps-mule-font-info-database-latin |
24306
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
203 "The default setting to use if `ps-multibyte-buffer' (which see) is nil.") |
432510346b14
(ps-multibyte-buffer): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
24303
diff
changeset
|
204 |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
205 (defconst ps-mule-font-info-database-ps |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
206 '((katakana-jisx0201 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
207 (normal builtin "Ryumin-Light.Katakana" ps-mule-encode-7bit 1) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
208 (bold builtin "GothicBBB-Medium.Katakana" ps-mule-encode-7bit 1) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
209 (bold-italic builtin "GothicBBB-Medium.Katakana" ps-mule-encode-7bit 1)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
210 (latin-jisx0201 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
211 (normat builtin "Ryumin-Light.Hankaku" ps-mule-encode-7bit 1) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
212 (bold builtin "GothicBBB-Medium.Hankaku" ps-mule-encode-7bit 1)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
213 (japanese-jisx0208 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
214 (normal builtin "Ryumin-Light-H" ps-mule-encode-7bit 2) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
215 (bold builtin "GothicBBB-Medium-H" ps-mule-encode-7bit 2)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
216 (korean-ksc5601 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
217 (normal builtin "Batang-Medium-KSC-H" ps-mule-encode-7bit 2) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
218 (bold builtin " Gulim-Medium-KSC-H" ps-mule-encode-7bit 2)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
219 ) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
220 "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
|
221 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
222 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
|
223 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
224 (defconst ps-mule-font-info-database-bdf |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
225 '((ascii |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
226 (normal bdf ("lt1-24-etl.bdf" "etl24-latin1.bdf") nil 1) |
24303
958f4aa0dceb
(ps-mule-font-info-database-bdf): Fix ENCODING field
Kenichi Handa <handa@m17n.org>
parents:
24086
diff
changeset
|
227 (bold bdf ("lt1-16b-etl.bdf" "etl16b-latin1.bdf") nil 1) |
958f4aa0dceb
(ps-mule-font-info-database-bdf): Fix ENCODING field
Kenichi Handa <handa@m17n.org>
parents:
24086
diff
changeset
|
228 (italic bdf ("lt1-16i-etl.bdf" "etl16i-latin1.bdf") nil 1) |
958f4aa0dceb
(ps-mule-font-info-database-bdf): Fix ENCODING field
Kenichi Handa <handa@m17n.org>
parents:
24086
diff
changeset
|
229 (bold-italic bdf ("lt1-16bi-etl.bdf" "etl16bi-latin1.bdf") nil 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
230 (latin-iso8859-1 |
24303
958f4aa0dceb
(ps-mule-font-info-database-bdf): Fix ENCODING field
Kenichi Handa <handa@m17n.org>
parents:
24086
diff
changeset
|
231 (normal bdf ("lt1-24-etl.bdf" "etl24-latin1.bdf") iso-latin-1 1) |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
232 (bold bdf ("lt1-16b-etl.bdf" "etl16b-latin1.bdf") iso-latin-1 1) |
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
233 (italic bdf ("lt1-16i-etl.bdf" "etl16i-latin1.bdf") iso-latin-1 1) |
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
234 (bold-italic bdf ("lt1-16bi-etl.bdf" "etl16bi-latin1.bdf") iso-latin-1 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
235 (latin-iso8859-2 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
236 (normal bdf ("lt2-24-etl.bdf" "etl24-latin2.bdf") iso-latin-2 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
237 (latin-iso8859-3 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
238 (normal bdf ("lt3-24-etl.bdf" "etl24-latin3.bdf") iso-latin-3 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
239 (latin-iso8859-4 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
240 (normal bdf ("lt4-24-etl.bdf" "etl24-latin4.bdf") iso-latin-4 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
241 (thai-tis620 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
242 (normal bdf ("thai24.bdf" "thai-24.bdf") thai-tis620 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
243 (greek-iso8859-7 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
244 (normal bdf ("grk24-etl.bdf" "etl24-greek.bdf") greek-iso-8bit 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
245 ;; (arabic-iso8859-6 nil) ; not yet available |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
246 (hebrew-iso8859-8 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
247 (normal bdf ("heb24-etl.bdf" "etl24-hebrew.bdf") hebrew-iso-8bit 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
248 (katakana-jisx0201 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
249 (normal bdf "12x24rk.bdf" ps-mule-encode-8bit 1)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
250 (latin-jisx0201 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
251 (normal bdf "12x24rk.bdf" ps-mule-encode-7bit 1)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
252 (cyrillic-iso8859-5 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
253 (normal bdf ("cyr24-etl.bdf" "etl24-cyrillic.bdf") cyrillic-iso-8bit 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
254 (latin-iso8859-9 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
255 (normal bdf ("lt5-24-etl.bdf" "etl24-latin5.bdf") iso-latin-5 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
256 (japanese-jisx0208-1978 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
257 (normal bdf "jiskan24.bdf" ps-mule-encode-7bit 2)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
258 (chinese-gb2312 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
259 (normal bdf "gb24st.bdf" ps-mule-encode-7bit 2)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
260 (japanese-jisx0208 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
261 (normal bdf "jiskan24.bdf" ps-mule-encode-7bit 2)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
262 (korean-ksc5601 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
263 (normal bdf "hanglm24.bdf" ps-mule-encode-7bit 2)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
264 (japanese-jisx0212 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
265 (normal bdf ("jksp40.bdf" "jisksp40.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
266 (chinese-cns11643-1 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
267 (normal bdf ("cns1-40.bdf" "cns-1-40.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
268 (chinese-cns11643-2 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
269 (normal bdf ("cns2-40.bdf" "cns-2-40.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
270 (chinese-big5-1 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
271 (normal bdf "taipei24.bdf" chinese-big5 2)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
272 (chinese-big5-2 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
273 (normal bdf "taipei24.bdf" chinese-big5 2)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
274 (chinese-sisheng |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
275 (normal bdf ("sish24-etl.bdf" "etl24-sisheng.bdf") ps-mule-encode-8bit 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
276 (ipa |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
277 (normal bdf ("ipa24-etl.bdf" "etl24-ipa.bdf") ps-mule-encode-8bit 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
278 (vietnamese-viscii-lower |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
279 (normal bdf ("visc24-etl.bdf" "etl24-viscii.bdf") vietnamese-viscii 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
280 (vietnamese-viscii-upper |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
281 (normal bdf ("visc24-etl.bdf" "etl24-viscii.bdf") vietnamese-viscii 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
282 (arabic-digit |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
283 (normal bdf ("arab24-0-etl.bdf" "etl24-arabic0.bdf") ps-mule-encode-7bit 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
284 (arabic-1-column |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
285 (normal bdf ("arab24-1-etl.bdf" "etl24-arabic1.bdf") ps-mule-encode-7bit 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
286 ;; (ascii-right-to-left nil) ; not yet available |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
287 (lao |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
288 (normal bdf ("lao24-mule.bdf" "mule-lao-24.bdf") lao 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
289 (arabic-2-column |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
290 (normal bdf ("arab24-2-etl.bdf" "etl24-arabic2.bdf") ps-mule-encode-7bit 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
291 (indian-is13194 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
292 (normal bdf ("isci24-etl.bdf" "mule-iscii-24.bdf") ps-mule-encode-7bit 1)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
293 (indian-1-column |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
294 (normal bdf ("ind1c24-mule.bdf" "mule-indian-1col-24.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
295 (tibetan-1-column |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
296 (normal bdf ("tib1c24-mule.bdf" "mule-tibmdx-1col-24.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
297 (ethiopic |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
298 (normal bdf ("ethio24f-uni.bdf" "ethiomx24f-uni.bdf") ps-mule-encode-ethiopic 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
299 (chinese-cns11643-3 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
300 (normal bdf ("cns3-40.bdf" "cns-3-40.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
301 (chinese-cns11643-4 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
302 (normal bdf ("cns4-40.bdf" "cns-4-40.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
303 (chinese-cns11643-5 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
304 (normal bdf ("cns5-40.bdf" "cns-5-40.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
305 (chinese-cns11643-6 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
306 (normal bdf ("cns6-40.bdf" "cns-6-40.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
307 (chinese-cns11643-7 |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
308 (normal bdf ("cns7-40.bdf" "cns-7-40.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
309 (indian-2-column |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
310 (normal bdf ("ind24-mule.bdf" "mule-indian-24.bdf") ps-mule-encode-7bit 2)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
311 (tibetan |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
312 (normal bdf ("tib24-mule.bdf" "mule-tibmdx-24.bdf") ps-mule-encode-7bit 2))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
313 "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
|
314 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
|
315 source file. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
316 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
317 Current default value list for BDF fonts is included in `intlfonts-1.1' which is |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
318 a collection of X11 fonts for all characters supported by Emacs. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
319 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
320 Using this list as default value to `ps-mule-font-info-database', all characters |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
321 including ASCII and Latin-1 are printed by BDF fonts. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
322 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
323 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
|
324 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
325 (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
|
326 (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
|
327 (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
|
328 "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
|
329 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
330 Current default value list for BDF fonts is included in `intlfonts-1.1' which is |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
331 a collection of X11 fonts for all characters supported by Emacs. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
332 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
333 Using this list as default value to `ps-mule-font-info-database', all characters |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
334 except ASCII and Latin-1 characters are printed by BDF fonts. ASCII and Latin-1 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
335 characters are printed by PostScript font specified by `ps-font-family' and |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
336 `ps-header-font-family'. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
337 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
338 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
|
339 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
340 ;; Two typical encoding functions for PostScript fonts. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
341 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
342 (defun ps-mule-encode-7bit (string) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
343 (ps-mule-encode-bit string 0)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
344 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
345 (defun ps-mule-encode-8bit (string) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
346 (ps-mule-encode-bit string 128)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
347 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
348 (defun ps-mule-encode-bit (string delta) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
349 (let* ((dim (charset-dimension (char-charset (string-to-char string)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
350 (len (* (ps-mule-chars-in-string string) dim)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
351 (str (make-string len 0)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
352 (i 0) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
353 (j 0)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
354 (if (= dim 1) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
355 (while (< j len) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
356 (aset str j |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
357 (+ (nth 1 (split-char (ps-mule-string-char string i))) delta)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
358 (setq i (ps-mule-next-index string i) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
359 j (1+ j))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
360 (while (< j len) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
361 (let ((split (split-char (ps-mule-string-char string i)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
362 (aset str j (+ (nth 1 split) delta)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
363 (aset str (1+ j) (+ (nth 2 split) delta)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
364 (setq i (ps-mule-next-index string i) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
365 j (+ j 2))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
366 str)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
367 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
368 ;; Special encoding function for Ethiopic. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
369 (define-ccl-program ccl-encode-ethio-unicode |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
370 `(1 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
371 ((read r2) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
372 (loop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
373 (if (r2 == ,leading-code-private-22) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
374 ((read r0) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
375 (if (r0 == ,(charset-id 'ethiopic)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
376 ((read r1 r2) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
377 (r1 &= 127) (r2 &= 127) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
378 (call ccl-encode-ethio-font) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
379 (write r1) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
380 (write-read-repeat r2)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
381 ((write r2 r0) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
382 (repeat)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
383 (write-read-repeat r2)))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
384 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
385 (defun ps-mule-encode-ethiopic (string) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
386 (ccl-execute-on-string (symbol-value 'ccl-encode-ethio-unicode) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
387 (make-vector 9 nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
388 string)) |
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 ;; A charset which we are now processing. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
391 (defvar ps-mule-current-charset nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
392 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
393 (defun ps-mule-get-font-spec (charset font-type) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
394 "Return FONT-SPEC for printing characters CHARSET with FONT-TYPE. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
395 FONT-SPEC is a list that has the form: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
396 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
397 (FONT-SRC FONT-NAME ENCODING BYTES) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
398 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
399 FONT-SPEC is extracted from `ps-mule-font-info-database'. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
400 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
401 See the documentation of `ps-mule-font-info-database' for the meaning of each |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
402 element of the list." |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
403 (let ((slot (cdr (assq charset ps-mule-font-info-database)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
404 (and slot |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
405 (cdr (or (assq font-type slot) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
406 (and (eq font-type 'bold-italic) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
407 (or (assq 'bold slot) (assq 'italic slot))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
408 (assq 'normal slot)))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
409 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
410 ;; Functions to access each element of FONT-SPEC. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
411 (defsubst ps-mule-font-spec-src (font-spec) (car font-spec)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
412 (defsubst ps-mule-font-spec-name (font-spec) (nth 1 font-spec)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
413 (defsubst ps-mule-font-spec-encoding (font-spec) (nth 2 font-spec)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
414 (defsubst ps-mule-font-spec-bytes (font-spec) (nth 3 font-spec)) |
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 (defsubst ps-mule-printable-p (charset) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
417 "Non-nil if characters in CHARSET is printable." |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
418 (ps-mule-get-font-spec charset 'normal)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
419 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
420 (defconst ps-mule-external-libraries |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
421 '((builtin nil nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
422 nil nil nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
423 (bdf ps-bdf nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
424 bdf-generate-prologue bdf-generate-font bdf-generate-glyphs) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
425 (pcf nil nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
426 pcf-generate-prologue pcf-generate-font pcf-generate-glyphs) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
427 (vflib nil nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
428 vflib-generate-prologue vflib-generate-font vflib-generate-glyphs)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
429 "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
|
430 Each element has the form: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
431 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
432 (FONT-SRC FEATURE INITIALIZED-P PROLOGUE-FUNC FONT-FUNC GLYPHS-FUNC) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
433 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
434 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
|
435 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
436 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
|
437 `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
|
438 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
|
439 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
440 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
|
441 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
442 PROLOGUE-FUNC is a function to generate PostScript code which define several |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
443 PostScript procedures that will be called by FONT-FUNC and GLYPHS-FUNC. It is |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
444 called with no argument, and should return a list of strings. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
445 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
446 FONT-FUNC is a function to generate PostScript code which define a new font. It |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
447 is called with one argument FONT-SPEC, and should return a list of strings. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
448 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
449 GLYPHS-FUNC is a function to generate PostScript code which define glyphs of |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
450 characters. It is called with three arguments FONT-SPEC, CODE-LIST, and BYTES, |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
451 and should return a list of strings.") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
452 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
453 (defun ps-mule-init-external-library (font-spec) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
454 "Initialize external library specified by FONT-SPEC for PostScript printing. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
455 See the documentation of `ps-mule-get-font-spec' for FONT-SPEC's meaning." |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
456 (let* ((font-src (ps-mule-font-spec-src font-spec)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
457 (slot (assq font-src ps-mule-external-libraries))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
458 (or (not font-src) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
459 (nth 2 slot) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
460 (let ((func (nth 3 slot))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
461 (if func |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
462 (progn |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
463 (or (featurep (nth 1 slot)) (require (nth 1 slot))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
464 (ps-output-prologue (funcall func)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
465 (setcar (nthcdr 2 slot) t))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
466 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
467 ;; Cached glyph information of fonts, alist of: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
468 ;; (FONT-NAME ((FONT-TYPE-NUMBER . SCALED-FONT-NAME) ...) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
469 ;; cache CODE0 CODE1 ...) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
470 (defvar ps-mule-font-cache nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
471 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
472 (defun ps-mule-generate-font (font-spec charset) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
473 "Generate PostScript codes to define a new font in FONT-SPEC for CHARSET." |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
474 (let* ((font-name (ps-mule-font-spec-name font-spec)) |
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
475 (font-name (if (consp font-name) (car font-name) font-name)) |
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
476 (font-cache (assoc font-name ps-mule-font-cache)) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
477 (font-src (ps-mule-font-spec-src font-spec)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
478 (func (nth 4 (assq font-src ps-mule-external-libraries))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
479 (scaled-font-name |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
480 (if (eq charset 'ascii) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
481 (format "f%d" ps-current-font) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
482 (format "f%02x-%d" |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
483 (charset-id charset) ps-current-font)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
484 (and func (not font-cache) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
485 (ps-output-prologue (funcall func charset font-spec))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
486 (ps-output-prologue |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
487 (list (format "/%s %f /%s Def%sFontMule\n" |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
488 scaled-font-name ps-font-size font-name |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
489 (if (eq ps-mule-current-charset 'ascii) "Ascii" "")))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
490 (if font-cache |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
491 (setcar (cdr font-cache) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
492 (cons (cons ps-current-font scaled-font-name) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
493 (nth 1 font-cache))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
494 (setq font-cache (list font-name |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
495 (list (cons ps-current-font scaled-font-name)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
496 'cache) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
497 ps-mule-font-cache (cons font-cache ps-mule-font-cache))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
498 font-cache)) |
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 (defun ps-mule-generate-glyphs (font-spec code-list) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
501 "Generate PostScript codes which generate glyphs for CODE-LIST of FONT-SPEC." |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
502 (let* ((font-src (ps-mule-font-spec-src font-spec)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
503 (func (nth 5 (assq font-src ps-mule-external-libraries)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
504 (and func |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
505 (ps-output-prologue |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
506 (funcall func font-spec code-list |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
507 (ps-mule-font-spec-bytes font-spec)))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
508 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
509 (defun ps-mule-prepare-font (font-spec string charset &optional no-setfont) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
510 "Generate PostScript codes to print STRING of CHARSET by font FONT-SPEC. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
511 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
512 The generated code is inserted on prologue part except the code that sets the |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
513 current font (using PostScript procedure `FM'). |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
514 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
515 If optional arg NO-SETFONT is non-nil, don't generate the code for setting the |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
516 current font." |
24086
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
517 (let* ((font-name (ps-mule-font-spec-name font-spec)) |
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
518 (font-name (if (consp font-name) (car font-name) font-name)) |
bedce7fcf0f4
(ps-mule-font-info-database-bdf): Add alternative
Eli Zaretskii <eliz@gnu.org>
parents:
23937
diff
changeset
|
519 (font-cache (assoc font-name ps-mule-font-cache))) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
520 (or (and font-cache (assq ps-current-font (nth 1 font-cache))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
521 (setq font-cache (ps-mule-generate-font font-spec charset))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
522 (or no-setfont |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
523 (let ((new-font (cdr (assq ps-current-font (nth 1 font-cache))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
524 (or (equal new-font ps-last-font) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
525 (progn |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
526 (ps-output (format "/%s FM\n" new-font)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
527 (setq ps-last-font new-font))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
528 (if (nth 5 (assq (ps-mule-font-spec-src font-spec) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
529 ps-mule-external-libraries)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
530 ;; We have to generate PostScript codes which define glyphs. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
531 (let* ((cached-codes (nthcdr 2 font-cache)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
532 (bytes (ps-mule-font-spec-bytes font-spec)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
533 (len (length string)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
534 (i 0) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
535 newcodes code) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
536 (while (< i len) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
537 (setq code (if (= bytes 1) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
538 (aref string i) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
539 (+ (* (aref string i) 256) (aref string (1+ i))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
540 (or (memq code cached-codes) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
541 (progn |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
542 (setq newcodes (cons code newcodes)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
543 (setcdr cached-codes (cons code (cdr cached-codes))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
544 (setq i (+ i bytes))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
545 (and newcodes |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
546 (ps-mule-generate-glyphs font-spec newcodes)))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
547 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
548 ;;;###autoload |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
549 (defun ps-mule-prepare-ascii-font (string) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
550 "Setup special ASCII font for STRING. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
551 STRING should contain only ASCII characters." |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
552 (let ((font-spec |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
553 (ps-mule-get-font-spec |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
554 'ascii |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
555 (car (nth ps-current-font (ps-font-alist 'ps-font-for-text)))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
556 (and font-spec |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
557 (ps-mule-prepare-font font-spec string 'ascii)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
558 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
559 ;;;###autoload |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
560 (defun ps-mule-set-ascii-font () |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
561 (unless (eq ps-mule-current-charset 'ascii) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
562 (ps-set-font ps-current-font) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
563 (setq ps-mule-current-charset 'ascii))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
564 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
565 ;; List of charsets of multi-byte characters in a text being printed. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
566 ;; If the text doesn't contain any multi-byte characters (i.e. only ASCII), |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
567 ;; the value is nil. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
568 (defvar ps-mule-charset-list nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
569 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
570 ;; 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
|
571 (defconst ps-mule-prologue |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
572 "%%%% Start of Mule Section |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
573 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
574 %% Working dictionary for general use. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
575 /MuleDict 10 dict def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
576 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
577 %% Define already scaled font for non-ASCII character sets. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
578 /DefFontMule { % fontname size basefont |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
579 findfont exch scalefont definefont pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
580 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
581 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
582 %% Define already scaled font for ASCII character sets. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
583 /DefAsciiFontMule { % fontname size basefont |- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
584 MuleDict begin |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
585 findfont dup /Encoding get /ISOLatin1Encoding exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
586 exch scalefont reencodeFontISO |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
587 end |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
588 } def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
589 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
590 %% Set the specified non-ASCII font to use. It doesn't install |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
591 %% Ascent, etc. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
592 /FM { % fontname |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
593 findfont setfont |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
594 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
595 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
596 %% Show vacant box for characters which don't have appropriate font. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
597 /SB { % count column |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
598 SpaceWidth mul /w exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
599 1 exch 1 exch { %for |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
600 pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
601 gsave |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
602 0 setlinewidth |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
603 0 Descent rmoveto w 0 rlineto |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
604 0 LineHeight rlineto w neg 0 rlineto closepath stroke |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
605 grestore |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
606 w 0 rmoveto |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
607 } for |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
608 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
609 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
610 %% Flag to tell if we are now handling a composite character. This is |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
611 %% defined here because both composite character handler and bitmap font |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
612 %% handler require it. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
613 /Cmpchar false def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
614 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
615 %%%% End of Mule Section |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
616 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
617 " |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
618 "PostScript code for printing multi-byte characters.") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
619 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
620 (defvar ps-mule-prologue-generated nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
621 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
622 (defun ps-mule-prologue-generated () |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
623 (unless ps-mule-prologue-generated |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
624 (ps-output-prologue ps-mule-prologue) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
625 (setq ps-mule-prologue-generated t))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
626 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
627 (defun ps-mule-find-wrappoint (from to char-width) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
628 "Find the longest sequence which is printable in the current line. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
629 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
630 The search starts at FROM and goes until TO. It is assumed that all characters |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
631 between FROM and TO belong to a charset in `ps-mule-current-charset'. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
632 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
633 CHAR-WIDTH is the average width of ASCII characters in the current font. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
634 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
635 Returns the value: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
636 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
637 (ENDPOS . RUN-WIDTH) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
638 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
639 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
|
640 the sequence." |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
641 (if (eq ps-mule-current-charset 'composition) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
642 ;; We must draw one char by one. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
643 (let ((run-width (* (char-width (char-after from)) char-width))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
644 (if (> run-width ps-width-remaining) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
645 (cons from ps-width-remaining) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
646 (cons (ps-mule-next-point from) run-width))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
647 ;; We assume that all characters in this range have the same width. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
648 (setq char-width (* char-width (charset-width ps-mule-current-charset))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
649 (let ((run-width (* (chars-in-region from to) char-width))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
650 (if (> run-width ps-width-remaining) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
651 (cons (min to |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
652 (save-excursion |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
653 (goto-char from) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
654 (forward-point |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
655 (truncate (/ ps-width-remaining char-width))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
656 ps-width-remaining) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
657 (cons to run-width))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
658 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
659 ;;;###autoload |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
660 (defun ps-mule-plot-string (from to &optional bg-color) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
661 "Generate PostScript code for ploting characters in the region FROM and TO. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
662 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
663 It is assumed that all characters in this region belong to the same charset. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
664 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
665 Optional argument BG-COLOR specifies background color. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
666 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
667 Returns the value: |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
668 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
669 (ENDPOS . RUN-WIDTH) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
670 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
671 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
|
672 the sequence." |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
673 (setq ps-mule-current-charset (charset-after from)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
674 (let* ((wrappoint (ps-mule-find-wrappoint |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
675 from to (ps-avg-char-width 'ps-font-for-text))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
676 (to (car wrappoint)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
677 (font-type (car (nth ps-current-font |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
678 (ps-font-alist 'ps-font-for-text)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
679 (font-spec (ps-mule-get-font-spec ps-mule-current-charset font-type)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
680 (string (buffer-substring-no-properties from to))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
681 (cond |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
682 ((= from to) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
683 ;; We can't print any more characters in the current line. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
684 nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
685 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
686 (font-spec |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
687 ;; We surely have a font for printing this character set. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
688 (ps-output-string (ps-mule-string-encoding font-spec string)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
689 (ps-output " S\n")) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
690 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
691 ((eq ps-mule-current-charset 'latin-iso8859-1) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
692 ;; Latin-1 can be printed by a normal ASCII font. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
693 (ps-output-string (ps-mule-string-ascii string)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
694 (ps-output " S\n")) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
695 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
696 ((eq ps-mule-current-charset 'composition) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
697 (let* ((ch (char-after from)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
698 (width (char-width ch)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
699 (ch-list (decompose-composite-char ch 'list t))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
700 (if (consp (nth 1 ch-list)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
701 (ps-mule-plot-rule-cmpchar ch-list width font-type) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
702 (ps-mule-plot-cmpchar ch-list width t font-type)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
703 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
704 (t |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
705 ;; No way to print this charset. Just show a vacant box of an |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
706 ;; appropriate width. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
707 (ps-output (format "%d %d SB\n" |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
708 (length string) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
709 (if (eq ps-mule-current-charset 'composition) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
710 (char-width (char-after from)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
711 (charset-width ps-mule-current-charset)))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
712 wrappoint)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
713 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
714 ;; Composite font support |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
715 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
716 (defvar ps-mule-cmpchar-prologue-generated nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
717 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
718 (defconst ps-mule-cmpchar-prologue |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
719 "%%%% Composite character handler |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
720 /CmpcharWidth 0 def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
721 /CmpcharRelativeCompose 0 def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
722 /CmpcharRelativeSkip 0.4 def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
723 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
724 %% Get a bounding box (relative to currentpoint) of STR. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
725 /GetPathBox { % str |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
726 gsave |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
727 currentfont /FontType get 3 eq { %ifelse |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
728 stringwidth pop pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
729 } { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
730 currentpoint /y exch def pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
731 false charpath flattenpath pathbbox |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
732 y sub /URY exch def pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
733 y sub /LLY exch def pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
734 } ifelse |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
735 grestore |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
736 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
737 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
738 %% Beginning of composite char. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
739 /BC { % str xoff width |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
740 /Cmpchar true def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
741 /CmpcharWidth exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
742 currentfont /RelativeCompose known { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
743 /CmpcharRelativeCompose currentfont /RelativeCompose get def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
744 } { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
745 /CmpcharRelativeCompose false def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
746 } ifelse |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
747 /bgsave bg def /bgcolorsave bgcolor def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
748 /Effectsave Effect def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
749 gsave % Reflect effect only at first |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
750 /Effect Effect 1 2 add 4 add 16 add and def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
751 /f0 findfont setfont ( ) 0 CmpcharWidth getinterval S |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
752 grestore |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
753 /Effect Effectsave 8 32 add and def % enable only shadow and outline |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
754 false BG |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
755 gsave SpaceWidth mul 0 rmoveto dup GetPathBox S grestore |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
756 /y currentpoint exch pop def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
757 /HIGH URY y add def /LOW LLY y add def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
758 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
759 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
760 %% End of composite char. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
761 /EC { % -- |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
762 /bg bgsave def /bgcolor bgcolorsave def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
763 /Effect Effectsave def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
764 /Cmpchar false def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
765 CmpcharWidth SpaceWidth mul 0 rmoveto |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
766 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
767 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
768 %% Rule base composition |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
769 /RBC { % str xoff gref nref |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
770 /nref exch def /gref exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
771 gsave |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
772 SpaceWidth mul 0 rmoveto |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
773 dup |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
774 GetPathBox |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
775 [ HIGH currentpoint exch pop LOW HIGH LOW add 2 div ] gref get |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
776 [ URY LLY sub LLY neg 0 URY LLY sub 2 div ] nref get |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
777 sub /btm exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
778 /top btm URY LLY sub add def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
779 top HIGH gt { /HIGH top def } if |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
780 btm LOW lt { /LOW btm def } if |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
781 currentpoint pop btm LLY sub moveto |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
782 S |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
783 grestore |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
784 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
785 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
786 %% Relative composition |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
787 /RLC { % str |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
788 gsave |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
789 dup GetPathBox |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
790 CmpcharRelativeCompose type /integertype eq { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
791 LLY CmpcharRelativeCompose gt { % compose on top |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
792 currentpoint pop HIGH LLY sub CmpcharRelativeSkip add moveto |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
793 /HIGH HIGH URY LLY sub add CmpcharRelativeSkip add def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
794 } { URY 0 le { % compose under bottom |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
795 currentpoint pop LOW LLY add CmpcharRelativeSkip sub moveto |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
796 /LOW LOW URY LLY sub sub CmpcharRelativeSkip sub def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
797 } if } ifelse } if |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
798 S |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
799 grestore |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
800 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
801 %%%% End of composite character handler |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
802 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
803 " |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
804 "PostScript code for printing composite characters.") |
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 (defun ps-mule-plot-rule-cmpchar (ch-rule-list total-width font-type) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
807 (let ((leftmost 0.0) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
808 (rightmost (float (char-width (car ch-rule-list)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
809 (the-list (cons '(3 . 3) ch-rule-list)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
810 cmpchar-elements) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
811 (while the-list |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
812 (let* ((this (car the-list)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
813 (gref (car this)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
814 (nref (cdr this)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
815 ;; X-axis info (0:left, 1:center, 2:right) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
816 (gref-x (% gref 3)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
817 (nref-x (% nref 3)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
818 ;; Y-axis info (0:top, 1:base, 2:bottom, 3:center) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
819 (gref-y (if (= gref 4) 3 (/ gref 3))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
820 (nref-y (if (= nref 4) 3 (/ nref 3))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
821 (char (car (cdr the-list))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
822 (width (float (char-width char))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
823 left) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
824 (setq left (+ leftmost |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
825 (* (- rightmost leftmost) gref-x 0.5) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
826 (- (* nref-x width 0.5))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
827 cmpchar-elements (cons (list char left gref-y nref-y) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
828 cmpchar-elements) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
829 leftmost (min left leftmost) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
830 rightmost (max (+ left width) rightmost) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
831 the-list (nthcdr 2 the-list)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
832 (if (< leftmost 0) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
833 (let ((the-list cmpchar-elements) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
834 elt) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
835 (while the-list |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
836 (setq elt (car the-list) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
837 the-list (cdr the-list)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
838 (setcar (cdr elt) (- (nth 1 elt) leftmost))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
839 (ps-mule-plot-cmpchar (nreverse cmpchar-elements) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
840 total-width nil font-type))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
841 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
842 (defun ps-mule-plot-cmpchar (elements total-width relativep font-type) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
843 (let* ((elt (car elements)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
844 (ch (if relativep elt (car elt)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
845 (ps-output-string (ps-mule-prepare-cmpchar-font ch font-type)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
846 (ps-output (format " %d %d BC " |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
847 (if relativep 0 (nth 1 elt)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
848 total-width)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
849 (while (setq elements (cdr elements)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
850 (setq elt (car elements) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
851 ch (if relativep elt (car elt))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
852 (ps-output-string (ps-mule-prepare-cmpchar-font ch font-type)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
853 (ps-output (if relativep |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
854 " RLC " |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
855 (format " %d %d %d RBC " |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
856 (nth 1 elt) (nth 2 elt) (nth 3 elt)))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
857 (ps-output "EC\n")) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
858 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
859 (defun ps-mule-prepare-cmpchar-font (char font-type) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
860 (let* ((ps-mule-current-charset (char-charset char)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
861 (font-spec (ps-mule-get-font-spec ps-mule-current-charset font-type))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
862 (cond (font-spec |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
863 (ps-mule-string-encoding font-spec (char-to-string char))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
864 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
865 ((eq ps-mule-current-charset 'latin-iso8859-1) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
866 (ps-mule-string-ascii (char-to-string char))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
867 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
868 (t |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
869 ;; No font for CHAR. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
870 (ps-set-font ps-current-font) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
871 " ")))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
872 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
873 (defun ps-mule-string-ascii (str) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
874 (ps-set-font ps-current-font) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
875 (string-as-unibyte (encode-coding-string str 'iso-latin-1))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
876 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
877 (defun ps-mule-string-encoding (font-spec str) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
878 (let ((encoding (ps-mule-font-spec-encoding font-spec))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
879 (setq str |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
880 (string-as-unibyte |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
881 (cond ((coding-system-p encoding) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
882 (encode-coding-string str encoding)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
883 ((functionp encoding) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
884 (funcall encoding str)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
885 (encoding |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
886 (error "Invalid coding system or function: %s" encoding)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
887 (t |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
888 str)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
889 (if (ps-mule-font-spec-src font-spec) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
890 (ps-mule-prepare-font font-spec str ps-mule-current-charset) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
891 (ps-set-font ps-current-font)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
892 str)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
893 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
894 ;; Bitmap font support |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
895 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
896 (defvar ps-mule-bitmap-prologue-generated nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
897 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
898 (defconst ps-mule-bitmap-prologue |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
899 "%%%% Bitmap font handler |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
900 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
901 /str7 7 string def % working area |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
902 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
903 %% We grow the dictionary one bunch (1024 entries) by one. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
904 /BitmapDictArray 256 array def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
905 /BitmapDictLength 1024 def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
906 /BitmapDictIndex -1 def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
907 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
908 /NewBitmapDict { % -- |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
909 /BitmapDictIndex BitmapDictIndex 1 add def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
910 BitmapDictArray BitmapDictIndex BitmapDictLength dict put |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
911 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
912 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
913 %% Make at least one dictionary. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
914 NewBitmapDict |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
915 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
916 /AddBitmap { % gloval-charname bitmap-data |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
917 BitmapDictArray BitmapDictIndex get |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
918 dup length BitmapDictLength ge { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
919 pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
920 NewBitmapDict |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
921 BitmapDictArray BitmapDictIndex get |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
922 } if |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
923 3 1 roll put |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
924 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
925 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
926 /GetBitmap { % gloval-charname |- bitmap-data |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
927 0 1 BitmapDictIndex { BitmapDictArray exch get begin } for |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
928 load |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
929 0 1 BitmapDictIndex { pop end } for |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
930 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
931 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
932 %% Return a global character name which can be used as a key in the |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
933 %% bitmap dictionary. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
934 /GlobalCharName { % fontidx code1 code2 |- gloval-charname |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
935 exch 256 mul add exch 65536 mul add 16777216 add 16 str7 cvrs 0 66 put |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
936 str7 cvn |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
937 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
938 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
939 %% Character code holder for a 2-byte character. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
940 /FirstCode -1 def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
941 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
942 %% Glyph rendering procedure |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
943 /BuildGlyphCommon { % fontdict charname |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
944 1 index /FontDimension get 1 eq { /FirstCode 0 store } if |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
945 NameIndexDict exch get % STACK: fontdict charcode |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
946 FirstCode 0 lt { %ifelse |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
947 %% This is the first byte of a 2-byte character. Just |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
948 %% remember it for the moment. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
949 /FirstCode exch store |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
950 pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
951 0 0 setcharwidth |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
952 } { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
953 1 index /FontSize get /size exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
954 1 index /FontSpaceWidthRatio get /ratio exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
955 1 index /FontIndex get exch FirstCode exch |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
956 GlobalCharName GetBitmap /bmp exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
957 %% bmp == [ DWIDTH BBX-WIDTH BBX-HEIGHT BBX-XOFF BBX-YOFF BITMAP ] |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
958 Cmpchar { %ifelse |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
959 /FontMatrix get [ exch { size div } forall ] /mtrx exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
960 bmp 3 get bmp 4 get mtrx transform |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
961 /LLY exch def pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
962 bmp 1 get bmp 3 get add bmp 2 get bmp 4 get add mtrx transform |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
963 /URY exch def pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
964 } { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
965 pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
966 } ifelse |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
967 /FirstCode -1 store |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
968 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
969 bmp 0 get SpaceWidthRatio ratio div mul size div 0 % wx wy |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
970 setcharwidth % We can't use setcachedevice here. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
971 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
972 bmp 1 get 0 gt bmp 2 get 0 gt and { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
973 bmp 1 get bmp 2 get % width height |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
974 true % polarity |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
975 [ size 0 0 size neg bmp 3 get neg bmp 2 get bmp 4 get add ] % matrix |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
976 bmp 5 1 getinterval cvx % datasrc |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
977 imagemask |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
978 } if |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
979 } ifelse |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
980 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
981 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
982 /BuildCharCommon { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
983 1 index /Encoding get exch get |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
984 1 index /BuildGlyph get exec |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
985 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
986 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
987 %% Bitmap font creater |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
988 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
989 %% Common Encoding shared by all bitmap fonts. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
990 /EncodingCommon 256 array def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
991 %% Mapping table from character name to character code. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
992 /NameIndexDict 256 dict def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
993 0 1 255 { %for |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
994 /idx exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
995 /idxname idx 256 add 16 (XXX) cvrs dup 0 67 put cvn def % `C' == 67 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
996 EncodingCommon idx idxname put |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
997 NameIndexDict idxname idx put |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
998 } for |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
999 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1000 /GlobalFontIndex 0 def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1001 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1002 %% fontname dim col fontsize relative-compose baseline-offset fbbx |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1003 /BitmapFont { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1004 15 dict begin |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1005 /FontBBox exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1006 /BaselineOffset exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1007 /RelativeCompose exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1008 /FontSize exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1009 /FontBBox [ FontBBox { FontSize div } forall ] def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1010 FontBBox 2 get FontBBox 0 get sub exch div |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1011 /FontSpaceWidthRatio exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1012 /FontDimension exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1013 /FontIndex GlobalFontIndex def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1014 /FontType 3 def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1015 /FontMatrix matrix def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1016 /Encoding EncodingCommon def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1017 /BuildGlyph { BuildGlyphCommon } def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1018 /BuildChar { BuildCharCommon } def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1019 currentdict end |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1020 definefont pop |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1021 /GlobalFontIndex GlobalFontIndex 1 add def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1022 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1023 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1024 %% Define a new bitmap font. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1025 %% fontname dim col fontsize relative-compose baseline-offset fbbx |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1026 /NF { |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1027 /fbbx exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1028 %% Convert BDF's FontBoundingBox to PostScript's FontBBox |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1029 [ fbbx 2 get fbbx 3 get |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1030 fbbx 2 get fbbx 0 get add fbbx 3 get fbbx 1 get add ] |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1031 BitmapFont |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1032 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1033 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1034 %% Define a glyph for the specified font and character. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1035 /NG { % fontname charcode bitmap-data |- -- |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1036 /bmp exch def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1037 exch findfont dup /BaselineOffset get bmp 4 get add bmp exch 4 exch put |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1038 /FontIndex get exch |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1039 dup 256 idiv exch 256 mod GlobalCharName |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1040 bmp AddBitmap |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1041 } bind def |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1042 %%%% End of bitmap font handler |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1043 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1044 ") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1045 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1046 ;; External library support. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1047 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1048 ;; 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
|
1049 ;; 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
|
1050 ;; appropriate PostScript code. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1051 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1052 (defun ps-mule-generate-bitmap-prologue () |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1053 (unless ps-mule-bitmap-prologue-generated |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1054 (setq ps-mule-bitmap-prologue-generated t) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1055 (list ps-mule-bitmap-prologue))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1056 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1057 (defun ps-mule-generate-bitmap-font (&rest args) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1058 (list (apply 'format "/%s %d %d %f %S %d %S NF\n" args))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1059 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1060 (defun ps-mule-generate-bitmap-glyph (font-name code dwidth bbx bitmap) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1061 (format "/%s %d [ %d %d %d %d %d <%s> ] NG\n" |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1062 font-name code |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1063 dwidth (aref bbx 0) (aref bbx 1) (aref bbx 2) (aref bbx 3) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1064 bitmap)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1065 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1066 ;; Mule specific initializers. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1067 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1068 ;;;###autoload |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1069 (defun ps-mule-initialize () |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1070 "Initialize global data for printing multi-byte characters." |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1071 (setq ps-mule-font-cache nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1072 ps-mule-prologue-generated nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1073 ps-mule-cmpchar-prologue-generated nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1074 ps-mule-bitmap-prologue-generated nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1075 (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
|
1076 ps-mule-external-libraries)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1077 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1078 ;;;###autoload |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1079 (defun ps-mule-begin-job (from to) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1080 "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
|
1081 This checks if all multi-byte characters in the region are printable or not." |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1082 (setq ps-mule-charset-list nil |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1083 ps-mule-font-info-database |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1084 (cond ((eq ps-multibyte-buffer 'non-latin-printer) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1085 ps-mule-font-info-database-ps) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1086 ((eq ps-multibyte-buffer 'bdf-font) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1087 ps-mule-font-info-database-bdf) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1088 ((eq ps-multibyte-buffer 'bdf-font-except-latin) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1089 ps-mule-font-info-database-ps-bdf) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1090 (t |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1091 ps-mule-font-info-database-latin))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1092 (and (boundp 'enable-multibyte-characters) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1093 enable-multibyte-characters |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1094 ;; Initialize `ps-mule-charset-list'. If some characters aren't |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1095 ;; printable, warn it. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1096 (let ((charsets (find-charset-region from to))) |
23937
144220e7f841
(ps-mule-begin-job): Programming uniformization.
Kenichi Handa <handa@m17n.org>
parents:
23894
diff
changeset
|
1097 (setq charsets (delq 'ascii (delq 'unknown (delq nil charsets))) |
144220e7f841
(ps-mule-begin-job): Programming uniformization.
Kenichi Handa <handa@m17n.org>
parents:
23894
diff
changeset
|
1098 ps-mule-charset-list charsets) |
23894
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1099 (save-excursion |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1100 (goto-char from) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1101 (and (search-forward "\200" to t) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1102 (setq ps-mule-charset-list |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1103 (cons 'composition ps-mule-charset-list)))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1104 (while charsets |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1105 (setq charsets |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1106 (cond |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1107 ((or (eq (car charsets) 'composition) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1108 (ps-mule-printable-p (car charsets))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1109 (cdr charsets)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1110 ((y-or-n-p |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1111 "Font for some characters not found, continue anyway? ") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1112 nil) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1113 (t |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1114 (error "Printing cancelled"))))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1115 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1116 (setq ps-mule-current-charset 'ascii) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1117 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1118 (if ps-mule-charset-list |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1119 (let ((the-list ps-mule-charset-list) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1120 font-spec elt) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1121 (ps-mule-prologue-generated) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1122 ;; If external functions are necessary, generate prologues for them. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1123 (while the-list |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1124 (setq elt (car the-list) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1125 the-list (cdr the-list)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1126 (cond ((and (eq elt 'composition) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1127 (not ps-mule-cmpchar-prologue-generated)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1128 (ps-output-prologue ps-mule-cmpchar-prologue) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1129 (setq ps-mule-cmpchar-prologue-generated t)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1130 ((setq font-spec (ps-mule-get-font-spec elt 'normal)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1131 (ps-mule-init-external-library font-spec)))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1132 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1133 ;; If ASCII font is also specified in ps-mule-font-info-database, |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1134 ;; use it istead of what specified in ps-font-info-database. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1135 (let ((font-spec (ps-mule-get-font-spec 'ascii 'normal))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1136 (if font-spec |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1137 (progn |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1138 (ps-mule-prologue-generated) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1139 (ps-mule-init-external-library font-spec) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1140 (let ((font (ps-font-alist 'ps-font-for-text)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1141 (ps-current-font 0)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1142 (while font |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1143 ;; Be sure to download a glyph for SPACE in advance. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1144 (ps-mule-prepare-font (ps-mule-get-font-spec 'ascii (car font)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1145 " " 'ascii 'no-setfont) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1146 (setq font (cdr font) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1147 ps-current-font (1+ ps-current-font))))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1148 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1149 (if ps-mule-charset-list |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1150 ;; We must change this regexp for multi-byte buffer. |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1151 (setq ps-control-or-escape-regexp |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1152 (cond ((eq ps-print-control-characters '8-bit) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1153 "[^\040-\176]") |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1154 ((eq ps-print-control-characters 'control-8-bit) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1155 (string-as-multibyte "[^\040-\176\240-\377]")) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1156 ((eq ps-print-control-characters 'control) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1157 (string-as-multibyte "[^\040-\176\200-\377]")) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1158 (t (string-as-multibyte "[^\000-\011\013\015-\377")))))) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1159 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1160 ;;;###autoload |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1161 (defun ps-mule-begin-page () |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1162 (setq ps-mule-current-charset 'ascii)) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1163 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1164 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1165 (provide 'ps-mule) |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1166 |
f96c37cbdeef
New file. Mule related code extracted from
Kenichi Handa <handa@m17n.org>
parents:
23893
diff
changeset
|
1167 ;;; ps-mule.el ends here |