1 ;;; ps-mule.el --- provide multi-byte character facility to ps-print
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
4 ;; Free Software Foundation, Inc.
6 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br>
7 ;; Kenichi Handa <handa@etl.go.jp> (multi-byte characters)
8 ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters)
9 ;; Vinicius Jose Latorre <vinicius@cpqd.com.br>
10 ;; Keywords: wp, print, PostScript, multibyte, mule
11 ;; Time-stamp: <2003/05/14 22:19:41 vinicius>
13 ;; This file is part of GNU Emacs.
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
20 ;; GNU Emacs is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;; GNU General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 ;; Boston, MA 02111-1307, USA.
32 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37 ;; This package is used for ps-print to print multi-byte buffer.
39 ;; See also ps-print.el.
42 ;; Printing Multi-byte Buffer
43 ;; --------------------------
45 ;; The variable `ps-multibyte-buffer' specifies the ps-print multi-byte buffer
48 ;; Valid values for `ps-multibyte-buffer' are:
50 ;; nil This is the value to use the default settings which
51 ;; is by default for printing buffer with only ASCII
52 ;; and Latin characters. The default setting can be
53 ;; changed by setting the variable
54 ;; `ps-mule-font-info-database-default' differently.
55 ;; The initial value of this variable is
56 ;; `ps-mule-font-info-database-latin' (see
59 ;; `non-latin-printer' This is the value to use when you have a japanese
60 ;; or korean PostScript printer and want to print
61 ;; buffer with ASCII, Latin-1, Japanese (JISX0208 and
62 ;; JISX0201-Kana) and Korean characters. At present,
63 ;; it was not tested the Korean characters printing.
64 ;; If you have a korean PostScript printer, please,
67 ;; `bdf-font' This is the value to use when you want to print
68 ;; buffer with BDF fonts. BDF fonts include both latin
69 ;; and non-latin fonts. BDF (Bitmap Distribution
70 ;; Format) is a format used for distributing X's font
71 ;; source file. BDF fonts are included in
72 ;; `intlfonts-1.2' which is a collection of X11 fonts
73 ;; for all characters supported by Emacs. In order to
74 ;; use this value, be sure to have installed
75 ;; `intlfonts-1.2' and set the variable
76 ;; `bdf-directory-list' appropriately (see ps-bdf.el
77 ;; for documentation of this variable).
79 ;; `bdf-font-except-latin' This is like `bdf-font' except that it is used
80 ;; PostScript default fonts to print ASCII and Latin-1
81 ;; characters. This is convenient when you want or
82 ;; need to use both latin and non-latin characters on
83 ;; the same buffer. See `ps-font-family',
84 ;; `ps-header-font-family' and `ps-font-info-database'.
86 ;; Any other value is treated as nil.
88 ;; The default is nil.
90 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
97 ;; to avoid XEmacs compilation gripes
98 (defvar leading-code-private-22
157)
99 (or (fboundp 'charset-bytes
)
100 (defun charset-bytes (charset) 1)) ; ascii
101 (or (fboundp 'charset-dimension
)
102 (defun charset-dimension (charset) 1)) ; ascii
103 (or (fboundp 'charset-id
)
104 (defun charset-id (charset) 0)) ; ascii
105 (or (fboundp 'charset-width
)
106 (defun charset-width (charset) 1)) ; ascii
107 (or (fboundp 'find-charset-region
)
108 (defun find-charset-region (beg end
&optional table
)
110 (or (fboundp 'char-width
)
111 (defun char-width (char) 1)) ; ascii
112 (or (fboundp 'chars-in-region
)
113 (defun chars-in-region (beg end
)
114 (- (max beg end
) (min beg end
))))
115 (or (fboundp 'forward-point
)
116 (defun forward-point (arg)
118 (let ((count (abs arg
))
119 (step (if (zerop arg
)
122 (while (and (> count
0)
123 (< (point-min) (point)) (< (point) (point-max)))
125 (setq count
(1- count
)))
126 (+ (point) (* count step
))))))
127 (or (fboundp 'decompose-composite-char
)
128 (defun decompose-composite-char (char &optional type
129 with-composition-rule
)
131 (or (fboundp 'encode-coding-string
)
132 (defun encode-coding-string (string coding-system
&optional nocopy
)
135 (copy-sequence string
))))
136 (or (fboundp 'coding-system-p
)
137 (defun coding-system-p (obj) nil
))
138 (or (fboundp 'ccl-execute-on-string
)
139 (defun ccl-execute-on-string (ccl-prog status str
140 &optional contin unibyte-p
)
142 (or (fboundp 'define-ccl-program
)
143 (defmacro define-ccl-program
(name ccl-program
&optional doc
)
144 `(defconst ,name nil
,doc
)))
145 (or (fboundp 'multibyte-string-p
)
146 (defun multibyte-string-p (str)
147 (let ((len (length str
))
150 (while (and (< i len
) (not (setq multibyte
(> (aref str i
) 255))))
153 (or (fboundp 'string-make-multibyte
)
154 (defalias 'string-make-multibyte
'copy-sequence
))
155 (or (fboundp 'encode-char
)
156 (defun encode-char (ch ccs
)
161 (defcustom ps-multibyte-buffer nil
162 "*Specifies the multi-byte buffer handling.
166 nil This is the value to use the default settings which
167 is by default for printing buffer with only ASCII
168 and Latin characters. The default setting can be
169 changed by setting the variable
170 `ps-mule-font-info-database-default' differently.
171 The initial value of this variable is
172 `ps-mule-font-info-database-latin' (see
175 `non-latin-printer' This is the value to use when you have a Japanese
176 or Korean PostScript printer and want to print
177 buffer with ASCII, Latin-1, Japanese (JISX0208 and
178 JISX0201-Kana) and Korean characters. At present,
179 it was not tested the Korean characters printing.
180 If you have a korean PostScript printer, please,
183 `bdf-font' This is the value to use when you want to print
184 buffer with BDF fonts. BDF fonts include both latin
185 and non-latin fonts. BDF (Bitmap Distribution
186 Format) is a format used for distributing X's font
187 source file. BDF fonts are included in
188 `intlfonts-1.2' which is a collection of X11 fonts
189 for all characters supported by Emacs. In order to
190 use this value, be sure to have installed
191 `intlfonts-1.2' and set the variable
192 `bdf-directory-list' appropriately (see ps-bdf.el for
193 documentation of this variable).
195 `bdf-font-except-latin' This is like `bdf-font' except that it is used
196 PostScript default fonts to print ASCII and Latin-1
197 characters. This is convenient when you want or
198 need to use both latin and non-latin characters on
199 the same buffer. See `ps-font-family',
200 `ps-header-font-family' and `ps-font-info-database'.
202 Any other value is treated as nil."
203 :type
'(choice (const non-latin-printer
) (const bdf-font
)
204 (const bdf-font-except-latin
) (const :tag
"nil" nil
))
205 :group
'ps-print-font
)
207 (defvar ps-mule-font-info-database
209 "Alist of charsets with the corresponding font information.
210 Each element has the form:
212 (CHARSET (FONT-TYPE FONT-SRC FONT-NAME ENCODING BYTES)) ...)
216 CHARSET is a charset (symbol) for this font family,
218 FONT-TYPE is a font type: normal, bold, italic, or bold-italic.
220 FONT-SRC is a font source: builtin, bdf, vflib, or nil.
222 If FONT-SRC is builtin, FONT-NAME is a built-in PostScript font name.
224 If FONT-SRC is bdf, FONT-NAME is a BDF font file name, or a list of
225 alternative font names. To use this font, the external library `ps-bdf'
228 If FONT-SRC is vflib, FONT-NAME is the name of a font that VFlib knows.
229 To use this font, the external library `vflib' is required.
231 If FONT-SRC is nil, a proper ASCII font in the variable
232 `ps-font-info-database' is used, and FONT-NAME is ignored.
233 This is useful for Latin-1 characters.
235 ENCODING is a charset to encode a character of CHARSET to a glyph
236 code of the specifies font. ENCODING may be a function that does
237 this encoding. In this case, the function is called with one
238 argument, the character to encode, and it should return an
239 encoded code. ENCODING may be nil, in which case CHARSET is used
240 to encode a character.
242 BYTES specifies how many bytes each character has in the encoded
243 byte sequence; it should be 1 or 2. If ENCODING is a charset,
244 BYTES may be nil, in chich case the dimension of ENCODING is
247 All multi-byte characters are printed by fonts specified in this database
248 regardless of a font family of ASCII characters. The exception is Latin-1
249 characters which are printed by the same font as ASCII characters, thus obey
252 See also the variable `ps-font-info-database'.")
254 (defconst ps-mule-font-info-database-latin
257 "Sample setting of `ps-mule-font-info-database' to use latin fonts.")
259 (defcustom ps-mule-font-info-database-default
260 ps-mule-font-info-database-latin
261 "*The default setting to use when `ps-multibyte-buffer' is nil."
262 :type
'(symbol :tag
"Multi-Byte Buffer Database Font Default")
263 :group
'ps-print-font
)
265 (defconst ps-mule-font-info-database-ps
267 (normal builtin
"Ryumin-Light.Katakana")
268 (bold builtin
"GothicBBB-Medium.Katakana")
269 (bold-italic builtin
"GothicBBB-Medium.Katakana"))
271 (normal builtin
"Ryumin-Light.Hankaku")
272 (bold builtin
"GothicBBB-Medium.Hankaku"))
274 (normal builtin
"Ryumin-Light-H")
275 (bold builtin
"GothicBBB-Medium-H"))
277 (normal builtin
"Munhwa-Regular-KSC-EUC-H")
278 (bold builtin
"Munhwa-Bold-KSC-EUC-H"))
280 "Sample setting of the `ps-mule-font-info-database' to use builtin PS font.
282 Currently, data for Japanese and Korean PostScript printers are listed.")
284 (defconst ps-mule-font-info-database-bdf
286 (normal bdf
("lt1-24-etl.bdf" "etl24-latin1.bdf"))
287 (bold bdf
("lt1-16b-etl.bdf" "etl16b-latin1.bdf"))
288 (italic bdf
("lt1-16i-etl.bdf" "etl16i-latin1.bdf"))
289 (bold-italic bdf
("lt1-16bi-etl.bdf" "etl16bi-latin1.bdf")))
291 (normal bdf
("lt2-24-etl.bdf" "etl24-latin2.bdf")))
293 (normal bdf
("lt3-24-etl.bdf" "etl24-latin3.bdf")))
295 (normal bdf
("lt4-24-etl.bdf" "etl24-latin4.bdf")))
297 (normal bdf
("thai24.bdf" "thai-24.bdf") iso-8859-11
))
299 (normal bdf
("grk24-etl.bdf" "etl24-greek.bdf") iso-8859-7
))
301 (normal bdf
("heb24-etl.bdf" "etl24-hebrew.bdf") iso-8859-8
))
303 (normal bdf
"12x24rk.bdf" jisx0201
))
305 (normal bdf
("cyr24-etl.bdf" "etl24-cyrillic.bdf") iso-8859-5
))
307 (normal bdf
("lt5-24-etl.bdf" "etl24-latin5.bdf") iso-8859-9
))
309 (normal bdf
"gb24st.bdf"))
311 (normal bdf
"jiskan24.bdf"))
313 (normal bdf
"hanglm24.bdf"))
315 (normal bdf
("jksp40.bdf" "jisksp40.bdf")))
317 (normal bdf
("cns1-40.bdf" "cns-1-40.bdf")))
319 (normal bdf
("cns2-40.bdf" "cns-2-40.bdf")))
321 (normal bdf
"taipei24.bdf"))
323 (normal bdf
("sish24-etl.bdf" "etl24-sisheng.bdf")))
325 (normal bdf
("ipa24-etl.bdf" "etl24-ipa.bdf") ipa
))
327 (normal bdf
("visc24-etl.bdf" "etl24-viscii.bdf")))
329 (normal bdf
("arab24-0-etl.bdf" "etl24-arabic0.bdf")))
331 (normal bdf
("arab24-1-etl.bdf" "etl24-arabic1.bdf")))
333 (normal bdf
("lao24-mule.bdf" "mule-lao-24.bdf") ps-mule-encode-lao
1))
335 (normal bdf
("arab24-2-etl.bdf" "etl24-arabic2.bdf")))
337 (normal bdf
"dvsr0ntt-32.bdf"))
339 (normal bdf
"mlkr0ntt-32.bdf"))
341 (normal bdf
"tmvl0ntt-32.bdf"))
343 (normal bdf
("isci24-mule.bdf" "mule-iscii-24.bdf")))
345 (normal bdf
("ind1c24-mule.bdf" "mule-indian-1col-24.bdf")))
347 (normal bdf
("ethio24f-uni.bdf" "ethiomx24f-uni.bdf") unicode-bmp
))
349 (normal bdf
("cns3-40.bdf" "cns-3-40.bdf")))
351 (normal bdf
("cns4-40.bdf" "cns-4-40.bdf")))
353 (normal bdf
("cns5-40.bdf" "cns-5-40.bdf")))
355 (normal bdf
("cns6-40.bdf" "cns-6-40.bdf")))
357 (normal bdf
("cns7-40.bdf" "cns-7-40.bdf")))
359 (normal bdf
("ind24-mule.bdf" "mule-indian-24.bdf")))
361 (normal bdf
("tib24p-mule.bdf" "tib24-mule.bdf" "mule-tibmdx-24.bdf")))
363 (normal bdf
"etl24-unicode.bdf"))
365 "Sample setting of the `ps-mule-font-info-database' to use BDF fonts.
366 BDF (Bitmap Distribution Format) is a format used for distributing X's font
369 Current default value list for BDF fonts is included in `intlfonts-1.2'
370 which is a collection of X11 fonts for all characters supported by Emacs.
372 Using this list as default value to `ps-mule-font-info-database', all
373 characters including ASCII and Latin-1 are printed by BDF fonts.
375 See also `ps-mule-font-info-database-ps-bdf'.")
377 (defconst ps-mule-font-info-database-ps-bdf
378 (cons (car ps-mule-font-info-database-latin
)
379 (cdr (cdr ps-mule-font-info-database-bdf
)))
380 "Sample setting of the `ps-mule-font-info-database' to use BDF fonts.
382 Current default value list for BDF fonts is included in `intlfonts-1.2'
383 which is a collection of X11 fonts for all characters supported by Emacs.
385 Using this list as default value to `ps-mule-font-info-database', all
386 characters except ASCII and Latin-1 characters are printed with BDF fonts.
387 ASCII and Latin-1 characters are printed with PostScript font specified
388 by `ps-font-family' and `ps-header-font-family'.
390 See also `ps-mule-font-info-database-bdf'.")
392 (defvar ps-mule-font-spec-list nil
393 "Array of FONT-SPEC lists for each font type.
395 Elements are for `normal' font, `bold' font, `italic' font, and
396 `bold-italic' font in this order.
398 Each element is a list of FONT-SPEC which has this form:
400 (ID CHARSET (FONT-SRC FONT-NAME ENCODING) EXTRA-DATA)
404 ID is a number for this FONT-SPEC and is unique in the list.
406 CHARSET, FONT-SRC, FONT-NAME, ENCODING are the same as those in
407 `ps-mule-font-info-database' (which see).
409 EXTRA-DATA is a data attached by external libraries.
411 Each list is ordered by the current charset priorities.
413 This variable is setup by `ps-mule-begin-job' from
414 `ps-mule-font-info-database'.")
416 ;; Functions to access each element of FONT-SPEC.
417 (defsubst ps-mule-font-spec-id
(font-spec) (aref font-spec
0))
418 (defsubst ps-mule-font-spec-charset
(font-spec) (aref font-spec
1))
419 (defsubst ps-mule-font-spec-font-id
(font-spec) (aref font-spec
2))
420 (defsubst ps-mule-font-spec-src
(font-spec) (aref font-spec
3))
421 (defsubst ps-mule-font-spec-name
(font-spec) (aref font-spec
4))
422 (defsubst ps-mule-font-spec-set-name
(font-spec name
)
423 (aset font-spec
4 name
))
424 (defsubst ps-mule-font-spec-encoding
(font-spec) (aref font-spec
5))
425 (defsubst ps-mule-font-spec-bytes
(font-spec) (aref font-spec
6))
426 (defsubst ps-mule-font-spec-extra
(font-spec) (aref font-spec
7))
427 (defsubst ps-mule-font-spec-set-extra
(font-spec extra
)
428 (aset font-spec
7 extra
))
430 ;; Functions to encode character into glyph code.
431 (defun ps-mule-encode-lao (char)
434 (defun ps-mule-encode-char (char font-spec
)
435 (let ((encoding (ps-mule-font-spec-encoding font-spec
)))
436 (cond ((charsetp encoding
)
437 (encode-char char encoding
))
439 (funcall encoding char
))
443 ;; Array of FONT-SPEC-TABLEs; Nth element is for FONT-TYPE N.
445 ;; FONT-TYPE is 0, 1, 2, or 3 representing normal, bold, italic, and
446 ;; bold-italic respectively.
448 ;; FONT-SPEC-TABLE is a char-table of FONT-SPECs. It records which
449 ;; character is printed by which FONT-SPEC. It has one extra slot
450 ;; whose value is an alist of the form:
451 ;; (CHARSET . FONT-SPEC)
452 ;; FONT-SPEC is a vecotr of the form:
453 ;; (ID FONT-SRC FONT-NAME ENCODING EXTRA)
454 (defvar ps-mule-font-spec-tables nil
)
456 ;; Array of FONT-TYPEs; Nth element FONT-NUMBER N.
458 ;; FONT-NUMBER is 0, 1, 2, 3, 4, 5, 6 representing fonts f0, f1, f2,
459 ;; f3, h0, h1, and H0.
460 (defconst ps-mule-font-number-to-type
[ 0 1 2 3 1 0 0 ])
462 (defsubst ps-mule-get-font-spec
(char font-spec-table font-spec
)
463 "Return a font spec for printing CHAR with FONT-SPEC-TABLE.
465 FONT-SPEC, if non-nil, is a font spec to try at first.
467 See the documentation of `ps-mule-font-spec-tables' for the
468 format of font spec."
470 (or (aref font-spec-table char
)
471 (aset font-spec-table char
472 (or (and (< char
256)
473 (cdr (car (char-table-extra-slot font-spec-table
0))))
475 (encode-char char
(ps-mule-font-spec-charset font-spec
))
478 (dolist (elt (char-table-extra-slot font-spec-table
0))
479 (and (encode-char char
(car elt
))
480 (throw 'tag
(cdr elt
)))))
481 ;; Record that no font-spec exist for CHAR.
484 (defconst ps-mule-external-libraries
485 '((builtin nil nil nil nil nil nil
)
486 (bdf ps-bdf nil bdf-generate-prologue
487 bdf-check-font bdf-generate-font bdf-generate-glyph
)
488 (pcf nil nil pcf-generate-prologue
489 pcf-check-font pcf-generate-font pcf-generate-glyph
)
490 (vflib nil nil vflib-generate-prologue
491 vflib-check-font vflib-generate-font vflib-generate-glyphs
))
492 "Alist of information of external libraries to support PostScript printing.
493 Each element has the form:
495 (FONT-SRC FEATURE INITIALIZED-P
496 PROLOGUE-FUNC CHECK-FUNC FONT-FUNC GLYPH-FUNC)
498 FONT-SRC is the font source: builtin, bdf, pcf, or vflib.
500 FEATURE is the feature that provide a facility to handle FONT-SRC. Except for
501 `builtin' FONT-SRC, this feature is automatically `require'd before handling
502 FONT-SRC. Currently, we only have the feature `ps-bdf'.
504 INITIALIZED-P indicates if this library is initialized or not.
506 PROLOGUE-FUNC is a function to generate PostScript code which
507 define several PostScript procedures that will be called by
508 FONT-FUNC and GLYPHS-FUNC. It is called with no argument, and
509 should return a list of strings.
511 CHECK-FUNC is a function to check if a font is available or not.
512 It is called with one argument FONT-SPEC, and should return
513 non-nil iff the font specified in FONT-SPEC is available.
515 FONT-FUNC is a function to generate PostScript code which define
516 a new font. It is called with one argument FONT-SPEC, and should
517 return a list of strings.
519 GLYPH-FUNC is a function to generate PostScript code which define a glyph of
520 characters. It is called with two arguments FONT-SPEC and CODE,
521 and should return a list of strings.")
523 (defsubst ps-mule-exlib-feature
(exlib) (nth 1 exlib
))
524 (defsubst ps-mule-exlib-initialized-p
(exlib) (nth 2 exlib
))
525 (defsubst ps-mule-exlib-set-initialized-p
(exlib val
)
526 (setcar (nthcdr 2 exlib
) val
))
527 (defsubst ps-mule-exlib-prologue
(exlib) (nth 3 exlib
))
528 (defsubst ps-mule-exlib-check
(exlib) (nth 4 exlib
))
529 (defsubst ps-mule-exlib-font
(exlib) (nth 5 exlib
))
530 (defsubst ps-mule-exlib-glyph
(exlib) (nth 6 exlib
))
532 (defun ps-mule-init-external-library (exlib)
533 "Initialize external library specified by EXLIB for PostScript printing.
534 See the documentation of `ps-mule-external-libraries' for EXLIB's meaning."
535 (or (ps-mule-exlib-initialized-p exlib
)
536 (let ((prologue-func (ps-mule-exlib-prologue exlib
)))
538 (let ((feature (ps-mule-exlib-feature exlib
)))
541 (ps-output-prologue (funcall prologue-func
))))
542 (ps-mule-exlib-set-initialized-p exlib t
))))
544 (defvar ps-mule-output-list nil
)
546 (defun ps-mule-check-font (font-spec)
547 "Check if a font specified in FONT-SPEC is available or not."
548 (let ((font-src (ps-mule-font-spec-src font-spec
)))
550 (let ((exlib (assq font-src ps-mule-external-libraries
)))
551 (ps-mule-init-external-library exlib
)
552 (or (not (ps-mule-exlib-check exlib
))
553 (funcall (ps-mule-exlib-check exlib
) font-spec
))))))
555 (defun ps-mule-prepare-font (font-spec)
556 "Generate PostScript codes defining a new font of FONT-TYPE for CHARSET."
557 (let* ((font-src (ps-mule-font-spec-src font-spec
))
558 (exlib (assq font-src ps-mule-external-libraries
))
559 (id (ps-mule-font-spec-id font-spec
))
560 (ftag (format "%02X" id
))
561 (font-func (ps-mule-exlib-font exlib
))
564 (setq output-list
(funcall font-func font-spec
))
566 (format "/F%s /%s findfont def\n"
567 ftag
(or (ps-mule-font-spec-name font-spec
) "Courier")))
568 (ps-mule-font-spec-set-extra font-spec t
))
570 (nconc ps-mule-output-list
(list output-list
)))))
572 (defun ps-mule-prepare-glyph (char font-spec
)
573 "Generate PostScript codes to print CHAR by FONT-SPEC.
575 If CHAR is a cons (FROM TO), generate codes for characters
576 specified by the character code range FROM and TO.
578 The generated code is inserted on prologue part."
579 (if (vectorp font-spec
)
581 (or (ps-mule-font-spec-extra font-spec
)
582 (ps-mule-prepare-font font-spec
))
583 (let ((glyph-func (ps-mule-exlib-glyph
584 (assq (ps-mule-font-spec-src font-spec
)
585 ps-mule-external-libraries
))))
587 (let (from to output-list
)
589 (setq from
(car char
) to
(cdr char
))
590 (setq from char to char
))
593 (funcall glyph-func font-spec from
))
595 (ps-output-prologue output-list
))
596 (setq from
(1+ from
)))))))))
598 ;; This is a PostScript code inserted in the header of generated PostScript.
599 (defconst ps-mule-prologue
600 "%%%% Start of Mule Section
602 /Latin1Encoding { % newname fontname | font
603 findfont dup length dict begin
604 { 1 index /FID ne { def } { pop pop } ifelse } forall
605 /Encoding ISOLatin1Encoding def
611 %% Redefine fonts for multiple charsets.
612 /ReDefFont { % fontname encoding fdepvector size | -
615 1 index /FID ne 2 index /UniqueID ne and {def} {pop pop} ifelse
620 % FontMatrix ::= [ size 0 0 size 0 0 ]
621 /FontMatrix exch [ exch dup 0 exch 0 exch 0 0 ] def
629 "PostScript code for printing multi-byte characters.")
631 (defvar ps-mule-prologue-generated nil
)
633 ;; EscChar used in generated composite fonts.
634 (defconst ps-mule-esc-char
0)
636 (defun ps-mule-prologue-generated ()
637 (unless ps-mule-prologue-generated
638 (ps-output-prologue ps-mule-prologue
)
639 (ps-output-prologue (format "/EscChar %d def\n" ps-mule-esc-char
))
640 (setq ps-mule-prologue-generated t
)))
642 (defsubst ps-mule-eight-bit-char
(byte)
645 (decode-char 'eight-bit byte
)))
647 (defun ps-mule-encode-region (from to font-spec-table
)
648 "Generate PostScript code for plotting characters in the region FROM and TO.
650 FONT-NUM is 0, 1, 2, 3, 4, 5, or 6, each represents font tags
651 f0, f1, f2, f3, h0, h1, and H0 respectively."
652 (let* ((font-spec nil
)
655 ;; At most 4-byte (EscChar FONT-ID CODE1 CODE2) per character.
656 (str (make-string (* (- to from
) 4) 0))
659 (while (< (point) to
)
660 (let* ((char (following-char))
661 (this-spec (ps-mule-get-font-spec char font-spec-table font-spec
))
663 (if (vectorp this-spec
)
664 (setq this-id
(ps-mule-font-spec-font-id this-spec
))
665 ;; Can't print CHAR. Replace it with '?'.
667 this-spec
(ps-mule-get-font-spec char font-spec-table nil
)
668 this-id
(ps-mule-font-spec-font-id this-spec
)))
669 (or (= font-id this-id
)
672 (setq string-list
(cons (substring str
0 i
) string-list
)
674 (setq font-id this-id
)
677 (aset str i ps-mule-esc-char
)
681 (setq font-spec this-spec
)
684 (let* ((code (ps-mule-encode-char char font-spec
)))
685 (if (= (ps-mule-font-spec-bytes font-spec
) 1)
686 (aset str i
(ps-mule-eight-bit-char code
))
687 (aset str i
(ps-mule-eight-bit-char (/ code
256)))
689 (aset str i
(ps-mule-eight-bit-char (% code
256))))))
692 (nreverse (cons (substring str
0 i
) string-list
))))
694 (defun ps-mule-plot-composition (composition font-spec-table
)
695 "Generate PostScript code for plotting COMPOSITION with FONT-NUM."
697 (let ((components (copy-sequence (nth 2 composition
)))
699 (dotimes (i (length components
))
700 (let ((elt (aref components i
))
703 ;; ELT is a composition rule.
704 (ps-output (format " %d" (encode-composition-rule elt
)))
705 ;; ELT is a glyph character.
707 (ps-mule-get-font-spec elt font-spec-table font-spec
))
708 (or (vectorp this-spec
)
709 ;; Can't print CHAR. Replace it with '?'.
712 (ps-mule-get-font-spec elt font-spec-table font-spec
)))
713 (setq font-spec this-spec
)
714 (let* ((bytes (ps-mule-font-spec-bytes font-spec
))
715 (code (ps-mule-encode-char elt font-spec
))
716 (font-id (ps-mule-font-spec-font-id font-spec
))
717 (str (make-string (if (= font-id
0) 1 (+ 2 bytes
)) 0)))
719 (aset str
0 (ps-mule-eight-bit-char code
))
720 (aset str
0 ps-mule-esc-char
)
721 (aset str
1 (ps-mule-eight-bit-char font-id
))
723 (aset str
2 (ps-mule-eight-bit-char code
))
724 (aset str
2 (ps-mule-eight-bit-char (/ code
256)))
725 (aset str
3 (ps-mule-eight-bit-char (% code
256)))))
727 (ps-output-string str
)
728 (ps-output (if (eq (ps-mule-font-spec-src font-spec
) 'bdf
)
729 (format "/C%02X-%X" (ps-mule-font-spec-id font-spec
)
733 (ps-output " ] " (if (nth 3 composition
) "RLC" "RBC") "\n"))
735 (defun ps-mule-plot-string (from to
&optional bg-color
)
736 "Generate PostScript code for plotting characters in the region FROM and TO.
738 Optional argument BG-COLOR is ignored.
744 Where ENDPOS is the end position of the sequence and RUN-WIDTH is the width of
746 (let* ((average-width (ps-avg-char-width 'ps-font-for-text
))
748 (composition (find-composition from to nil t
))
749 (stop (if composition
(car composition
) to
))
750 (ascii-or-latin-1 "[\000-\377]+")
753 (font-spec-table (aref ps-mule-font-spec-tables
754 (aref ps-mule-font-number-to-type
759 (cond ((= (point) stop
)
763 (dolist (l (ps-mule-encode-region from
(point)
767 (setq width
(* (nth 5 composition
) average-width
))
768 (if (< ps-width-remaining
(+ run-width width
))
770 (ps-mule-plot-composition composition font-spec-table
)
771 (setq run-width
(+ run-width width
)
772 from
(nth 1 composition
))
774 (setq composition
(find-composition (point) to nil t
))
775 (setq stop
(if composition
(car composition
) to
)))))
777 ((looking-at ascii-or-latin-1
)
778 (let ((nchars (- (min (match-end 0) stop
) (point))))
779 (setq width
(* average-width nchars
))
780 (if (< ps-width-remaining
(+ run-width width
))
781 (setq nchars
(truncate (- ps-width-remaining run-width
)
783 run-width
(+ run-width
(* nchars average-width
))
784 endpos
(+ (point) nchars
))
785 (setq run-width
(+ run-width width
))
786 (forward-char nchars
))))
789 (while (and (< (point) stop
) (not endpos
))
790 (setq width
(char-width (following-char)))
791 (if (< ps-width-remaining
(+ run-width width
))
792 (setq endpos
(point))
793 (setq run-width
(+ run-width width
))
794 (forward-char 1))))))
797 (dolist (l (ps-mule-encode-region from endpos font-spec-table
))
801 (cons endpos run-width
)))
803 ;; Character composition support
805 (defvar ps-mule-composition-prologue-generated nil
)
807 (defconst ps-mule-composition-prologue
808 "%%%% Procedures for character composition.
809 /RelativeCompositionSkip 0.4 def
811 %% Get a bounding box (relative to currentpoint) of STR.
812 /GetPathBox { % [ str cname ] | -
813 dup 1 get dup false ne {
814 BitmapDict exch get /bmp exch def
815 %% bmp ::= [ DWIDTH WIDTH HEIGHT XOFF YOFF BITMAP RELATIVE-COMPOSE]
817 /URY LLY bmp 2 get add def
818 /RelativeCompose bmp 6 get dup false ne {
819 dup LLY le { pop 1 } { URY ge { -1 } { 0 } ifelse } ifelse
823 dup 0 get stringwidth pop dup /WIDTH exch def bmp 0 get div
824 dup LLY mul /LLY exch def
825 URY mul /URY exch def
828 dup 0 get stringwidth pop /WIDTH exch def
830 dup 0 get false charpath flattenpath pathbbox
831 /URY exch def pop /LLY exch def pop
833 /RelativeCompose 0 def
837 %% Apply effects except for shadow and outline to the rectangle
838 %% specified by TOP BOTTOM LEFT RIGHT.
839 /SpecialEffect { % -- | --
840 currentpoint dup TOP add /yy exch def BOTTOM add /YY exch def
841 dup LEFT add /xx exch def RIGHT add /XX exch def
842 %% Adjust positions for future shadowing.
844 /yy yy Yshadow add def
845 /XX XX Xshadow add def
847 Effect 1 and 0 ne { UnderlinePosition Hline } if % underline
848 Effect 2 and 0 ne { StrikeoutPosition Hline } if % strikeout
849 Effect 4 and 0 ne { OverlinePosition Hline } if % overline
852 Effect 16 and 0 ne {SpaceBackground doBox} { xx yy XX YY doRect} ifelse
854 Effect 16 and 0 ne { false 0 doBox } if % box
857 %% Draw COMPONENTS which has the form [ [str0 xoff0 yoff0] ... ] with
858 %% effects shadow and outline.
859 /ShowComponents { % components | -
861 { gsave aload pop rmoveto
862 Effect 8 and 0 ne { dup doShadow } if
863 Effect 32 and 0 ne { true doOutline } { show } ifelse
870 %% Show relative composition.
871 /RLC { % [[str0 cname0] [str1 cname1] ... [strN cnameN]] | -
873 [ % push [str xoff yoff] one by one
874 [ components 0 get GetPathBox aload pop pop 0 0 ]
875 %% Bounding box of overall glyphs.
881 1 1 components length 1 sub {
887 RelativeCompose 1 eq { % compose on TOP
888 TOP LLY sub RelativeCompositionSkip add % yoff
889 /TOP TOP URY LLY sub add RelativeCompositionSkip add def
890 } { RelativeCompose -1 eq { % compose under BOTTOM
891 BOTTOM URY sub RelativeCompositionSkip sub % yoff
892 /BOTTOM BOTTOM URY LLY sub sub
893 RelativeCompositionSkip sub def
896 URY TOP gt { /TOP URY def } if
897 LLY BOTTOM lt { /BOTTOM LLY def } if
902 SpecialEffect % Reflect special effects.
903 ShowComponents % Draw components.
906 %% Show rule-base composition.
907 /RBC { % [[str0 cname0] rule1 [str1 cname0] rule2 ... [strN cnameN]] | -
909 [ % push [str xoff yoff] one by one
910 [ components 0 get GetPathBox aload pop pop 0 0 ]
911 %% Bounding box of overall glyphs.
916 1 1 components length 1 sub {
917 components exch get /elt exch def
918 elt type /integertype eq { % rule
919 %% Do the same RULE decoding as the macro
920 %% COMPOSITION_DECODE_RULE in emacs/src/composite.h.
921 elt 12 idiv dup 3 mod /grefx exch def 3 idiv /grefy exch def
922 elt 12 mod dup 3 mod /nrefx exch def 3 idiv /nrefy exch def
927 /height URY LLY sub def
928 /left LEFT [ 0 RIGHT LEFT sub dup 2 div exch ] grefx get add
929 [ 0 WIDTH 2 div WIDTH ] nrefx get sub def
930 /bottom [ TOP 0 BOTTOM TOP BOTTOM add 2 div ] grefy get
931 [ height LLY neg 0 height 2 div ] nrefy get sub def
932 %% Update bounding box
933 left LEFT lt { /LEFT left def } if
934 left WIDTH add RIGHT gt { /RIGHT left WIDTH add def } if
935 bottom BOTTOM lt { /BOTTOM bottom def } if
936 bottom height add TOP gt { /TOP bottom height add def } if
937 left bottom LLY sub ]
942 LEFT 0 lt { % Adjust xoff to the right.
943 dup { dup 1 get LEFT sub 1 exch put } forall
944 /RIGHT RIGHT LEFT sub def
947 SpecialEffect % Reflect special effects.
948 ShowComponents % Draw components.
950 %%%% End of procedures for character composition
952 "PostScript code for printing character composition.")
954 (defun ps-mule-composition-prologue-generated ()
955 (unless ps-mule-composition-prologue-generated
956 (ps-mule-prologue-generated)
957 (ps-output-prologue ps-mule-composition-prologue
)
958 (setq ps-mule-composition-prologue-generated t
)))
960 ;; Bitmap font support
962 (defvar ps-mule-bitmap-prologue-generated nil
)
964 (defconst ps-mule-bitmap-prologue
965 "%%%% Procedures for bitmap fonts.
967 %% Create a base bitmap font.
968 /NBF { % fontname fontsize relative-compose baseline-offset enc | --
971 /FontMatrix matrix def
972 /FontBBox [ 0 0 0 0 ] def
974 /BaselineOffset exch def
975 /RelativeCompose exch def
977 /FontMatrix [ 1 FontSize div 0 0 1 FontSize div 0 0 ] def
978 /BuildGlyph { % fontdict charname | -
979 BitmapDict exch get /bmp exch def pop
980 %% bmp ::= [ DWIDTH WIDTH HEIGHT XOFF YOFF BITMAP RELATIVE-COMPOSE ]
983 /urx llx bmp 1 get add def
984 /ury lly bmp 2 get add def
985 bmp 0 get 0 llx lly urx ury setcachedevice
986 bmp 5 get length 0 gt {
989 true [ 1 0 0 -1 0 0 ] { bmp 5 get } imagemask
992 /BuildChar { % fontdict byte | -
993 1 index /Encoding get exch get
994 1 index /BuildGlyph get exec
1000 %% Create a parent font of 8/8 mapping.
1001 /NPF { % fontname encoding fdepvector | -
1005 /FontMatrix matrix def
1006 /FDepVector exch def
1013 %%%% End of procedures for bitmap fonts.
1016 ;; External library support.
1018 (defvar ps-mule-bitmap-dict-list nil
)
1019 (defvar ps-mule-bitmap-font-record nil
)
1021 ;; The following three functions are to be called from external
1022 ;; libraries which support bitmap fonts (e.g. `bdf') to get
1023 ;; appropriate PostScript code.
1025 (defun ps-mule-generate-bitmap-prologue ()
1026 (unless ps-mule-bitmap-prologue-generated
1027 (setq ps-mule-bitmap-prologue-generated t
1028 ps-mule-bitmap-dict-list nil
1029 ps-mule-bitmap-font-record
(make-vector 1024 nil
))
1030 (list ps-mule-bitmap-prologue
)))
1032 (defun ps-mule-generate-bitmap-font (font-spec size relative-compose
1034 (let* ((id (ps-mule-font-spec-id font-spec
))
1035 (bytes (ps-mule-font-spec-bytes font-spec
))
1039 (list (format "/E%02X [ 0 1 255 {pop /.notdef} for ] def\n" id
)
1040 (format "%%%% %s\n" (ps-mule-font-spec-name font-spec
))
1041 (format "/F%02X %f %S %d E%02X NBF\n" id size
1042 relative-compose baselie-offset id
)))
1044 (list (list (format "/E%02X [ 0 1 255 { pop 0 } for ] def\n" id
))
1045 (list (format "/V%02X [" id
))
1047 (format "%%%% %s\n" (ps-mule-font-spec-name font-spec
))
1048 (format "/F%02X E%02X V%02X NPF\n" id id id
))))
1049 (aset ps-mule-bitmap-font-record id
1050 (vector (= bytes
1) output-list
1051 size relative-compose baselie-offset bbx
))
1052 (if ps-mule-bitmap-dict-list
1054 (setq ps-mule-bitmap-dict-list
(list "/BitmapDict <<\n" ">> def\n"))
1055 (cons ps-mule-bitmap-dict-list output-list
))))
1057 (defun ps-mule-generate-bitmap-glyph (font-spec char code bitmap
)
1058 (let* ((id (ps-mule-font-spec-id font-spec
))
1059 ;; FONT-RECORD ::= ([(SUBFONT-OUTPUT-LIST ...) | t]
1060 ;; BASEFONT-OUTPUT-LIST SIZE REL-COMP B-OFFSET BBX)
1061 (font-record (aref ps-mule-bitmap-font-record id
))
1064 (if (listp (aref font-record
0))
1065 ;; This is a 2-dimensional font. Create a subfont for this
1066 ;; glyph if not yet created.
1067 (let* ((high (/ code
256))
1068 (id2 (+ (* id
256) high
)))
1069 (setq output-list
(cdr (assq high
(aref font-record
0)))
1072 ;; We must create a subfont.
1073 (let ((enc-list (car (aref font-record
1)))
1074 (fdep-list (nth 1 (aref font-record
1))))
1077 (format "/E%04X [ 0 1 255 {pop /.notdef} for ] def\n"
1079 (format "/F%04X %f %S %d E%04X NBF\n"
1080 id2
(aref font-record
2) (aref font-record
3)
1081 (aref font-record
4) id2
)
1082 (format "E%02X %d %d put\n"
1083 id high
(1- (length fdep-list
)))))
1084 (nconc enc-list
(list output-list
))
1085 (nconc fdep-list
(list (format " F%04X" id2
)))
1087 (cons (cons high output-list
) (aref font-record
0)))))
1088 (setq enc-name
(format "%04X" id2
)))
1089 (setq output-list
(aref font-record
1)
1090 enc-name
(format "%02X" id
)))
1091 (setcdr ps-mule-bitmap-dict-list
1092 (cons (format "/C%02X-%X %s\n" id char bitmap
)
1093 (cdr ps-mule-bitmap-dict-list
)))
1095 (cons (format "E%s %d /C%02X-%X put\n" enc-name code id char
)
1096 (cdr output-list
))))
1099 ;; Mule specific initializers.
1102 (defun ps-mule-initialize ()
1103 "Initialize global data for printing multi-byte characters."
1104 (setq ps-mule-prologue-generated nil
1105 ps-mule-composition-prologue-generated nil
1106 ps-mule-bitmap-prologue-generated nil
)
1107 (mapcar `(lambda (x) (setcar (nthcdr 2 x
) nil
))
1108 ps-mule-external-libraries
))
1110 (defun ps-mule-encode-header-string (string fonttag
)
1111 "Generate PostScript code for ploting STRING by font FONTTAG.
1112 FONTTAG should be a string \"/h0\", \"/h1\", \"/L0\", or \"/H0\"."
1115 (ps-mule-encode-region (point-min) (point-max)
1116 (aref ps-mule-font-spec-tables
1117 (aref ps-mule-font-number-to-type
1118 (cond ((string= fonttag
"/h0") 4)
1119 ((string= fonttag
"/h1") 5)
1120 ((string= fonttag
"/L0") 6)
1124 (defun ps-mule-begin-job (from to
)
1125 "Start printing job for multi-byte chars between FROM and TO.
1126 This checks if all multi-byte characters in the region are printable or not."
1127 (auto-compose-region from to
)
1128 (if (and (not (find-composition from to
))
1131 (= (skip-chars-forward "\x00-\xFF" to
) to
)))
1132 ;; All characters can be printed by normal PostScript fonts.
1133 (setq ps-basic-plot-string-function
'ps-basic-plot-string
1134 ps-encode-header-string-function
'identity
)
1135 (setq ps-basic-plot-string-function
'ps-mule-plot-string
1136 ps-encode-header-string-function
'ps-mule-encode-header-string
1137 ps-mule-font-info-database
1138 (cond ((eq ps-multibyte-buffer
'non-latin-printer
)
1139 ps-mule-font-info-database-ps
)
1140 ((eq ps-multibyte-buffer
'bdf-font
)
1141 ps-mule-font-info-database-bdf
)
1142 ((eq ps-multibyte-buffer
'bdf-font-except-latin
)
1143 ps-mule-font-info-database-ps-bdf
)
1145 ps-mule-font-info-database-default
)))
1147 ;; Be sure to have font information for Latin-1.
1148 (or (assq 'iso-8859-1 ps-mule-font-info-database
)
1149 (setq ps-mule-font-info-database
1150 (cons '(iso-8859-1 (normal nil nil
))
1151 ps-mule-font-info-database
)))
1153 ;; Generate ps-mule-font-spec-tables.
1154 (let ((font-spec-alist (make-vector 4 nil
))
1158 ;; Generate properly ordered font-info-list from
1159 ;; ps-mule-font-info-database.
1161 (copy-sequence (get-language-info current-language-environment
1163 (setq charset-list
(cons 'iso-8859-1
(delq 'iso-8859-1 charset-list
)))
1164 (dolist (charset charset-list
)
1165 (let ((font-info (assq charset ps-mule-font-info-database
)))
1167 (setq font-info-list
(cons font-info font-info-list
)))))
1168 (dolist (font-info ps-mule-font-info-database
)
1169 (or (memq (car font-info
) charset-list
)
1170 (setq font-info-list
(cons font-info font-info-list
))))
1171 (setq font-info-list
(nreverse font-info-list
)))
1173 ;; Store FONT-SPECs in each element of font-spec-alist.
1174 (dolist (font-info font-info-list
)
1175 (let ((font-spec-vec (make-vector 4 nil
))
1176 (charset (car font-info
))
1178 (dolist (e (cdr font-info
))
1179 (setq encoding
(or (nth 3 e
) charset
)
1180 font-spec
(vector id-max charset font-id
1181 (nth 1 e
) (nth 2 e
) encoding
1182 (or (nth 4 e
) (charset-dimension encoding
))
1185 (if (ps-mule-check-font font-spec
)
1187 (cond ((eq (car e
) 'normal
) 0)
1188 ((eq (car e
) 'bold
) 1)
1189 ((eq (car e
) 'italic
) 2)
1191 (when (aref font-spec-vec
0)
1192 (or (aref font-spec-vec
3)
1193 (aset font-spec-vec
3 (or (aref font-spec-vec
1)
1194 (aref font-spec-vec
2)
1195 (aref font-spec-vec
0))))
1196 (or (aref font-spec-vec
1)
1197 (aset font-spec-vec
1 (aref font-spec-vec
0)))
1198 (or (aref font-spec-vec
2)
1199 (aset font-spec-vec
2 (aref font-spec-vec
1)))
1201 (aset font-spec-alist i
1202 (nconc (aref font-spec-alist i
)
1203 (list (cons charset
(aref font-spec-vec i
))))))
1204 (setq font-id
(1+ font-id
)))))
1206 ;; Make four FONT-SPEC-TABLEs and set them in
1207 ;; ps-mule-font-spec-tables. Each char table has one extra slot
1208 ;; whose value is an element of font-spec-alist.
1209 (setq ps-mule-font-spec-tables
(make-vector 4 nil
))
1210 (put 'font-spec-table
'char-table-extra-slots
1)
1212 (let ((table (make-char-table 'font-spec-table
)))
1213 (aset ps-mule-font-spec-tables i table
)
1214 (set-char-table-extra-slot table
0 (aref font-spec-alist i
))
1215 ;; Be sure to have glyphs for "0123456789/" in advance for
1217 (let ((str " 0123456789/"))
1218 (dotimes (i (length str
))
1219 (or (vectorp (ps-mule-get-font-spec (aref str i
) table nil
))
1220 (error "ASCII font not available")))))))
1222 (ps-mule-prologue-generated)
1223 (if (find-composition from to
)
1224 (ps-mule-composition-prologue-generated))))
1226 (defun ps-mule-restruct-output-list (list tail
)
1229 (setq tail
(ps-mule-restruct-output-list elt tail
))
1230 (setcdr tail
(cons elt
(cdr tail
)))
1231 (setq tail
(cdr tail
))))
1234 (defun ps-mule-redefine-font (font-number fonttag size ps-font
)
1235 (let* ((font-type (aref ps-mule-font-number-to-type font-number
))
1236 (font-spec-alist (char-table-extra-slot
1237 (aref ps-mule-font-spec-tables font-type
) 0)))
1239 (list (if (ps-mule-font-spec-src (cdr (car font-spec-alist
)))
1240 ;; We ignore a font specfied in ps-font-info-database.
1241 (format "/V%s VTOP%d def\n" fonttag font-type
)
1242 (format "/V%s [ VTOP%d aload pop ] def\n
1243 V%s 0 /%s-latin1 /%s Latin1Encoding put\n"
1244 fonttag font-type fonttag ps-font ps-font
))
1245 (format "/%s ETOP%d V%s %f ReDefFont\n"
1246 fonttag font-type fonttag size
)))))
1250 (defun ps-mule-end-job ()
1251 "Finish printing job for multi-byte chars."
1253 ;; Prepare root and sub fonts while generating glyphs if necessary.
1254 (let ((output-head (list t
))
1255 (ps-mule-output-list (list t
)))
1257 (map-char-table 'ps-mule-prepare-glyph
1258 (aref ps-mule-font-spec-tables i
)))
1259 (ps-mule-restruct-output-list (cdr ps-mule-output-list
) output-head
)
1260 (ps-output-prologue (cdr output-head
)))
1262 ;; Prepare top Encoding and templates of FDepVector.
1264 (let ((font-spec-alist (char-table-extra-slot
1265 (aref ps-mule-font-spec-tables i
) 0))
1266 font-list font-spec
)
1267 (dolist (elt font-spec-alist
)
1268 (setq font-spec
(cdr elt
))
1269 (if (ps-mule-font-spec-extra font-spec
)
1270 (push (cons (ps-mule-font-spec-font-id font-spec
)
1271 (ps-mule-font-spec-id font-spec
))
1273 (setq font-list
(nreverse font-list
))
1275 (list (format "/ETOP%d 256 array def\n" i
)
1276 (format "0 1 255 { ETOP%d exch 0 put } for\n" i
)))
1278 (dolist (font font-list
)
1279 (ps-output-prologue (format "ETOP%d %d %d put\n" i
(car font
) index
))
1280 (setq index
(1+ index
))))
1281 (ps-output-prologue (format "/VTOP%d [%s] def\n" i
1282 (mapconcat #'(lambda (x)
1283 (format "F%02X" (cdr x
)))
1286 ;; Redefine fonts f0, f1, f2, f3, h0, h1, H0.
1287 (ps-mule-redefine-font 4 "h0" ps-header-title-font-size-internal
1288 (ps-font 'ps-font-for-header
'bold
))
1289 (ps-mule-redefine-font 5 "h1" ps-header-font-size-internal
1290 (ps-font 'ps-font-for-header
'normal
))
1291 (ps-mule-redefine-font 6 "H0" ps-footer-font-size-internal
1292 (ps-font 'ps-font-for-footer
'normal
))
1293 (let ((font (ps-font-alist 'ps-font-for-text
))
1296 (ps-mule-redefine-font i
(format "f%d" i
)
1297 ps-font-size-internal
1298 (ps-font 'ps-font-for-text
(car (car font
))))
1299 (setq font
(cdr font
)
1304 ;;; arch-tag: bca017b2-66a7-4e59-8584-103e749eadbe
1305 ;;; ps-mule.el ends here