diff lisp/font.el @ 4099:a5e2d0f90f97

[xemacs-hg @ 2007-08-06 07:00:26 by aidan] Handle XFT fonts in x-font-create-object.
author aidan
date Mon, 06 Aug 2007 07:00:27 +0000
parents 316fddbf58e2
children b4f4e0cc90f1
line wrap: on
line diff
--- a/lisp/font.el	Sun Aug 05 21:51:15 2007 +0000
+++ b/lisp/font.el	Mon Aug 06 07:00:27 2007 +0000
@@ -587,7 +587,13 @@
   (let ((case-fold-search t))
     (if (or (not (stringp fontname))
 	    (not (string-match font-x-font-regexp fontname)))
-	(make-font)
+	(if (and (stringp fontname)
+		 (string-match font-xft-font-regexp fontname))
+	    ;; Return an XFT font. 
+	    (xft-font-create-object fontname)
+	  ;; It's unclear how to parse the font; return an unspecified
+	  ;; one.
+	  (make-font))
       (let ((family nil)
 	    (size nil)
 	    (weight  (match-string 1 fontname))
@@ -751,16 +757,15 @@
 ;;; #### FIXME actually, this section should be fc-*, right?
 
 (defvar font-xft-font-regexp
-  ;; #### FIXME what the fuck?!?
-  (when (and (boundp 'xft-font-regexp) xft-font-regexp)
-    (concat "\\`"
-	    "[^:-]*"				; optional foundry and family
-						; incorrect, escaping exists
-	    "\\(-[0-9]*\\(\\.[0-9]*\\)?\\)?"	; optional size (points)
-	    "\\(:[^:]*\\)*"			; optional properties
+  (concat "\\`"
+	  #r"\(\\-\|\\:\|\\,\|[^:-]\)*"	        ; optional foundry and family
+						; (allows for escaped colons, 
+						; dashes, commas)
+	  "\\(-[0-9]*\\(\\.[0-9]*\\)?\\)?"	; optional size (points)
+	  "\\(:[^:]*\\)*"			; optional properties
 						; not necessarily key=value!!
 	    "\\'"
-	    )))
+	    ))
 
 (defvar font-xft-family-mappings
   ;; #### FIXME this shouldn't be needed or used for Xft