aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Choi2002-07-04 02:43:48 +0000
committerAndrew Choi2002-07-04 02:43:48 +0000
commit10ba2aeceaf21aca556245ae5cdfc38e044b91e8 (patch)
tree2b7aa21d37249aee542e8cfe557af3472409a1f2
parenta0f593ff6ad8e60f7ca544c6649456f0523d0a8e (diff)
downloademacs-10ba2aeceaf21aca556245ae5cdfc38e044b91e8.tar.gz
emacs-10ba2aeceaf21aca556245ae5cdfc38e044b91e8.zip
2002-07-03 Andrew Choi <akochoi@shaw.ca>
* macterm.c (x_list_fonts): Fix comment. Cache fonts matching pattern. Search cache first.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/macterm.c32
2 files changed, 30 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 23e7681b2f5..91186f660ee 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,7 +1,9 @@
12002-07-03 Andrew Choi <akochoi@shaw.ca> 12002-07-03 Andrew Choi <akochoi@shaw.ca>
2 2
3 * macterm.c (init_font_name_table): Also add entry for 3 * macterm.c (x_list_fonts): Fix comment. Cache fonts matching
4 jisx0201.1976-0 coding for Japanese font. 4 pattern. Search cache first.
5 (init_font_name_table): Also add entry for jisx0201.1976-0 coding
6 for Japanese font.
5 (XLoadQueryFont): Use it. 7 (XLoadQueryFont): Use it.
6 8
72002-07-02 Richard M. Stallman <rms@gnu.org> 92002-07-02 Richard M. Stallman <rms@gnu.org>
diff --git a/src/macterm.c b/src/macterm.c
index 728f7337f2a..7885f6c4a30 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -10860,11 +10860,9 @@ init_font_name_table ()
10860 10860
10861 10861
10862/* Return a list of at most MAXNAMES font specs matching the one in 10862/* Return a list of at most MAXNAMES font specs matching the one in
10863 PATTERN. Note that each '*' in the PATTERN matches exactly one 10863 PATTERN. Cache matching fonts for patterns in
10864 field of the font spec, unlike X in which an '*' in a font spec can 10864 dpyinfo->name_list_element to avoid looking them up again by
10865 match a number of fields. The result is in the Mac implementation 10865 calling mac_font_pattern_match (slow). */
10866 all fonts must be specified by a font spec with all 13 fields
10867 (although many of these can be "*'s"). */
10868 10866
10869Lisp_Object 10867Lisp_Object
10870x_list_fonts (struct frame *f, 10868x_list_fonts (struct frame *f,
@@ -10873,14 +10871,28 @@ x_list_fonts (struct frame *f,
10873 int maxnames) 10871 int maxnames)
10874{ 10872{
10875 char *ptnstr; 10873 char *ptnstr;
10876 Lisp_Object newlist = Qnil; 10874 Lisp_Object newlist = Qnil, tem, key;
10877 int n_fonts = 0; 10875 int n_fonts = 0;
10878 int i; 10876 int i;
10879 struct gcpro gcpro1, gcpro2; 10877 struct gcpro gcpro1, gcpro2;
10878 struct mac_display_info *dpyinfo = f ? FRAME_MAC_DISPLAY_INFO (f) : NULL;
10880 10879
10881 if (font_name_table == NULL) /* Initialize when first used. */ 10880 if (font_name_table == NULL) /* Initialize when first used. */
10882 init_font_name_table (); 10881 init_font_name_table ();
10883 10882
10883 if (dpyinfo)
10884 {
10885 tem = XCDR (dpyinfo->name_list_element);
10886 key = Fcons (pattern, make_number (maxnames));
10887
10888 newlist = Fassoc (key, tem);
10889 if (!NILP (newlist))
10890 {
10891 newlist = Fcdr_safe (newlist);
10892 goto label_cached;
10893 }
10894 }
10895
10884 ptnstr = XSTRING (pattern)->data; 10896 ptnstr = XSTRING (pattern)->data;
10885 10897
10886 GCPRO2 (pattern, newlist); 10898 GCPRO2 (pattern, newlist);
@@ -10902,6 +10914,14 @@ x_list_fonts (struct frame *f,
10902 10914
10903 UNGCPRO; 10915 UNGCPRO;
10904 10916
10917 if (dpyinfo)
10918 {
10919 XSETCDR (dpyinfo->name_list_element,
10920 Fcons (Fcons (key, newlist),
10921 XCDR (dpyinfo->name_list_element)));
10922 }
10923 label_cached:
10924
10905 return newlist; 10925 return newlist;
10906} 10926}
10907 10927