diff src/w32fns.c @ 89969:3219f94257bc

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-34 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-514 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-522 Update from CVS
author Miles Bader <miles@gnu.org>
date Sat, 04 Sep 2004 09:14:28 +0000
parents cf5499fb503f d407cd57475c
children cce1c0ee76ee
line wrap: on
line diff
--- a/src/w32fns.c	Wed Sep 01 21:21:18 2004 +0000
+++ b/src/w32fns.c	Sat Sep 04 09:14:28 2004 +0000
@@ -4644,6 +4644,7 @@
 {
   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);
 
@@ -4651,11 +4652,22 @@
     {
       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);