comparison lisp/mule/mule-x-init.el @ 102:a145efe76779 r20-1b3

Import from CVS: tag r20-1b3
author cvs
date Mon, 13 Aug 2007 09:15:49 +0200
parents 131b0175ea99
children
comparison
equal deleted inserted replaced
101:a0ec055d74dd 102:a145efe76779
23 ;; Boston, MA 02111-1307, USA. 23 ;; Boston, MA 02111-1307, USA.
24 24
25 ;;; Commentary: 25 ;;; Commentary:
26 26
27 ;;; Code: 27 ;;; Code:
28
29 ;;; Work around what is arguably a Sun CDE bug.
30
31 (defun x-use-halfwidth-roman-font (fullwidth-charset roman-registry)
32 "Maybe set charset registry of the 'ascii charset to ROMAN-REGISTRY.
33
34 Do this only if:
35 - the current display is an X device
36 - the displayed width of FULLWIDTH-CHARSET is twice the displayed
37 width of the 'ascii charset, but only when using ROMAN-REGISTRY.
38
39 Traditionally, Asian characters have been displayed so that they
40 occupy exactly twice the screen space of ASCII (`halfwidth')
41 characters. On many systems, e.g. Sun CDE systems, this can only be
42 achieved by using a national variant roman font to display ASCII."
43 (let ((charset-font-width
44 (lambda (charset)
45 (font-instance-width
46 (face-font-instance 'default (selected-device) charset))))
47
48 (twice-as-wide
49 (lambda (cs1 cs2)
50 (let ((width1 (funcall charset-font-width cs1))
51 (width2 (funcall charset-font-width cs2)))
52 (and width1 width2 (eq (+ width1 width1) width2))))))
53
54 (when (eq 'x (device-type))
55 (condition-case nil
56 (unless (funcall twice-as-wide 'ascii fullwidth-charset)
57 (set-charset-registry 'ascii roman-registry)
58 (unless (funcall twice-as-wide 'ascii fullwidth-charset)
59 ;; Restore if roman-registry didn't help
60 (set-charset-registry 'ascii "iso8859-1")))
61 (error (set-charset-registry 'ascii "iso8859-1"))))))
62
63 ;;;;
28 64
29 (defvar mule-x-win-initted nil) 65 (defvar mule-x-win-initted nil)
30 66
31 (defun init-mule-x-win () 67 (defun init-mule-x-win ()
32 "Initialize X Windows for MULE at startup. Don't call this." 68 "Initialize X Windows for MULE at startup. Don't call this."