-;;; mule-conf.el --- configure multilingual environment -*- no-byte-compile: t -*-
+;;; mule-conf.el --- configure multilingual environment
;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN.
-;; Licensed to the Free Software Foundation.
-;; Copyright (C) 2005 Free Software Foundation, Inc.
+;; Licensed to the Free Software Foundation.
- ;; Copyright (C) 2002, 2003 Free Software Foundation, Inc.
++;; Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2003
+;; National Institute of Advanced Industrial Science and Technology (AIST)
+;; Registration Number H13PRO009
-;; Keywords: mule, multilingual, character set, coding system
+;; Keywords: i18n, mule, multilingual, character set, coding system
;; This file is part of GNU Emacs.
\f
;; These are tables for translating characters on decoding and
;; encoding.
-(define-translation-table
- 'oldjis-newjis-jisroman-ascii
- (list (cons (make-char 'japanese-jisx0208-1978)
- (make-char 'japanese-jisx0208))
- (cons (make-char 'latin-jisx0201) (make-char 'ascii))))
-(aset (get 'oldjis-newjis-jisroman-ascii 'translation-table)
- (make-char 'latin-jisx0201 92) (make-char 'latin-jisx0201 92))
-(aset (get 'oldjis-newjis-jisroman-ascii 'translation-table)
- (make-char 'latin-jisx0201 126) (make-char 'latin-jisx0201 126))
-
-(setq standard-translation-table-for-decode
- (get 'oldjis-newjis-jisroman-ascii 'translation-table))
+;; Fixme: these aren't used now -- should they be?
+(setq standard-translation-table-for-decode nil)
(setq standard-translation-table-for-encode nil)
-
- ;; Fixme: should this be retained? I guess it could be useful for
- ;; non-unified charsets.
- (defvar translation-table-for-input nil
- "If non-nil, a char table used to translate characters from input methods.
- \(Currently only used by Quail.)")
\f
;;; Make fundamental coding systems.
(aset latin-extra-code-table ?\225 t)
(aset latin-extra-code-table ?\226 t)
-(update-coding-systems-internal)
+;; Move least specific charsets to end of priority list
+
+(apply #'set-charset-priority
+ (delq 'unicode (delq 'emacs (charset-priority-list))))
+
+;; The old code-pages library is obsoleted by coding systems based on
+;; the charsets defined in this file but might be required by user
+;; code.
+(provide 'code-pages)
+
+;; Local variables:
+;; no-byte-compile: t
+;; End:
- ;;; arch-tag: 7d5fed55-b6df-42f6-8d3d-0011190551f5
+ ;; arch-tag: 7d5fed55-b6df-42f6-8d3d-0011190551f5
;;; mule-conf.el ends here
/* Can't load ASCII font. */
return Qnil;
+ if (fontset < 0)
+ fontset = new_fontset_from_font_name (result);
+
/* Since x_new_font doesn't update any fontset information, do it now. */
- FRAME_FONTSET(f) = fontset;
+ FRAME_FONTSET (f) = fontset;
- return build_string (fontsetname);
+ return fontset_name (fontset);
}
\f
int font_name_table_size = 0;
int font_name_count = 0;
- #if 0
- /* compare two strings ignoring case */
- static int
- stricmp (const char *s, const char *t)
- {
- for ( ; tolower (*s) == tolower (*t); s++, t++)
- if (*s == '\0')
- return 0;
- return tolower (*s) - tolower (*t);
- }
+ /* Alist linking character set strings to Mac text encoding and Emacs
+ coding system. */
+ static Lisp_Object Vmac_charset_info_alist;
- /* compare two strings ignoring case and handling wildcard */
- static int
- wildstrieq (char *s1, char *s2)
- {
- if (strcmp (s1, "*") == 0 || strcmp (s2, "*") == 0)
- return true;
-
- return stricmp (s1, s2) == 0;
- }
-
- /* Assume parameter 1 is fully qualified, no wildcards. */
- static int
- mac_font_pattern_match (fontname, pattern)
- char * fontname;
- char * pattern;
+ static Lisp_Object
+ create_text_encoding_info_alist ()
{
- char *regex = (char *) alloca (strlen (pattern) * 2 + 3);
- char *font_name_copy = (char *) alloca (strlen (fontname) + 1);
- char *ptr;
+ Lisp_Object result = Qnil, rest;
- /* Copy fontname so we can modify it during comparison. */
- strcpy (font_name_copy, fontname);
+ for (rest = Vmac_charset_info_alist; CONSP (rest); rest = XCDR (rest))
+ {
+ Lisp_Object charset_info = XCAR (rest);
+ Lisp_Object charset, coding_system, text_encoding;
+ Lisp_Object existing_info;
- ptr = regex;
- *ptr++ = '^';
+ if (!(CONSP (charset_info)
+ && STRINGP (charset = XCAR (charset_info))
+ && CONSP (XCDR (charset_info))
+ && INTEGERP (text_encoding = XCAR (XCDR (charset_info)))
+ && CONSP (XCDR (XCDR (charset_info)))
+ && SYMBOLP (coding_system = XCAR (XCDR (XCDR (charset_info))))))
+ continue;
- /* Turn pattern into a regexp and do a regexp match. */
- for (; *pattern; pattern++)
- {
- if (*pattern == '?')
- *ptr++ = '.';
- else if (*pattern == '*')
- {
- *ptr++ = '.';
- *ptr++ = '*';
- }
+ existing_info = assq_no_quit (text_encoding, result);
+ if (NILP (existing_info))
+ result = Fcons (list3 (text_encoding, coding_system, charset),
+ result);
else
- *ptr++ = *pattern;
+ if (NILP (Fmember (charset, XCDR (XCDR (existing_info)))))
+ XSETCDR (XCDR (existing_info),
+ Fcons (charset, XCDR (XCDR (existing_info))));
}
- *ptr = '$';
- *(ptr + 1) = '\0';
-
- return (fast_c_string_match_ignore_case (build_string (regex),
- font_name_copy) >= 0);
- }
-
- /* Two font specs are considered to match if their foundry, family,
- weight, slant, and charset match. */
- static int
- mac_font_match (char *mf, char *xf)
- {
- char m_foundry[50], m_family[50], m_weight[20], m_slant[2], m_charset[20];
- char x_foundry[50], x_family[50], x_weight[20], x_slant[2], x_charset[20];
-
- if (sscanf (mf, "-%49[^-]-%49[^-]-%19[^-]-%1[^-]-%*[^-]--%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]-%19s",
- m_foundry, m_family, m_weight, m_slant, m_charset) != 5)
- return mac_font_pattern_match (mf, xf);
- if (sscanf (xf, "-%49[^-]-%49[^-]-%19[^-]-%1[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]-%19s",
- x_foundry, x_family, x_weight, x_slant, x_charset) != 5)
- return mac_font_pattern_match (mf, xf);
-
- return (wildstrieq (m_foundry, x_foundry)
- && wildstrieq (m_family, x_family)
- && wildstrieq (m_weight, x_weight)
- && wildstrieq (m_slant, x_slant)
- && wildstrieq (m_charset, x_charset))
- || mac_font_pattern_match (mf, xf);
+ return result;
}
- #endif
- static Lisp_Object Qbig5, Qcn_gb, Qsjis, Qeuc_kr;
static void
- decode_mac_font_name (name, size, scriptcode)
+ decode_mac_font_name (name, size, coding_system)
char *name;
int size;
- #if TARGET_API_MAC_CARBON
- int scriptcode;
- #else
- short scriptcode;
- #endif
+ Lisp_Object coding_system;
{
- Lisp_Object coding_system;
struct coding_system coding;
- char *buf;
+ char *buf, *p;
- switch (scriptcode)
- {
- case smTradChinese:
- coding_system = Qbig5;
+ for (p = name; *p; p++)
+ if (!isascii (*p) || iscntrl (*p))
break;
- case smSimpChinese:
- coding_system = Qcn_gb;
- break;
- case smJapanese:
- coding_system = Qsjis;
- break;
- case smKorean:
- coding_system = Qeuc_kr;
- break;
- default:
- return;
- }
+
+ if (*p == '\0'
+ || NILP (coding_system) || NILP (Fcoding_system_p (coding_system)))
+ return;
+ #if 0
+ /* MAC_TODO: Fix encoding system... */
setup_coding_system (coding_system, &coding);
coding.src_multibyte = 0;
coding.dst_multibyte = 1;
foundry, family, weight, slant, cs) != 5)
return;
- if (strcmp (cs, "big5-0") == 0)
- coding_system = Qbig5;
- else if (strcmp (cs, "gb2312.1980-0") == 0)
- coding_system = Qcn_gb;
- else if (strcmp (cs, "jisx0208.1983-sjis") == 0
- || strcmp (cs, "jisx0201.1976-0") == 0)
- coding_system = Qsjis;
- else if (strcmp (cs, "ksc5601.1989-0") == 0)
- coding_system = Qeuc_kr;
- else if (strcmp (cs, "mac-roman") == 0
- || strcmp (cs, "mac-cyrillic") == 0
- || strcmp (cs, "mac-centraleurroman") == 0
- || strcmp (cs, "adobe-fontspecific") == 0)
- strcpy (mf, family);
+ *style = normal;
+ if (strcmp (weight, "bold") == 0)
+ *style |= bold;
+ if (*slant == 'i')
+ *style |= italic;
+
+ charset_info = Fassoc (build_string (cs), Vmac_charset_info_alist);
+ if (!NILP (charset_info))
+ {
+ strcpy (mf_decoded, family);
+ coding_system = Fcar (Fcdr (Fcdr (charset_info)));
+ }
else
- sprintf (mf, "%s-%s-%s", foundry, family, cs);
+ sprintf (mf_decoded, "%s-%s-%s", foundry, family, cs);
- for (p = mf_decoded; *p; p++)
- if (!isascii (*p) || iscntrl (*p))
- break;
-
- if (*p == '\0'
- || NILP (coding_system) || NILP (Fcoding_system_p (coding_system)))
- strcpy (mf, mf_decoded);
- else
+#if 0
+ /* MAC_TODO: Fix coding system to use objects */
+ if (!NILP (coding_system))
{
setup_coding_system (coding_system, &coding);
coding.src_multibyte = 1;
/* Realize the fully-specified face with attributes ATTRS in face
- cache CACHE for character C. Do it for X frame CACHE->f. If C is
- a multibyte character, BASE_FACE is a face that has the same
- attributes. Otherwise, BASE_FACE is ignored. If the new face
- doesn't share font with the default face, a fontname is allocated
- from the heap and set in `font_name' of the new face, but it is not
- yet loaded here. Value is a pointer to the newly created realized
- face. */
+ cache CACHE for ASCII characters. Do it for X frame CACHE->f. If
+ the new face doesn't share font with the default face, a fontname
+ is allocated from the heap and set in `font_name' of the new face,
+ but it is not yet loaded here. Value is a pointer to the newly
+ created realized face. */
static struct face *
-realize_x_face (cache, attrs, c, base_face)
+realize_x_face (cache, attrs)
struct face_cache *cache;
Lisp_Object *attrs;
- int c;
- struct face *base_face;
{
+ struct face *face = NULL;
#ifdef HAVE_WINDOW_SYSTEM
- struct face *face, *default_face;
+ struct face *default_face;
struct frame *f;
Lisp_Object stipple, overline, strike_through, box;
stipple = attrs[LFACE_STIPPLE_INDEX];
if (!NILP (stipple))
face->stipple = load_pixmap (f, stipple, &face->pixmap_w, &face->pixmap_h);
-
- xassert (FACE_SUITABLE_FOR_CHAR_P (face, c));
+ #endif /* HAVE_WINDOW_SYSTEM */
+
return face;
- #endif /* HAVE_WINDOW_SYSTEM */
}