comparison lisp/ps-print.el @ 61073:449d2654bc2d

(ps-print-translation-table): New variable. (ps-plot-region): Translate characters by ps-print-translation-table.
author Kenichi Handa <handa@m17n.org>
date Tue, 29 Mar 2005 05:06:48 +0000
parents ff7181a543b6
children 2942738e0235 4da4a09e8b1b
comparison
equal deleted inserted replaced
61072:c37cbd3119bc 61073:449d2654bc2d
6148 (ps-plot 'ps-basic-plot-str 0 (length string) string)) 6148 (ps-plot 'ps-basic-plot-str 0 (length string) string))
6149 6149
6150 6150
6151 (defvar ps-current-effect 0) 6151 (defvar ps-current-effect 0)
6152 6152
6153 (defvar ps-print-translation-table
6154 (let ((tbl (make-char-table 'translation-table nil)))
6155 (if (and (boundp 'ucs-mule-8859-to-mule-unicode)
6156 (char-table-p ucs-mule-8859-to-mule-unicode))
6157 (map-char-table
6158 #'(lambda (k v)
6159 (if (and v (eq (char-charset v) 'latin-iso8859-1) (/= k v))
6160 (aset tbl k v)))
6161 ucs-mule-8859-to-mule-unicode))
6162 tbl)
6163 "Translation table for PostScript printing.
6164 The default value is a table that translates non-Latin-1 Latin characters
6165 to the equivalent Latin-1 characters.")
6153 6166
6154 (defun ps-plot-region (from to font &optional fg-color bg-color effects) 6167 (defun ps-plot-region (from to font &optional fg-color bg-color effects)
6155 (or (equal font ps-current-font) 6168 (or (equal font ps-current-font)
6156 (ps-set-font font)) 6169 (ps-set-font font))
6157 6170
6238 6251
6239 (composition ; a composite sequence 6252 (composition ; a composite sequence
6240 (ps-plot 'ps-mule-plot-composition match-point (point) bg-color)) 6253 (ps-plot 'ps-mule-plot-composition match-point (point) bg-color))
6241 6254
6242 ((> match 255) ; a multi-byte character 6255 ((> match 255) ; a multi-byte character
6256 (setq match (or (aref ps-print-translation-table match) match))
6243 (let* ((charset (char-charset match)) 6257 (let* ((charset (char-charset match))
6244 (composition (ps-e-find-composition match-point to)) 6258 (composition (ps-e-find-composition match-point to))
6245 (stop (if (nth 2 composition) (car composition) to))) 6259 (stop (if (nth 2 composition) (car composition) to)))
6246 (or (eq charset 'composition) 6260 (or (eq charset 'composition)
6247 (while (and (< (point) stop) (eq (charset-after) charset)) 6261 (while (and (< (point) stop)
6262 (let ((ch (following-char)))
6263 (setq ch
6264 (or (aref ps-print-translation-table ch)
6265 ch))
6266 (eq (char-charset ch) charset)))
6248 (forward-char 1))) 6267 (forward-char 1)))
6249 (ps-plot 'ps-mule-plot-string match-point (point) bg-color))) 6268 (ps-plot 'ps-mule-plot-string match-point (point) bg-color)))
6250 ; characters from ^@ to ^_ and 6269 ; characters from ^@ to ^_ and
6251 (t ; characters from 127 to 255 6270 (t ; characters from 127 to 255
6252 (ps-control-character match))) 6271 (ps-control-character match)))