jisx0201 display and x_list_fonts cache patch
YAMAMOTO Mitsuharu <[email protected]> Mon, 01 Jul 2002 18:41:23 +0900
| Newsgroups | gmane.emacs.macintosh.devel |
|---|---|
| Organization | Faculty of Science, Chiba University |
| Message-ID | <[email protected]> |
--Multipart_Mon_Jul__1_18:41:23_2002-1
Content-Type: text/plain; charset=US-ASCII
The attached patch remedies some problems somewhat related to Japanese
characters and input methods:
1. displaying jisx0201 roman/kana characters
Basically this part is imported from mac/src/macterm.c in Emacs
21.2. I confirmed that this patch works both with the Osaka font
(a built-in Japanese font in MacOS) and with converted ETL fonts.
2. caching font lists in x_list_fonts
SKK, one of widely-used Japanese input methods in Emacs,
frequently changes the cursor color to reflect the current input
mode. But Emacs in the current CVS invalidates the face cache
whenever the cursor color is changed (``++face_change_count;'' in
xfaces.c), and it causes lots of regexp matches in
mac_font_pattern_match. With caching font lists in x_list_fonts,
which is already done in xterm.c, the reconstruction of the face
cache can be done without ``the spinning rainbow''.
YAMAMOTO Mitsuharu
[email protected]
--Multipart_Mon_Jul__1_18:41:23_2002-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="macterm.c.patch"
Content-Transfer-Encoding: 7bit
*** macterm.c.~1.8.~ Thu Jun 20 11:02:31 2002
--- macterm.c Fri Jun 28 11:13:04 2002
***************
*** 10746,10754 ****
italic | bold,
sc));
}
! else
add_font_name_table_entry (mac_to_x_fontname (name, size, style,
sc));
}
/* Dispose of the iterators. */
--- 10746,10758 ----
italic | bold,
sc));
}
! else {
add_font_name_table_entry (mac_to_x_fontname (name, size, style,
sc));
+ if (smJapanese == sc)
+ add_font_name_table_entry (mac_to_x_fontname (name, size, style,
+ -smJapanese));
+ }
}
/* Dispose of the iterators. */
***************
*** 10833,10839 ****
= mac_to_x_fontname (name,
assc_entry->fontSize,
assc_entry->fontStyle,
! smRoman);
}
}
}
--- 10837,10843 ----
= mac_to_x_fontname (name,
assc_entry->fontSize,
assc_entry->fontStyle,
! -smJapanese);
}
}
}
***************
*** 10867,10873 ****
int maxnames)
{
char *ptnstr;
! Lisp_Object newlist = Qnil;
int n_fonts = 0;
int i;
struct gcpro gcpro1, gcpro2;
--- 10871,10878 ----
int maxnames)
{
char *ptnstr;
! Lisp_Object newlist = Qnil, key, tem;
! struct mac_display_info *dpyinfo = f ? FRAME_MAC_DISPLAY_INFO (f) : NULL;
int n_fonts = 0;
int i;
struct gcpro gcpro1, gcpro2;
***************
*** 10875,10880 ****
--- 10880,10896 ----
if (font_name_table == NULL) /* Initialize when first used. */
init_font_name_table ();
+ if (dpyinfo) {
+ tem = XCDR (dpyinfo->name_list_element);
+ key = Fcons (pattern, make_number (maxnames));
+ newlist = Fassoc (key, tem);
+ if (!NILP (newlist))
+ {
+ newlist = Fcdr_safe (newlist);
+ goto label_cached;
+ }
+ }
+
ptnstr = XSTRING (pattern)->data;
GCPRO2 (pattern, newlist);
***************
*** 10896,10901 ****
--- 10912,10923 ----
UNGCPRO;
+ if (dpyinfo) {
+ XSETCDR (dpyinfo->name_list_element,
+ Fcons (Fcons (key, newlist), XCDR (dpyinfo->name_list_element)));
+ }
+
+ label_cached:
return newlist;
}
***************
*** 11105,11111 ****
if (sscanf (name,
"-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]--%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]-%31s",
cs) == 1
! && 0 == strcmp (cs, "mac-roman"))
font->mac_scriptcode = smRoman;
}
--- 11127,11133 ----
if (sscanf (name,
"-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]--%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]-%31s",
cs) == 1
! && 0 == strcmp (cs, "jisx0201.1976-0"))
font->mac_scriptcode = smRoman;
}
--Multipart_Mon_Jul__1_18:41:23_2002-1--
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf