502
|
1 ;;; mule-x-init.el --- initialization code for X Windows under MULE -*- coding: iso-2022-7bit; -*-
|
428
|
2 ;; Copyright (C) 1994 Free Software Foundation, Inc.
|
872
|
3 ;; Copyright (C) 1996, 2002 Ben Wing <ben@xemacs.org>
|
428
|
4
|
|
5 ;; Author: various
|
|
6 ;; Keywords: mule X11
|
|
7
|
|
8 ;; This file is part of XEmacs.
|
|
9 ;;
|
|
10 ;; XEmacs is free software; you can redistribute it and/or modify
|
|
11 ;; it under the terms of the GNU General Public License as published by
|
|
12 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
13 ;; any later version.
|
|
14 ;;
|
|
15 ;; XEmacs is distributed in the hope that it will be useful,
|
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 ;; GNU General Public License for more details.
|
|
19 ;;
|
|
20 ;; You should have received a copy of the GNU General Public License
|
|
21 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
23 ;; Boston, MA 02111-1307, USA.
|
|
24
|
|
25 ;;; Commentary:
|
|
26
|
|
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."
|
872
|
43 (flet ((charset-font-width (charset)
|
|
44 (font-instance-width
|
|
45 (face-font-instance 'default (selected-device) charset)))
|
|
46
|
|
47 (twice-as-wide (cs1 cs2)
|
|
48 (let ((width1 (charset-font-width cs1))
|
|
49 (width2 (charset-font-width cs2)))
|
|
50 (and width1 width2 (eq (+ width1 width1) width2)))))
|
428
|
51
|
|
52 (when (eq 'x (device-type))
|
|
53 (condition-case nil
|
872
|
54 (unless (twice-as-wide 'ascii fullwidth-charset)
|
428
|
55 (set-charset-registry 'ascii roman-registry)
|
872
|
56 (unless (twice-as-wide 'ascii fullwidth-charset)
|
428
|
57 ;; Restore if roman-registry didn't help
|
|
58 (set-charset-registry 'ascii "iso8859-1")))
|
|
59 (error (set-charset-registry 'ascii "iso8859-1"))))))
|
|
60
|
|
61 ;;;;
|
|
62
|
|
63 (defvar mule-x-win-initted nil)
|
|
64
|
|
65 (defun init-mule-x-win ()
|
|
66 "Initialize X Windows for MULE at startup. Don't call this."
|
872
|
67 )
|