annotate lisp/ps-mule.el @ 89898:0167306cb580

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