emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/xfaces.c


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/src/xfaces.c
Date: Sun, 20 Mar 2005 17:28:58 -0500

Index: emacs/src/xfaces.c
diff -c emacs/src/xfaces.c:1.316 emacs/src/xfaces.c:1.317
*** emacs/src/xfaces.c:1.316    Fri Mar 18 04:21:17 2005
--- emacs/src/xfaces.c  Sun Mar 20 22:28:55 2005
***************
*** 5167,5173 ****
              x_free_gc (f, face->gc);
              face->gc = 0;
            }
- 
          free_face_colors (f, face);
          x_destroy_bitmap (f, face->stipple);
        }
--- 5167,5172 ----
***************
*** 5190,5195 ****
--- 5189,5218 ----
  #ifdef HAVE_WINDOW_SYSTEM
    xassert (FRAME_WINDOW_P (f));
  
+ #ifdef HAVE_XFT
+   if (face->xft_draw == 0)
+     {
+       BLOCK_INPUT;
+       XColor colors[2];
+       face->xft_draw = XftDrawCreate (FRAME_X_DISPLAY (f),
+                                       FRAME_X_WINDOW (f),
+                                       FRAME_X_DISPLAY_INFO (f)->visual,
+                                       FRAME_X_DISPLAY_INFO (f)->cmap);
+       colors[0].pixel = face->xft_fg.pixel = face->foreground;
+       colors[1].pixel = face->xft_bg.pixel = face->background;
+       
+       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.red = colors[0].red;
+       face->xft_fg.color.green = colors[0].green;
+       face->xft_fg.color.blue = colors[0].blue;
+       face->xft_bg.color.red = colors[1].red;
+       face->xft_bg.color.green = colors[1].green;
+       face->xft_bg.color.blue = colors[1].blue;
+       UNBLOCK_INPUT;
+     }
+ #endif
    if (face->gc == 0)
      {
        XGCValues xgcv;
***************
*** 5201,5218 ****
--- 5224,5247 ----
        xgcv.graphics_exposures = False;
  #endif
        /* The font of FACE may be null if we couldn't load it.  */
+       if (!face->font)
+         fprintf (stderr, "%s: font is NULL\n", __func__);
        if (face->font)
        {
  #ifdef HAVE_X_WINDOWS
+ #ifndef HAVE_XFT
          xgcv.font = face->font->fid;
  #endif
+ #endif
  #ifdef WINDOWSNT
          xgcv.font = face->font;
  #endif
  #ifdef MAC_OS
          xgcv.font = face->font;
  #endif
+ #ifndef HAVE_XFT
          mask |= GCFont;
+ #endif
        }
  
        BLOCK_INPUT;
***************
*** 5329,5334 ****
--- 5358,5372 ----
        for (i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i)
        {
          struct face *face = c->faces_by_id[i];
+ #ifdef HAVE_XFT
+           if (face && face->xft_draw)
+             {
+               BLOCK_INPUT;
+               XftDrawDestroy (face->xft_draw);
+               UNBLOCK_INPUT;
+               face->xft_draw = 0;
+             }
+ #endif
          if (face && face->gc)
            {
              x_free_gc (c->f, face->gc);
***************
*** 6601,6606 ****
--- 6639,6647 ----
              }
          }
  
+ #ifndef HAVE_XFT
+       /* XXX: overstrike only works with non-aliased fonts.  How to figure
+          out if a font is aliased?  */
        if (needs_overstrike)
        {
          enum xlfd_weight want_weight = specified[XLFD_WEIGHT];
***************
*** 6618,6623 ****
--- 6659,6665 ----
                *needs_overstrike = 1;
            }
        }
+ #endif
      }
  
    if (font_scalable_p (best))
***************
*** 6890,6895 ****
--- 6932,6940 ----
    Lisp_Object attrs[LFACE_VECTOR_SIZE];
    Lisp_Object frame_font;
    struct face *face;
+ #ifdef HAVE_XFT
+   int do_font = 0;
+ #endif
  
    /* If the `default' face is not yet known, create it.  */
    lface = lface_from_face_name (f, Qdefault, 0);
***************
*** 6911,6916 ****
--- 6956,6962 ----
        set_lface_from_font_name (f, lface, frame_font,
                                  f->default_face_done_p, 1);
        f->default_face_done_p = 1;
+       do_font = 1;
      }
  #endif /* HAVE_WINDOW_SYSTEM */
  
***************
*** 6980,6985 ****
--- 7026,7034 ----
    check_lface (lface);
    bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs);
    face = realize_face (c, attrs, 0, NULL, DEFAULT_FACE_ID);
+ #warning "Must get face parameters and font cache right"
+   if (do_font)
+     face->font = FRAME_FONT (f);
    return 1;
  }
  




reply via email to

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