changeset 90489:78a820ef12db

(xftfont_prepare_face): Make non-ascii face share face->extra with ascii face. (xftfont_done_face): Don't free face->extra of non-ascii face.
author Kenichi Handa <handa@m17n.org>
date Wed, 21 Jun 2006 01:23:08 +0000
parents 4094c5298ae1
children 8ef2cbaf626a
files src/xftfont.c
diffstat 1 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/xftfont.c	Tue Jun 20 07:35:06 2006 +0000
+++ b/src/xftfont.c	Wed Jun 21 01:23:08 2006 +0000
@@ -362,8 +362,15 @@
      FRAME_PTR f;
      struct face *face;
 {
-  struct xftface_info *xftface_info = malloc (sizeof (struct xftface_info));
+  struct xftface_info *xftface_info;
 
+  if (face != face->ascii_face)
+    {
+      face->extra = face->ascii_face->extra;
+      return 0;
+    }
+
+  xftface_info = malloc (sizeof (struct xftface_info));
   if (! xftface_info)
     return -1;
 
@@ -385,16 +392,18 @@
      FRAME_PTR f;
      struct face *face;
 {
-  struct xftface_info *xftface_info = (struct xftface_info *) face->extra;
+  struct xftface_info *xftface_info;
+  
+  if (face != face->ascii_face
+      || ! face->extra)
+    return;
 
-  if (xftface_info)
-    {
-      BLOCK_INPUT;
-      XftDrawDestroy (xftface_info->xft_draw);
-      UNBLOCK_INPUT;
-      free (xftface_info);
-      face->extra = NULL;
-    }
+  xftface_info = (struct xftface_info *) face->extra;
+  BLOCK_INPUT;
+  XftDrawDestroy (xftface_info->xft_draw);
+  UNBLOCK_INPUT;
+  free (xftface_info);
+  face->extra = NULL;
 }
 
 static unsigned