[COMMIT] Don't use the server-side fallbacks for XFT

Aidan Kehoe kehoea at parhasard.net
Sun Dec 17 06:41:40 EST 2006


[subject was “Since 2006-10-28, someone has broken `Face-frob-property'”.]

 Ar an seachtú lá déag de mí na Nollaig, scríobh Nix: 

 > [...] What's going on? It becomes clearer if we look at the face's plists.
 > 
 > Before:
 > 
 > (cl-prettyprint (object-plist (get-face 'foo-test-face)))
 > 
 > (foreground #<color-specifier
 >             global=
 > [...]
 >             font
 >             #<font-specifier
 >             global=<unspecified>
 >             fallback=#<font-specifier
 >             global=
 >             (((x)
 >               .
 >               "Bitstream Vera Sans Mono-11")
 >              ((encode-as-utf-8 initial x)
 >               .
 >               "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")

(That’s not from a 2006-10-28 check-out, I guarantee you! :-)

 > [...] Well, we've got a global spec-list now, but the damn silly thing has
 > gone and used the *last* fallback, the one I can't customize, the one
 > from C code, completely disregarding the X font that was *actually being
 > instanced*.
 > 
 > Face-frob-property is a bit of a monster and I haven't dug into it yet:
 > if anyone knows the cause, please say?

I don’t know the cause, but finding out is relatively important on my todo
list, as is finding out why custom-set-face-update-spec only works after a
restart. (Which is the reason the font menu is broken unless
font-menu-this-frame-only-p is set.) 

I was intending to commit the below as part of the solution for that, but
I’ve separated it out and committed it since it’s affecting you. 

 > The second problem was scarier. When writing a region --- *any* region,
 > up to and including a whole buffer --- I got this:
 > 
 > Debugger entered--Lisp error: (invalid-byte-code "unbalanced specbinding stack")
 >   write-region(1 1242 "~/.emacs-uptimes" nil 0)
 >   uptimes-save-uptimes()
 >   kill-emacs(nil)
 >   call-interactively(kill-emacs)
 >   command-execute(kill-emacs t)
 >   execute-extended-command(nil)
 >   call-interactively(execute-extended-command)
 >   (dispatch-event "[internal]")
 > 
 > Obviously this happened at the return from write-region (that's the only
 > place this error gets generated):
 > 
 > (gdb) print speccount
 > $13 = 29
 > (gdb) print specpdl_depth_counter
 > $14 = 30

Wow, that is scary. Looks like something corrupted the relevant byte code. 

APPROVE COMMIT  

NOTE: This patch has been committed.

lisp/ChangeLog addition:

2006-12-17  Aidan Kehoe  <kehoea at parhasard.net>

	* x-faces.el (x-init-face-from-resources):
	Only retain the fallbacks for the default face if we're not
	running on XFT. 


src/ChangeLog addition:

2006-12-17  Aidan Kehoe  <kehoea at parhasard.net>

	* faces.c (complex_vars_of_faces):
	Don't use server-side fallbacks when building with XFT support. 


XEmacs Trunk source patch:
Diff command:   cvs -q diff -Nu
Files affected: src/faces.c
===================================================================
RCS lisp/x-faces.el
===================================================================
RCS

Index: lisp/x-faces.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/x-faces.el,v
retrieving revision 1.26
diff -u -u -r1.26 x-faces.el
--- lisp/x-faces.el	2006/11/05 22:31:32	1.26
+++ lisp/x-faces.el	2006/12/17 11:15:37
@@ -791,18 +791,19 @@
       ;; since we don't want to try andale-mono's ISO-10646-1 encoding for
       ;; Amharic or Thai. This is fragile; it depends on the code in
       ;; faces.c.
-      (dolist (assocked '((x encode-as-utf-8 initial)
-			  (x two-dimensional initial)
-			  (x one-dimensional final)
-			  (x two-dimensional final)))
-	(when (and (specifierp (face-font face))
-		   (consp (specifier-fallback (face-font face)))
-		   (setq assocked 
-			 (assoc assocked 
-				(specifier-fallback
-				 (face-font face)))))
-	  (set-face-font face (cdr assocked) locale
-			 (nreverse (car assocked)) append))))
+      (unless (featurep 'xft-fonts)
+        (dolist (assocked '((x encode-as-utf-8 initial)
+                            (x two-dimensional initial)
+                            (x one-dimensional final)
+                            (x two-dimensional final)))
+          (when (and (specifierp (face-font face))
+                     (consp (specifier-fallback (face-font face)))
+                     (setq assocked 
+                           (assoc assocked 
+                                  (specifier-fallback
+                                   (face-font face)))))
+            (set-face-font face (cdr assocked) locale
+                           (nreverse (car assocked)) append)))))
 		     
     ;; Kludge-o-rooni.  Set the foreground and background resources for
     ;; X devices only -- otherwise things tend to get all messed up
Index: src/faces.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/faces.c,v
retrieving revision 1.52
diff -u -u -r1.52 faces.c
--- src/faces.c	2006/11/28 21:20:37	1.52
+++ src/faces.c	2006/12/17 11:15:37
@@ -2307,16 +2307,21 @@
 
     define_specifier_tag (Qencode_as_utf_8, Qnil,
 			  intern("specifier-tag-encode-as-utf-8-p"));
-
 #endif /* MULE */
 
+#ifdef USE_XFT
+    for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--)
+      inst_list = Fcons (Fcons (list1 (device_symbol),
+				build_string (*fontptr)),
+			 inst_list);
+
+#else /* !USE_XFT */
     inst_list =
       Fcons 
       (Fcons
        (list1 (device_symbol), 
 	build_string ("*")),
        inst_list);
-
 #ifdef MULE 
 
     /* For Han characters and Ethiopic, we want the misc-fixed font used to
@@ -2388,6 +2393,8 @@
        (list1 (device_symbol), 
 	build_string ("-*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*")),
        inst_list);
+
+#endif /* !USE_XFT */
 
 #endif /* HAVE_X_WINDOWS || HAVE_GTK */
 

-- 
Santa Maradona, priez pour moi!




More information about the XEmacs-Beta mailing list