]> git.eshelyaron.com Git - emacs.git/commitdiff
2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
authorJason Rumney <jasonr@gnu.org>
Tue, 31 Aug 2004 22:43:26 +0000 (22:43 +0000)
committerJason Rumney <jasonr@gnu.org>
Tue, 31 Aug 2004 22:43:26 +0000 (22:43 +0000)
* w32fns.c (w32_load_font): If a BDF font is already loaded, do not
reload it.

src/w32fns.c

index 0cb3abe91cdf18c41dd590ad6f933b43c19d49f3..8d695fd65bc16be2a1a69d90a7b06fe42daffd80 100644 (file)
@@ -4642,6 +4642,7 @@ int size;
 {
   Lisp_Object bdf_fonts;
   struct font_info *retval = NULL;
+  struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
 
   bdf_fonts = w32_list_bdf_fonts (build_string (fontname), 1);
 
@@ -4649,11 +4650,22 @@ int size;
     {
       char *bdf_name, *bdf_file;
       Lisp_Object bdf_pair;
+      int i;
 
       bdf_name = SDATA (XCAR (bdf_fonts));
       bdf_pair = Fassoc (XCAR (bdf_fonts), Vw32_bdf_filename_alist);
       bdf_file = SDATA (XCDR (bdf_pair));
 
+      // If the font is already loaded, do not load it again.
+      for (i = 0; i < dpyinfo->n_fonts; i++)
+       {
+         if ((dpyinfo->font_table[i].name
+              && !strcmp (dpyinfo->font_table[i].name, bdf_name))
+             || (dpyinfo->font_table[i].full_name
+                 && !strcmp (dpyinfo->font_table[i].full_name, bdf_name)))
+           return dpyinfo->font_table[i];
+       }
+
       retval = w32_load_bdf_font (f, bdf_name, size, bdf_file);
 
       bdf_fonts = XCDR (bdf_fonts);