]> code.delx.au - gnu-emacs/blobdiff - src/xftfont.c
One more change by Ken Brown to avoid breaking Cygwin.
[gnu-emacs] / src / xftfont.c
index f2b4c2abe2bcdfd511fa83a14aa0f6356f60a25a..37b33b3ead8cf9d39a7f97b25617a5a9b513f60c 100644 (file)
@@ -58,7 +58,6 @@ struct xftfont_info
   int index;
   FT_Matrix matrix;
   Display *display;
-  int screen;
   XftFont *xftfont;
 };
 
@@ -70,11 +69,6 @@ struct xftface_info
   XftColor xft_bg;             /* color for face->background */
 };
 
-static void xftfont_get_colors (struct frame *, struct face *, GC gc,
-                                struct xftface_info *,
-                                XftColor *fg, XftColor *bg);
-
-
 /* Setup foreground and background colors of GC into FG and BG.  If
    XFTFACE_INFO is not NULL, reuse the colors in it if possible.  BG
    may be NULL.  */
@@ -377,7 +371,6 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
 
   xftfont_info = (struct xftfont_info *) font;
   xftfont_info->display = display;
-  xftfont_info->screen = FRAME_X_SCREEN_NUMBER (f);
   xftfont_info->xftfont = xftfont;
   /* This means that there's no need of transformation.  */
   xftfont_info->matrix.xx = 0;
@@ -486,18 +479,26 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
 }
 
 static void
-xftfont_close (struct frame *f, struct font *font)
+xftfont_close (struct font *font)
 {
   struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
 
 #ifdef HAVE_LIBOTF
   if (xftfont_info->otf)
-    OTF_close (xftfont_info->otf);
+    {
+      OTF_close (xftfont_info->otf);
+      xftfont_info->otf = NULL;
+    }
 #endif
-  block_input ();
-  XftUnlockFace (xftfont_info->xftfont);
-  XftFontClose (xftfont_info->display, xftfont_info->xftfont);
-  unblock_input ();
+
+  if (xftfont_info->xftfont)
+    {
+      block_input ();
+      XftUnlockFace (xftfont_info->xftfont);
+      XftFontClose (xftfont_info->display, xftfont_info->xftfont);
+      unblock_input ();
+      xftfont_info->xftfont = NULL;
+    }
 }
 
 static int