emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: font-backend mechanism on Windows and Mac?


From: Kenichi Handa
Subject: Re: font-backend mechanism on Windows and Mac?
Date: Thu, 13 Sep 2007 20:55:00 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.0 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

In article <address@hidden>, Kenichi Handa <address@hidden> writes:

> I confirmed that bug, and found that the problem is not
> specific to Windows port.  As there were comments paying
> attention to anti-aliased drawing in xdisp.c, I didn't
> change code for handling overlapping when I committed
> font-backend codes, but I just found that there is a
> fundamental bug.  I'm now investigating how to fix it.

I've just installed fixes for X Window.  Could you please
fix w32term.c and w32font.c by the same way as done in
xterm.c and xftfont.c (the diffs are attached)?

Adrian, I think your Cocoa port needs the similar fix,
doesn't it?

---
Kenichi Handa
address@hidden

Index: xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.804.2.91
retrieving revision 1.804.2.92
diff -u -r1.804.2.91 -r1.804.2.92
--- xterm.c     21 Aug 2007 04:53:43 -0000      1.804.2.91
+++ xterm.c     13 Sep 2007 11:02:20 -0000      1.804.2.92
@@ -1228,13 +1228,18 @@
 x_set_glyph_string_clipping (s)
      struct glyph_string *s;
 {
-  XRectangle r;
-  get_glyph_string_clip_rect (s, &r);
-  XSetClipRectangles (s->display, s->gc, 0, 0, &r, 1, Unsorted);
 #ifdef USE_FONT_BACKEND
-  s->clip_x = r.x, s->clip_y = r.y;
-  s->clip_width = r.width, s->clip_height = r.height;
-#endif /* USE_FONT_BACKEND */
+  XRectangle *r = s->clip;
+#else
+  XRectangle r[2];
+#endif
+  int n = get_glyph_string_clip_rects (s, r, 2);
+
+  if (n > 0)
+    XSetClipRectangles (s->display, s->gc, 0, 0, r, n, Unsorted);
+#ifdef USE_FONT_BACKEND
+  s->num_clips = n;
+#endif
 }
 
 
@@ -1251,10 +1256,12 @@
 #ifdef USE_FONT_BACKEND
   if (enable_font_backend)
     {
-      r.x = dst->clip_x = src->x;
-      r.width = dst->clip_width = src->width;
-      r.y = dst->clip_y = src->y;
-      r.height = dst->clip_height = src->height;
+      r.x = src->x;
+      r.width = src->width;
+      r.y = src->y;
+      r.height = src->height;
+      dst->clip[0] = r;
+      dst->num_clips = 1;
     }
   else
     {
@@ -2839,7 +2846,7 @@
            x_set_glyph_string_clipping (next);
            x_draw_glyph_string_background (next, 1);
 #ifdef USE_FONT_BACKEND
-           next->clip_width = 0;
+           next->num_clips = 0;
 #endif /* USE_FONT_BACKEND */
          }
     }
@@ -3028,7 +3035,7 @@
                XSetClipMask (prev->display, prev->gc, None);
                prev->hl = save;
 #ifdef USE_FONT_BACKEND
-               prev->clip_width = 0;
+               prev->num_clips = 0;
 #endif /* USE_FONT_BACKEND */
              }
        }
@@ -3055,7 +3062,7 @@
                XSetClipMask (next->display, next->gc, None);
                next->hl = save;
 #ifdef USE_FONT_BACKEND
-               next->clip_width = 0;
+               next->num_clips = 0;
 #endif /* USE_FONT_BACKEND */
              }
        }
@@ -3064,7 +3071,7 @@
   /* Reset clipping.  */
   XSetClipMask (s->display, s->gc, None);
 #ifdef USE_FONT_BACKEND
-  s->clip_width = 0;
+  s->num_clips = 0;
 #endif /* USE_FONT_BACKEND */
 }
 
Index: xftfont.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/Attic/xftfont.c,v
retrieving revision 1.1.2.19
retrieving revision 1.1.2.20
diff -u -r1.1.2.19 -r1.1.2.20
--- xftfont.c   22 Aug 2007 12:34:29 -0000      1.1.2.19
+++ xftfont.c   13 Sep 2007 11:04:11 -0000      1.1.2.20
@@ -512,12 +512,11 @@
                              FRAME_X_WINDOW (f),
                              FRAME_X_VISUAL (f),
                              FRAME_X_COLORMAP (f));
-  if (s->clip_width)
-    {
-      r.x = s->clip_x, r.width = s->clip_width;
-      r.y = s->clip_y, r.height = s->clip_height;
-      XftDrawSetClipRectangles (xft_draw, 0, 0, &r, 1);
-    }
+  if (s->num_clips > 0)
+    XftDrawSetClipRectangles (xft_draw, 0, 0, s->clip, s->num_clips);
+  else
+    XftDrawSetClip (xft_draw, NULL);
+
   if (with_background)
     {
       struct font *font = (struct font *) face->font_info;
@@ -532,8 +531,6 @@
 
   XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont,
                 x, y, code, len);
-  if (s->clip_width)
-    XftDrawSetClip (xft_draw, NULL);
   if (s->font_info != face->font_info)
     XftDrawDestroy (xft_draw);
   UNBLOCK_INPUT;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]