comparison lisp/ps-mule.el @ 24086:bedce7fcf0f4

(ps-mule-font-info-database-bdf): Add alternative file names that avoid clashes in DOS 8+3 namespace. FONT-NAME can now be a list of alternative names. (ps-mule-generate-font): If FONT-NAME is a cons cell, use its car. (ps-mule-prepare-font): Likewise.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 17 Jan 1999 16:32:50 +0000
parents 144220e7f841
children 958f4aa0dceb
comparison
equal deleted inserted replaced
24085:8dc3b068c0db 24086:bedce7fcf0f4
161 161
162 FONT-SRC is a font source: builtin, ps-bdf, vflib, or nil. 162 FONT-SRC is a font source: builtin, ps-bdf, vflib, or nil.
163 163
164 If FONT-SRC is builtin, FONT-NAME is a buitin PostScript font name. 164 If FONT-SRC is builtin, FONT-NAME is a buitin PostScript font name.
165 165
166 If FONT-SRC is bdf, FONT-NAME is a BDF font file name. To use this font, 166 If FONT-SRC is bdf, FONT-NAME is a BDF font file name, or a list of
167 the external library `ps-bdf' is required. 167 alternative font names. To use this font, the external library `ps-bdf'
168 is required.
168 169
169 If FONT-SRC is vflib, FONT-NAME is the name of a font that VFlib knows. 170 If FONT-SRC is vflib, FONT-NAME is the name of a font that VFlib knows.
170 To use this font, the external library `vflib' is required. 171 To use this font, the external library `vflib' is required.
171 172
172 If FONT-SRC is nil, a proper ASCII font in the variable 173 If FONT-SRC is nil, a proper ASCII font in the variable
211 212
212 Currently, data for Japanese and Korean PostScript printers are listed.") 213 Currently, data for Japanese and Korean PostScript printers are listed.")
213 214
214 (defconst ps-mule-font-info-database-bdf 215 (defconst ps-mule-font-info-database-bdf
215 '((ascii 216 '((ascii
216 (normal bdf "etl24-latin1.bdf" nil 1) 217 (normal bdf ("lt1-24-etl.bdf" "etl24-latin1.bdf") nil 1)
217 (bold bdf "etl16b-latin1.bdf" iso-latin-1 1) 218 (bold bdf ("lt1-16b-etl.bdf" "etl16b-latin1.bdf") iso-latin-1 1)
218 (italic bdf "etl16i-latin1.bdf" iso-latin-1 1) 219 (italic bdf ("lt1-16i-etl.bdf" "etl16i-latin1.bdf") iso-latin-1 1)
219 (bold-italic bdf "etl16bi-latin1.bdf" iso-latin-1 1)) 220 (bold-italic bdf ("lt1-16bi-etl.bdf" "etl16bi-latin1.bdf") iso-latin-1 1))
220 (latin-iso8859-1 221 (latin-iso8859-1
221 (normal bdf "etl24-latin1.bdf" iso-latin-1 1) 222 (normal bdf ("lt1-24-etl.bdf" "etl24-latin1.bdf") nil 1)
222 (bold bdf "etl16b-latin1.bdf" iso-latin-1 1) 223 (bold bdf ("lt1-16b-etl.bdf" "etl16b-latin1.bdf") iso-latin-1 1)
223 (italic bdf "etl16i-latin1.bdf" iso-latin-1 1) 224 (italic bdf ("lt1-16i-etl.bdf" "etl16i-latin1.bdf") iso-latin-1 1)
224 (bold-italic bdf "etl16bi-latin1.bdf" iso-latin-1 1)) 225 (bold-italic bdf ("lt1-16bi-etl.bdf" "etl16bi-latin1.bdf") iso-latin-1 1))
225 (latin-iso8859-2 226 (latin-iso8859-2
226 (normal bdf "etl24-latin2.bdf" iso-latin-2 1)) 227 (normal bdf ("lt2-24-etl.bdf" "etl24-latin2.bdf") iso-latin-2 1))
227 (latin-iso8859-3 228 (latin-iso8859-3
228 (normal bdf "etl24-latin3.bdf" iso-latin-3 1)) 229 (normal bdf ("lt3-24-etl.bdf" "etl24-latin3.bdf") iso-latin-3 1))
229 (latin-iso8859-4 230 (latin-iso8859-4
230 (normal bdf "etl24-latin4.bdf" iso-latin-4 1)) 231 (normal bdf ("lt4-24-etl.bdf" "etl24-latin4.bdf") iso-latin-4 1))
231 (thai-tis620 232 (thai-tis620
232 (normal bdf "thai-24.bdf" thai-tis620 1)) 233 (normal bdf ("thai24.bdf" "thai-24.bdf") thai-tis620 1))
233 (greek-iso8859-7 234 (greek-iso8859-7
234 (normal bdf "etl24-greek.bdf" greek-iso-8bit 1)) 235 (normal bdf ("grk24-etl.bdf" "etl24-greek.bdf") greek-iso-8bit 1))
235 ;; (arabic-iso8859-6 nil) ; not yet available 236 ;; (arabic-iso8859-6 nil) ; not yet available
236 (hebrew-iso8859-8 237 (hebrew-iso8859-8
237 (normal bdf "etl24-hebrew.bdf" hebrew-iso-8bit 1)) 238 (normal bdf ("heb24-etl.bdf" "etl24-hebrew.bdf") hebrew-iso-8bit 1))
238 (katakana-jisx0201 239 (katakana-jisx0201
239 (normal bdf "12x24rk.bdf" ps-mule-encode-8bit 1)) 240 (normal bdf "12x24rk.bdf" ps-mule-encode-8bit 1))
240 (latin-jisx0201 241 (latin-jisx0201
241 (normal bdf "12x24rk.bdf" ps-mule-encode-7bit 1)) 242 (normal bdf "12x24rk.bdf" ps-mule-encode-7bit 1))
242 (cyrillic-iso8859-5 243 (cyrillic-iso8859-5
243 (normal bdf "etl24-cyrillic.bdf" cyrillic-iso-8bit 1)) 244 (normal bdf ("cyr24-etl.bdf" "etl24-cyrillic.bdf") cyrillic-iso-8bit 1))
244 (latin-iso8859-9 245 (latin-iso8859-9
245 (normal bdf "etl24-latin5.bdf" iso-latin-5 1)) 246 (normal bdf ("lt5-24-etl.bdf" "etl24-latin5.bdf") iso-latin-5 1))
246 (japanese-jisx0208-1978 247 (japanese-jisx0208-1978
247 (normal bdf "jiskan24.bdf" ps-mule-encode-7bit 2)) 248 (normal bdf "jiskan24.bdf" ps-mule-encode-7bit 2))
248 (chinese-gb2312 249 (chinese-gb2312
249 (normal bdf "gb24st.bdf" ps-mule-encode-7bit 2)) 250 (normal bdf "gb24st.bdf" ps-mule-encode-7bit 2))
250 (japanese-jisx0208 251 (japanese-jisx0208
251 (normal bdf "jiskan24.bdf" ps-mule-encode-7bit 2)) 252 (normal bdf "jiskan24.bdf" ps-mule-encode-7bit 2))
252 (korean-ksc5601 253 (korean-ksc5601
253 (normal bdf "hanglm24.bdf" ps-mule-encode-7bit 2)) 254 (normal bdf "hanglm24.bdf" ps-mule-encode-7bit 2))
254 (japanese-jisx0212 255 (japanese-jisx0212
255 (normal bdf "jisksp40.bdf" ps-mule-encode-7bit 2)) 256 (normal bdf ("jksp40.bdf" "jisksp40.bdf") ps-mule-encode-7bit 2))
256 (chinese-cns11643-1 257 (chinese-cns11643-1
257 (normal bdf "cns-1-40.bdf" ps-mule-encode-7bit 2)) 258 (normal bdf ("cns1-40.bdf" "cns-1-40.bdf") ps-mule-encode-7bit 2))
258 (chinese-cns11643-2 259 (chinese-cns11643-2
259 (normal bdf "cns-2-40.bdf" ps-mule-encode-7bit 2)) 260 (normal bdf ("cns2-40.bdf" "cns-2-40.bdf") ps-mule-encode-7bit 2))
260 (chinese-big5-1 261 (chinese-big5-1
261 (normal bdf "taipei24.bdf" chinese-big5 2)) 262 (normal bdf "taipei24.bdf" chinese-big5 2))
262 (chinese-big5-2 263 (chinese-big5-2
263 (normal bdf "taipei24.bdf" chinese-big5 2)) 264 (normal bdf "taipei24.bdf" chinese-big5 2))
264 (chinese-sisheng 265 (chinese-sisheng
265 (normal bdf "etl24-sisheng.bdf" ps-mule-encode-8bit 1)) 266 (normal bdf ("sish24-etl.bdf" "etl24-sisheng.bdf") ps-mule-encode-8bit 1))
266 (ipa 267 (ipa
267 (normal bdf "etl24-ipa.bdf" ps-mule-encode-8bit 1)) 268 (normal bdf ("ipa24-etl.bdf" "etl24-ipa.bdf") ps-mule-encode-8bit 1))
268 (vietnamese-viscii-lower 269 (vietnamese-viscii-lower
269 (normal bdf "etl24-viscii.bdf" vietnamese-viscii 1)) 270 (normal bdf ("visc24-etl.bdf" "etl24-viscii.bdf") vietnamese-viscii 1))
270 (vietnamese-viscii-upper 271 (vietnamese-viscii-upper
271 (normal bdf "etl24-viscii.bdf" vietnamese-viscii 1)) 272 (normal bdf ("visc24-etl.bdf" "etl24-viscii.bdf") vietnamese-viscii 1))
272 (arabic-digit 273 (arabic-digit
273 (normal bdf "etl24-arabic0.bdf" ps-mule-encode-7bit 1)) 274 (normal bdf ("arab24-0-etl.bdf" "etl24-arabic0.bdf") ps-mule-encode-7bit 1))
274 (arabic-1-column 275 (arabic-1-column
275 (normal bdf "etl24-arabic1.bdf" ps-mule-encode-7bit 1)) 276 (normal bdf ("arab24-1-etl.bdf" "etl24-arabic1.bdf") ps-mule-encode-7bit 1))
276 ;; (ascii-right-to-left nil) ; not yet available 277 ;; (ascii-right-to-left nil) ; not yet available
277 (lao 278 (lao
278 (normal bdf "mule-lao-24.bdf" lao 1)) 279 (normal bdf ("lao24-mule.bdf" "mule-lao-24.bdf") lao 1))
279 (arabic-2-column 280 (arabic-2-column
280 (normal bdf "etl24-arabic2.bdf" ps-mule-encode-7bit 1)) 281 (normal bdf ("arab24-2-etl.bdf" "etl24-arabic2.bdf") ps-mule-encode-7bit 1))
281 (indian-is13194 282 (indian-is13194
282 (normal bdf "mule-iscii-24.bdf" ps-mule-encode-7bit 1)) 283 (normal bdf ("isci24-etl.bdf" "mule-iscii-24.bdf") ps-mule-encode-7bit 1))
283 (indian-1-column 284 (indian-1-column
284 (normal bdf "mule-indian-1col-24.bdf" ps-mule-encode-7bit 2)) 285 (normal bdf ("ind1c24-mule.bdf" "mule-indian-1col-24.bdf") ps-mule-encode-7bit 2))
285 (tibetan-1-column 286 (tibetan-1-column
286 (normal bdf "mule-tibmdx-1col-24.bdf" ps-mule-encode-7bit 2)) 287 (normal bdf ("tib1c24-mule.bdf" "mule-tibmdx-1col-24.bdf") ps-mule-encode-7bit 2))
287 (ethiopic 288 (ethiopic
288 (normal bdf "ethiomx24f-uni.bdf" ps-mule-encode-ethiopic 2)) 289 (normal bdf ("ethio24f-uni.bdf" "ethiomx24f-uni.bdf") ps-mule-encode-ethiopic 2))
289 (chinese-cns11643-3 290 (chinese-cns11643-3
290 (normal bdf "cns-3-40.bdf" ps-mule-encode-7bit 2)) 291 (normal bdf ("cns3-40.bdf" "cns-3-40.bdf") ps-mule-encode-7bit 2))
291 (chinese-cns11643-4 292 (chinese-cns11643-4
292 (normal bdf "cns-4-40.bdf" ps-mule-encode-7bit 2)) 293 (normal bdf ("cns4-40.bdf" "cns-4-40.bdf") ps-mule-encode-7bit 2))
293 (chinese-cns11643-5 294 (chinese-cns11643-5
294 (normal bdf "cns-5-40.bdf" ps-mule-encode-7bit 2)) 295 (normal bdf ("cns5-40.bdf" "cns-5-40.bdf") ps-mule-encode-7bit 2))
295 (chinese-cns11643-6 296 (chinese-cns11643-6
296 (normal bdf "cns-6-40.bdf" ps-mule-encode-7bit 2)) 297 (normal bdf ("cns6-40.bdf" "cns-6-40.bdf") ps-mule-encode-7bit 2))
297 (chinese-cns11643-7 298 (chinese-cns11643-7
298 (normal bdf "cns-7-40.bdf" ps-mule-encode-7bit 2)) 299 (normal bdf ("cns7-40.bdf" "cns-7-40.bdf") ps-mule-encode-7bit 2))
299 (indian-2-column 300 (indian-2-column
300 (normal bdf "mule-indian-24.bdf" ps-mule-encode-7bit 2)) 301 (normal bdf ("ind24-mule.bdf" "mule-indian-24.bdf") ps-mule-encode-7bit 2))
301 (tibetan 302 (tibetan
302 (normal bdf "mule-tibmdx-24.bdf" ps-mule-encode-7bit 2))) 303 (normal bdf ("tib24-mule.bdf" "mule-tibmdx-24.bdf") ps-mule-encode-7bit 2)))
303 "Sample setting of the `ps-mule-font-info-database' to use BDF fonts. 304 "Sample setting of the `ps-mule-font-info-database' to use BDF fonts.
304 BDF (Bitmap Distribution Format) is a format used for distributing X's font 305 BDF (Bitmap Distribution Format) is a format used for distributing X's font
305 source file. 306 source file.
306 307
307 Current default value list for BDF fonts is included in `intlfonts-1.1' which is 308 Current default value list for BDF fonts is included in `intlfonts-1.1' which is
459 ;; cache CODE0 CODE1 ...) 460 ;; cache CODE0 CODE1 ...)
460 (defvar ps-mule-font-cache nil) 461 (defvar ps-mule-font-cache nil)
461 462
462 (defun ps-mule-generate-font (font-spec charset) 463 (defun ps-mule-generate-font (font-spec charset)
463 "Generate PostScript codes to define a new font in FONT-SPEC for CHARSET." 464 "Generate PostScript codes to define a new font in FONT-SPEC for CHARSET."
464 (let* ((font-cache (assoc (ps-mule-font-spec-name font-spec) 465 (let* ((font-name (ps-mule-font-spec-name font-spec))
465 ps-mule-font-cache)) 466 (font-name (if (consp font-name) (car font-name) font-name))
467 (font-cache (assoc font-name ps-mule-font-cache))
466 (font-src (ps-mule-font-spec-src font-spec)) 468 (font-src (ps-mule-font-spec-src font-spec))
467 (font-name (ps-mule-font-spec-name font-spec))
468 (func (nth 4 (assq font-src ps-mule-external-libraries))) 469 (func (nth 4 (assq font-src ps-mule-external-libraries)))
469 (scaled-font-name 470 (scaled-font-name
470 (if (eq charset 'ascii) 471 (if (eq charset 'ascii)
471 (format "f%d" ps-current-font) 472 (format "f%d" ps-current-font)
472 (format "f%02x-%d" 473 (format "f%02x-%d"
502 The generated code is inserted on prologue part except the code that sets the 503 The generated code is inserted on prologue part except the code that sets the
503 current font (using PostScript procedure `FM'). 504 current font (using PostScript procedure `FM').
504 505
505 If optional arg NO-SETFONT is non-nil, don't generate the code for setting the 506 If optional arg NO-SETFONT is non-nil, don't generate the code for setting the
506 current font." 507 current font."
507 (let ((font-cache (assoc (ps-mule-font-spec-name font-spec) 508 (let* ((font-name (ps-mule-font-spec-name font-spec))
508 ps-mule-font-cache))) 509 (font-name (if (consp font-name) (car font-name) font-name))
510 (font-cache (assoc font-name ps-mule-font-cache)))
509 (or (and font-cache (assq ps-current-font (nth 1 font-cache))) 511 (or (and font-cache (assq ps-current-font (nth 1 font-cache)))
510 (setq font-cache (ps-mule-generate-font font-spec charset))) 512 (setq font-cache (ps-mule-generate-font font-spec charset)))
511 (or no-setfont 513 (or no-setfont
512 (let ((new-font (cdr (assq ps-current-font (nth 1 font-cache))))) 514 (let ((new-font (cdr (assq ps-current-font (nth 1 font-cache)))))
513 (or (equal new-font ps-last-font) 515 (or (equal new-font ps-last-font)