emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: How to use xft font in unicode-xft branch


From: Meik Hellmund
Subject: Re: How to use xft font in unicode-xft branch
Date: Wed, 24 May 2006 17:43:11 +0200

The unicode-xft branch is great but it inherited the bugs from XFT_JHD_BRANCH, 
(a) character under cursor is unreadable and (b) scrolling destroys modeline
I tried to accomodate the patches by YAMAMOTO Mitsuharu
http://lists.gnu.org/archive/html/emacs-pretest-bug/2006-04/msg00301.html
and Michael Teske
http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-07/msg00466.html
and the following seems to work for me. 
It would be great if someone put them into cvs. 

Meik 

diff -r -u emacs-orig/src/xfaces.c emacs/src/xfaces.c
--- emacs-orig/src/xfaces.c     2006-05-22 15:38:53.000000000 +0200
+++ emacs/src/xfaces.c  2006-05-24 17:14:32.000000000 +0200
@@ -5396,7 +5396,7 @@
       
       XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->cmap,
                     colors, 2);
-      face->xft_fg.color.alpha = face->xft_fg.color.alpha = 0xffff;
+      face->xft_fg.color.alpha = face->xft_bg.color.alpha = 0xffff;
       face->xft_fg.color.red = colors[0].red;
       face->xft_fg.color.green = colors[0].green;
       face->xft_fg.color.blue = colors[0].blue;
@@ -7415,7 +7415,9 @@
   face = (struct face *) xmalloc (sizeof *face);
   *face = *base_face;
   face->gc = 0;
-
+#ifdef HAVE_XFT
+  face->xft_draw = NULL;
+#endif
   /* Don't try to free the colors copied bitwise from BASE_FACE.  */
   face->colors_copied_bitwise_p = 1;
 
diff -r -u emacs-orig/src/xterm.c emacs/src/xterm.c
--- emacs-orig/src/xterm.c      2006-04-17 08:36:08.000000000 +0200
+++ emacs/src/xterm.c   2006-05-24 17:30:21.000000000 +0200
@@ -1203,9 +1203,15 @@
 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);
+#define MAX_CLIP_RECTS 2
+  XRectangle r[MAX_CLIP_RECTS];
+  int n;
+ 
+  n = get_glyph_string_clip_rects (s, r, MAX_CLIP_RECTS);
+  XSetClipRectangles (s->display, s->gc, 0, 0, r, n, Unsorted);
+#ifdef HAVE_XFT
+  XftDrawSetClipRectangles (s->face->xft_draw, 0, 0, r, n);
+#endif
 }
 
 
@@ -1403,11 +1409,11 @@
           strlen (weight_name) +
           strlen (slant_name) + 
           5 +                      /* pixel */
-          9 +                      /* stars */
+          6 + 1 + 8 + 1 +          /* stars, "0", "iso10646", "1" */
           14 +                     /* dashes */
           1);                      /* null */
     xlfd = malloc (len);
-    sprintf(xlfd, "-%s-%s-%s-%s-*-*-%d-*-*-*-*-0-*-*",
+    sprintf(xlfd, "-%s-%s-%s-%s-*-*-%d-*-*-*-*-0-iso10646-1",
            foundry, family, weight_name, slant_name,
            (int) (pixel + 0.5));
     return xlfd;
@@ -1594,7 +1600,7 @@
           for (i = 0; i < s->nchars; ++i)
             ch[i] = s->char2b[i].byte2 | (s->char2b[i].byte1 << 8);
           XftDrawString16 (s->face->xft_draw,
-                           &s->face->xft_fg,
+                          s->hl == DRAW_CURSOR ? &s->face->xft_bg : 
&s->face->xft_fg,
                            s->face->font,
                            x,
                            s->ybase - boff,
@@ -1602,8 +1608,8 @@
                            s->nchars);
         }
       else
-        XftDrawString8 (s->face->xft_draw,
-                        &s->face->xft_fg,
+       XftDrawString8 (s->face->xft_draw,
+                       s->hl == DRAW_CURSOR ? &s->face->xft_bg : 
&s->face->xft_fg,
                         s->face->font,
                         x,
                         s->ybase - boff,



-- 
Meik Hellmund
Institut fuer Mathematik, Uni Leipzig
e-mail: address@hidden
http://www.math.uni-leipzig.de/~hellmund




reply via email to

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